paladin-t / paladin-t.github.io

Personal homepage. Surf via the URL https://paladin-t.github.io/.
https://paladin-t.github.io/
3 stars 0 forks source link

GB BASIC Alpha 2 #9

Open paladin-t opened 1 year ago

paladin-t commented 1 year ago

[Home|All articles|Permalink]

Previously on the project:


Quite a few new features have been added since my last post, that would be sufficient for another alpha release. As of the time of this writing, the latest alpha 2 is available on itch.io.

Linux port

The alpha version supports both Windows and Linux for the moment.

Editor tabs

In this alpha 2 version, I've added editors for font, actor, and scene assets. Audio editor is coming soon in alpha 3, and the runtime will be further more enhanced in alpha 4.


Improvements

Compared to the previous alpha, the new version implemented more editors, the pipeline and compiler have been updated to process and make use of assets created by these editors, the examples have been upgraded as well.


Font Editor

Font editor

There are three ways to output some text onto the screen in GB BASIC: print ... with the default font, text ... as a graphics primitive, and label ... with a TrueType font. The first way is primarily designed for debug purpose, the second one is for simple ASCII output, and the last one is for generic text representation in game (including both ASCII and UTF-8). To help present a random TTF, GB BASIC implements a font editor.


Actor Editor

Actor editor
Actor editor

An actor is considered being a wrapper and better version of sprite, which supports bigger frames and more advanced options. The new actor editor offers an integrated context and tools for making actors.


Scene Editor

Scene editor

You can edit both map data and map attributes with the map editor in alpha 1. The new scene editor as enhancement can refer to map and actor assets to make up a full scene.


Font for Text

The runtime offers a label statement to draw TTF text. First, define an area on a specific layer as a label, then feed the label with some text, it handles line-wrap and paging automatically.

window on
window 7, 111
def label(1, 16, 4, 2, 2) = window_layer, 2, 0, 10

label #0, "Hello World"
label #0, "你好世界"
label #0, "こんにちは世界"

The compiler will figure out which characters are used in your program, therefore the assets pipeline can emits only a sub set of the glyphs which are in-use in a TTF to the final ROM.

Font effects

You can also specify shadow or outline effects in the font editor, this effect is baked during building time before running.


Actor Operations

Actor definition

It was barely possible to make an actor before, but it is a past tense already. Most of the actor options could be defined in this editor as well, besides making actors. An actor could be referenced from code as #0, #1, etc. where the number indicates a specific asset page.

sprite on
option sprite8x16_enabled, true

fill actor(0, 56) = #0

let a = new actor()
def actor(a, 79, 63, 0, 0) = #0
play actor a, 0

Actor compacting

Actors are compacted for less ROM footprint.


Scene Operations

Scene is a high-level type of asset that refers to a base map asset, a group of actors and another layer of properties. There are two kinds of typical usages of a scene. First, it could be used as a "big" map, that only defines the tiles indices as def scene(...).

map on
fill tile(0, 5) = #0

map 0, 0
camera 0, 0

def scene(38, 22, 0) = #0

REM Other code to do other setup and actor loading...

Second, GB BASIC also implements a load scene(...) statement to offer a handy one-line shot that initializes everything.

load scene(0, 0, 0) = #0

In addition, use find actor(...) to access actors since the one-line loading doesn't return them.

let a = find actor(none_template, nothing)
play actor a, 0

Side Note

The alpha 2 version is mostly about improvements on the editors; in the next next version (alpha 4), I'll step on upgrading the runtime part, and also improve the editors again by then.


Though the latest version is alpha 2, you could get an impression of how working with full version would be like. There are two more alpha and two beta versions on the schedule, the overall progress is estimatedly 50% complete.

50% 50% - Overall progress

Running on different devices

100% 100% - Prototype progress (DONE):

100% 100% - Alpha 1 progress (DONE):

100% 100% - Alpha 2 progress (DONE):

5% 5% - Alpha 3 progress (WIP):

0% 0% - Alpha 4 progress (TODO):

0% 0% - Beta 1 progress (TODO):

0% 0% - Beta 2 progress (TODO):

More versions (TBD)?


Stick around for future updates if you are interested in GB BASIC, leave a message below if you got an idea or question. You can also support my development by getting my other projects listed on the main page of this site.

[Home|All articles|Permalink]