Friday, January 8, 2010

Releasing 2.9.8, featuring structures

It is my pleasure to announce that Yabasic version 2.9.8 is now available for download. It's notable mainly because it features an implementation of structures that is actually usable. This is an unstable release and may contain quite a few bugs, and I would be very appreciative if you could help to test it. There is still a small amount of work that remains to be completed before I can finally stamp Done on structures, in particular providing an easy way to declare structures local or static.

To avoid confusion: this release does not incorporate any of Pedro's module code; it will probably be integrated into the next release (2.9.9). This is because I haven't had the opportunity to download and work on this code until now. You will notice that I've departed a little from my tentative schedule by working in this way, but I'm not terribly worried about that, as a stable Yabasic 3.0.0 release in early February still looks very feasible.

For your interest, here is a (fairly self-explanatory) example of structure usage.

// Enable the "explicit" option.
enable explicit

// Define terrain, creature, and item types.
terrain_None = 0
terrain_Water = 1
creature_None = 0
item_None = 0
item_Jewels = 1

// Define the map's width and height.
map_width = 100
map_height = 100

// Map structure for a basic roguelike game.
struct map (map_width, map_height)
terrain
creature
items (20)
end struct

// Fill the map.
for x = 1 to map_width
for y = 1 to map_height
map (x, y).terrain = terrain_Water
map (x, y).terrain = creature_None
for set_items = 1 to 20
map (x, y).items (set_items) = item_None
next
next
next

// Put jewels at a random location.
map (int (ran (map_width)) + 1, int (ran (map_height)) + 1).items (1) = item_Jewels

// And so on...

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.