Tony Wang

Steam | Itch | Twitter | GitHub


[Home|All articles|Permalink]

Previously on the project:


It's been over six months since the last alpha update. During this period of time, GB BASIC got significant progress which constitute as this alpha 4. As of the time of this writing, the latest alpha 4 is available on itch.io.

Linux port

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


Changelog

See the full changelog below of the alpha 4 for new features and modifications.

  • Runtime
    • Added a direction parameter to actor's hit callback
    • Added a deadzone feature to camera movement
    • Added a camera shake function
    • Added a pulse effect to perform tile animation
    • Added a RESET function to perform a warm reset
    • Added a TRIGGER module
    • Added a CURRENT_THREAD_ID query
    • Added an exception when queries for an unknown status
    • Added a projectile module
    • Added a point&click controller
    • Added a "persistent" property to actor
    • Added a new usage of the KILL statement (without parameter) to terminate all other threads
    • Added a "%#" escape to represent the current stack pointer of the current thread
    • (Breaking) Changed the maximum size of map/scene assets from 511 to 256
    • Improved actor move speed processing
    • Improved actor collision handling
    • Optimized glyph blit
    • Optimized the ASC(...) function
    • Optimized actor collision calculation
    • Fixed an arguments ordering issue with actor's hit callback
    • Fixed a map tearing issue with v-sync
    • Fixed an angle property calculation issue of the actor module
    • Fixed an actor-out-of-viewport calculation bug
    • Fixed a stack size calculation bug for DEBUG(TRUE)
    • Fixed an input callback unregistration bug
  • Syntax
    • Added a SELECT CASE/CASE*/ELSE/END SELECT statement for multi-conditional selection
    • Added an INC statement to increase the value of a variable
    • Added a DEC statement to decrease the value of a variable
    • Added a PUSH statement to push a value to the stack of the current stack
    • (Breaking) Changed the behaviour of the POP statement to pop and return one value from the stack of the current thread
    • Added a TOP statement to get the top value of the stack of the current thread
    • Added a set of STACK(N)/STACK{N} statements to get the specific Nth value of the stack of the current thread
    • Added a IS statement to determine the type of an object (actor, projectile)
    • (Breaking) Obsoleted the ARG statement
    • Changed the upper bound of RND() to 100 instead of 10000
  • Compiler
    • (Breaking) Renamed CALL RAISE to CALL ERROR
    • (Breaking) Added a (new) RAISE statement to raise exceptions
    • Added support for filling tiles, etc. with offset as #pg:n
    • Added heap and stack overflow detection
    • Added an INT statement to declare or read 16-bit integer inline sequence
    • Added TRIGGER related statements
    • Added an ATAN2 statement
    • Added a warning when DATA statement is written inside a conditional or loop structure
    • Added a warning when mixed 8x8 and 8x16 sprites
    • Added a DEG(A) statement to map angle from degree to GB BASIC representation
    • Added a warning when use colored-only feature within a classic cartridge (project)
    • Filtered duplicate errors/warnings
    • (Breaking) Changed the BASE_PROP to BASE_SPRITE_PROP
    • (Breaking) Renamed the FRAME_PROP to FRAME_INDEX_PROP, the semantic meaning of FRAME_PROP now stands for an animation frame
    • (Breaking) Renamed the ANIMATION_PROP to ANIMATION_INDEX_PROP, the semantic meaning of ANIMATION_PROP now stands for an animation definition
    • (Breaking) Added a WITH keyword, and changed MOVE ACTOR(...) dx, dy to MOVE ACTOR(...) WITH dx, dy
    • Added support for symbol aliases
    • Added support for declaration without assignment, i.e. LET FOO
    • Added an option to determine whether declaration is required before using a variable
    • Improved UX of undo/redo for scene and actor's definition editing
    • Optimized expression compiling
    • Optimized PUSH compiling
    • Fixed a crash bug when compile simple PRINT in a structure
    • Fixed a parsing bug of inline data sequence
    • Fixed an upper case parsing issue of the constants when the case-sensitive option is turned on
    • Fixed a jump offset bug with data sequence
    • Fixed a data sequence overflow bug
    • Fixed an instruction emission issue at the tail of a bank
    • Fixed an unnecessary frame data serialization issue with actor assets
    • Fixed a backslash parsing bug when it occurs inside a string
    • Fixed a multi-line IF parsing bug with tail comment
  • Editor
    • Added an option to specify the spacing rule for code editor
    • Added GOTO instruction generation when double clicked the head of a code line
    • Added tip bubbles for importing, exporting, etc.
    • Added an actor movement indicator to the scene editor
    • Added a warning for multiple player actors to the scene editor
    • Added a context menu to set actors in the scene editor
    • Added shortcuts Ctrl+U/Ctrl+Shift+U to toggle lower case/upper case
    • Added error/warning prompt in the code editor
    • Added a safe column indicator to the code editor
    • Added a global search view to the code editor
    • Added a shortcut Del to remove a project from the recent projects list
    • Added a shortcut F2 to rename a project from the recent projects list
    • Added dedicated icons for different types of projects
    • Added support for dual code editors as side by side
    • Added a default ordering for the recent projects view
    • Added actor frame importing and exporting via data sequence
    • Updated the code editor to allow moving cursor to the first none-space character when press the Home key
    • Updated to use different color to colorize the constants
    • Updated the scene editor to default to the objects layer
    • Updated to highlight the main menu icon when it's opened
    • (Breaking) Changed the end frame to closed interval for the actor editor, which is more intuitive
    • (Breaking) Changed data type of the components of a bounding box from 8-bit unsigned integer to 8-bit signed integer
    • Improved asset index parsing and colorizing in the code editor (i.e. #4:2)
    • Improved typed symbols colorizing in the code editor
    • Improved usability of the scene editor for actor operations
    • Improved initial content scaling for the graphics editors
    • Improved importing procedure to open a project directly after just importing it
    • Improved the UX if dependency asset were missing when create a map or scene asset
    • Improved the behaviour when rename a project to avoid unnecessary file renaming
    • Improved usability on touch screen
    • Improved asset-reference updating after adding or removing assets
    • Improved error message of wrong ID case-usage
    • Fixed a bounding box rendering range bug of the sprite editor
    • Fixed a finding bug when matches whole word in the code editor
    • Fixed a code line indicator bug of the code editor
    • Fixed an indent/unindent bug with context menu
    • Fixed a saving issue when there's unexpected end tag in code
    • Fixed an actor bounding box rendering issue
    • Fixed a crash bug when minimize the application with document opened
    • Fixed a paging bug after removing an asset
    • Fixed a crash bug after removing a SFX asset
    • Fixed a SFX asset removing bug from context menu
    • Fixed a scene asset refreshing bug after resolving its reference
    • Fixed an asset page invalidation bug after reloading a project
    • Fixed a code asset label colorizing issue
    • Fixed a code-of-line counting bug for multi-page code assets
    • Regular bugfix
  • Document and Help
    • Added revision validation for the example projects
    • Updated the examles to show the most recent features
    • Updated the reference manual

Highlights

In contrast to the preceding alpha version, I have implemented substantial updates across various components, including modules, controllers, syntax, editor, reference manual, and examples. Here are some key enhancements:

  • Added select case/case*/else/end select statement for multi-conditional selection
  • Improved the stack operation functions
  • Added trigger and projectile modules
  • Added a point&click controller
  • Improved the actor module
  • Improved the API and modules
  • Added a global search view to the code editor
  • Added support for dual code editors as side by side
  • Improved usability of the editors
  • A lot of bugfix
  • Updated the examples
  • Updated the reference manual

Looking ahead to Beta 1, the runtime and syntax will undergo further refinement. Beta 1 will mark the first iteration of a public release.


Select-Case Statement

GB BASIC has introduced a versatile multi-branch conditional statement, which includes support for values, ranges and comparisons. For instance:

let a = -1
select case a
  case 1
    print "1"
  case 2, 3
    print "2, 3"
  case 4 to 5
    print "4 to 5"
  case >= 6
    print ">= 6"
  else
    print "Ok"
end select

With the inclusion of the conventional if and on branching constructs, there are now a total of three distinct types of conditional statements available.

if 1 then print "Ok"

if 0 then print "Oops" else print "Ok"

if 0 then
  print "Oops"
else if 1 then
  print "Ok"
else
  print "Oops"
end if

if 0 then
  print "Oops"
else if 1 then
  if 1 then
    print "Ok"
  end if
else
  print "Oops"
end if
let b = 0
on b goto lbl0, lbl1, lbl2
goto lblElse
lbl0:
  print "Ok"
  end
lbl1:
  print "1"
  end
lbl2:
  print "2"
  end
lblElse:
  print "Else"

Stack Operations

The enhancements to the stack manipulation instructions now offer a more refined experience. Additionally, to ensure greater concurrency safety, you can utilize =stack0|stack1|... or =stack(n) to directly access a thread’s local stack variables.


Trigger and Projectile

In this iteration, two substantial new modules have been introduced.

Refer to the ensuing example for instructions on trigger usage.

' Use arrow keys to move the actor.
' Try entering the trigger then leaving it.

sprite on
option SPRITE8X16_ENABLED, true
fill sprite(0, 8) = #0

let a = new actor() ' Actor for the player.
set actor property(a, POSITION_PROP) = 80, 72
set actor property(a, FRAME_PROP) = 0, data 8,0,0,0, 0,8,2,0, -128
set actor property(a, BOUNDS_PROP) = -8, 7, -8, 7
control actor a, TOPDOWN_PLAYER_BEHAVIOUR

let b = new actor() ' Actor for the trigger's visual.
set actor property(b, FRAME_PROP) = 0, data 16,8,4,0, 0,8,6,0, -128

dim trigger[1] ' Allocate 1 trigger.
on trigger(0) ENTER bor LEAVE start hits_ ' Register it's callback.

gosub new_

let c = 0
print "Trigger Test"

loop:
  update
  goto loop

new_:
  let x = rnd(0, 18 - 2)
  let y = rnd(0, 16 - 2)
  def trigger(0) = x, y, 2, 2 ' Define the trigger.
  set actor property(b, POSITION_PROP) = x * 8, y * 8
  return

hits_:
  if stack0 = ENTER then
    c = c + 1
    print "Enter %d x%d", stack1, c
  else
    print "Leave %d x%d", stack1, c
    gosub new_
  end if
  sound on
  beep
  wait 30
  sound off
  end

Consult the subsequent example for guidance on launching projectiles.

' Use arrow keys to move the actor.
' Press A to launch a projectile.

sprite on
option SPRITE8X16_ENABLED, true
fill sprite(0, 8) = "CardTiles"

let a = new actor()
set actor property(a, POSITION_PROP) = 80, 72
set actor property(a, FRAME_PROP) = 0, data 8,0,0,0, 0,8,2,0, -128
set actor property(a, BOUNDS_PROP) = -8, 7, -8, 7
control actor a, TOPDOWN_PLAYER_BEHAVIOUR

fill projectile(8, 2) = "BulletTiles"
def projectile property(0, FRAMES_PROP            ) = 0, "Bullet"
def projectile property(0, BOUNDS_LEFT_PROP       ) = 0
def projectile property(0, BOUNDS_TOP_PROP        ) = 0
def projectile property(0, BOUNDS_RIGHT_PROP      ) = 8
def projectile property(0, BOUNDS_BOTTOM_PROP     ) = 8
def projectile property(0, BASE_TILE_PROP         ) = 8
def projectile property(0, ANIMATION_INTERVAL_PROP) = 15
def projectile property(0, ANIMATIONS_PROP        ) = data 0,4, 0,0, 0,0, 0,0, 0,0
def projectile property(0, LIFE_TIME_PROP         ) = 60
def projectile property(0, MOVE_SPEED_PROP        ) = 32
def projectile property(0, INITIAL_OFFSET_PROP    ) = 200
def projectile property(0, COLLISION_GROUP_PROP   ) = 0x01

let c = 0
print "Projectile Test"

loop:
  ' Press A to launch a projectile.
  if btnu(A_BTN) then
    ' let d = get actor property(a, ANGLE_PROP)
    ' let x = get actor property(a, POSITION_X_PROP)
    ' let y = get actor property(a, POSITION_Y_PROP)
    ' start projectile(0, x, y, d, PROJECTILE_NONE_FLAG)
    start projectile(0) with actor(a) ' This line is equivalent to the commented code above, yet simpler and faster.
    start beep_
  end if
  update
  goto loop

beep_:
  sound on
  beep
  wait 30
  sound off
  end

Global search

The innovative global search feature in GB BASIC allows you to zero in on your code with focus and efficiency.


Side-by-Side Code Editor

Side-by-side code editor

The side-by-side code editor support facilitates a seamless and fluid coding experience, allowing you to immerse yourself in the flow of writing and editing code.


We are getting closer to this project's formal launch. There are only two beta versions to go, the overall progress is estimatedly 80% complete.

80% 80% - Overall progress

Running on different devices

100% 100% - Prototype progress (DONE):

  • A working parser and a compiler
  • A runtime that supports a number of programming interfaces

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

  • A working assets processing pipeline flow
  • Code, tiles, map, palette editors
  • A built-in emulator
  • A ROM exporter
  • Migrated examples
  • A Linux port

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

  • Implement font, actor, scene editors
  • Implement asset pipelines to process those real user made assets

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

  • Implement an audio tracker and editor
  • Implement an asset pipeline to process those real user made assets
  • Fill in the reference manual

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

  • Add select case/case*/else/end select statement for multi-conditional selection
  • Improve the stack operation functions
  • Add trigger and projectile modules
  • Add a point&click controller
  • Improve the actor module
  • Improve the API and modules
  • Add a global search view to the code editor
  • Add support for dual code editors as side by side
  • Improve usability of the editors
  • A lot of bugfix
  • Update the examples
  • Update the reference manual

5% 5% - Beta 1 progress (WIP):

  • Improve usability of the editors
  • Improve the API and modules
  • Add more examples
  • Finish the reference manual
  • Port the project to other operating systems

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

  • Improve usability of the editors
  • Improve the API and modules
  • Add more customization options
  • Add more exporters

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]



Loading content...


(C) 2018-2024 Tony Wang RSS