Development of Blake's 7 (was OASIS development)

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OASIS very very early alpha tech demo

Post by Chema »

Hi guys. I am back from my holidays :(

I had some time to work on OASIS and indeed did a lot of work in the engine's internals. Unfortunately nothing to show yet, but I will try to have something nice as soon as possible.

I implemented a first version of the point&click interface (cursor which is moved using the arrows and clicks done with the space-bar), and some layout of the verbs to use as commands for the game. I also worked on the resources (strings, for instance are now resources which will be loaded from disk when necessary) and other tech bits, and the engine is taking shape.

Resources in memory have a small three byte header indicating the resource type (first byte bits 0-6) and status (first byte bit 7 - in-use or marked for deleting), and a resource size (two bytes). Then follows a sub-header, which is resource-dependant, but starts with the resource ID (we will have up to 256 resources of each type). A resource with a bunch of strings will look like:

RESOURCE_STRING | FLAG_IN_USE
size
ID
"Hello. This is OASIS",0
"The new Oric scripting system",0
"Still under construction",0

Strings will be stored compressed and will be uncompressed on-the fly with my decompression routine, and will be loaded and discarded from memory as required. Same with scripts, objects, room data, etc.

The most difficult part is the walk boxes system, which is 90% implemented (still some glitches to solve). Basically the play area is divided into boxes. If an area is not "walkable" (for instance there is something preventing the character to walk, such as a hole or fence) then either there is no box for that area or it is marked as non-walkable (in case the status may change later on). There is also a walk-matrix indicating the next box the character must walk to to reach a destination if it exists. When the character must move to a given coordinates, first the box containing those coordinates is calculated, then the matrix is used to decide the path the character must follow to reach them, if it is possible.

It is hard to explain, but it is the way things work in SCUMM making characters intelligent enough to find a path to a given destination if it exists without the need of clicking several times to direct it manually.

And it is nearly working perfectly now.

I still need to add the z-plane masks. In short, the engine is not 3D, so in order to make a char move behind an object, walk boxes have a z-plane number. The room also has z-plane bitmasks for each plane so, when drawing, the needed masks are applied to make the character look behind or in-front of a section of the picture. This is also how things are done in SCUMM, so nothing new, but I think it is quite a CPU consuming task: it needs to draw as usual, but applying these masks to prevent corrupting the images which need to be in-front of the character. And this process is in the most inner drawing loop. Fortunately, we don't need very fast drawing for this kind of games.

There is still a long way to go: adding objects, interaction scripts, managing inventory items and all the resource loading from disk.

Oh, and I will need a nice font. For now I am using the one in Space:1999, but I'd prefer a 8x6 nice font, such as the ones Dbug usually designs :)

Here is a screenshot:
oasis.png
Let's see how far I can go with this project...
Last edited by Chema on Thu Sep 03, 2015 1:42 pm, edited 1 time in total.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: OASIS very very early alpha tech demo

Post by iss »

I'm dumbstruck - your work is simply amazing. :shock:
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: OASIS very very early alpha tech demo

Post by Dbug »

Chema wrote:Oh, and I will need a nice font. For now I am using the one in Space:1999, but I'd prefer a 8x6 nice font, such as the ones Dbug usually design :)
Which style of fonts were you thinking of, and which characters do you need?
If you are in Hires, you can display more then just the standard 96 characters, you could even have small bitmaps/symbols to put in the texts, even special accents, etc...
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OASIS very very early alpha tech demo

Post by Chema »

To be honest I still don't know. I guess that may depend on the game, but maybe it is even a better idea to have something nice and readable, not necessarily in tune with the game atmosphere... I really like the font you designed for A Weekend in Oslo.
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: OASIS very very early alpha tech demo

Post by Symoon »

Still looks amazing.
:D
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OASIS very very early alpha tech demo

Post by Chema »

I have been working a bit on this project. I must say the internal complexity is high and there are still so many things to do to have a working engine, that I find it a bit overwhelming.

Let me explain a bit further the walkbox system. I guess it might be interesting to have it written somewhere in this forum :)

Each room is divided into walkboxes, that is different areas or zones the player may walk on. These are stored along with the room data in memory as their boundaries (max and min column, and row of the box) and a fifth byte with some flags. One of these flags is if the box is currently walkable or not (and which may change during the game).

I put an object in the room, just to test things. The walk boxes are now (roughly drawn and numbered in the image):
walkboxes.png
Whenever the user clicks on the screen to move the character, the engine finds out the walkbox corresponding to the cursor coordinates. If the user clicks over an area not included in any walkbox the engine determines the "nearest" one and adjusts the coordinates accordingly. This benefits the user interaction a lot, of course.

After the origin walkbox (where the actor is) and the destination walkbox, the system determines the path to follow. If it is on the same walkbox, no problem. Else the walk matrix is examined to determine the next point the actor should move to.

The walk matrix (also part of the room data) contains at position (x,y) the next walkbox the actor should move in order to go from walkbox x to walkbox y. It is determined offline. For this example it is (beware there is an unseen box 5 at the far right end of the room):

Code: Select all

.byt 0, 1, 1, 1, 1, 1
.byt 0, 1, 2, 3, 2, 2
.byt 1, 1, 2, 1, 4, 4
.byt 1, 1, 1, 3, 4, 4
.byt 2, 2, 2, 3, 4, 5
.byt 4, 4, 4, 4, 4, 5
Let's imagine the user clicks on the far right portion of the wall. First, it is outside any walkbox, so the nearest one is determined, in this case box 4. The actor is in box 0. To go from 0 to 4 the matrix indicates the actor should move to box 1 first. A valid destination coordinate to perform this is obtained (the nearest contact point between 0 and 1) and movement is initiated.

Once the actor arrives at this intermediate point, as it is not the final destination, the process is repeated. Now he is in box 1 and should go to box 4: the matrix says it should go to box 2 first, and so on.

If at any point the next box indicated in the matrix is flagged as non-walkable, the destination is set up to the nearest contact point between boxes and movement stops there.

This way the actor moves around the cardboard box object in the picture without stepping onto it and without the user having to indicate the path to follow.

The same system is used if there is any obstacle. You can place a walkbox flagged as non-walkable while the obstacle is there, and the actor will not be able to move past it. Once the puzzle is solved and the obstacle is removed, you unflag the box and that is it.

Of course all that is done through the script languaje.

After some debugging it is mostly working (I have some glitches, but they are minor ones). Have a look at it here:
https://youtu.be/oTOtcPGmQbo

Next on my list is making that menu come to life, at least start with performing some basic actions with the box and the girl. But the internals of that are more complex than they seem... :(
User avatar
ibisum
Wing Commander
Posts: 1646
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: OASIS very very early alpha tech demo

Post by ibisum »

Looks great!
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: OASIS very very early alpha tech demo

Post by Godzil »

Chema: did you find this by yourself, or did you also read the same blog as me? ;)


For thoses interested, I strongly recommend the blog of the "Grumpy Gamer" aka Ron Gilbert, aka the creator of SCUMM:

http://grumpygamer.com/

and also the blog on his currently under creation new Point & clic game:

http://blog.thimbleweedpark.com/
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OASIS very very early alpha tech demo

Post by Chema »

Godzil wrote:Chema: did you find this by yourself, or did you also read the same blog as me? ;)
He he, I am aware indeed of those sites, and they are really interesting. However I knew about the walkbox system and other internals before I ever read them. Can't remember where I learnt about that, but surely read it somewhere... I did not invent it :)
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: OASIS very very early alpha tech demo

Post by iss »

Your work is amazing. When I read the post and watched the video - they remind me about the recently very fashionable games "Escape the room" - I think OASIS engine will be great for such type Oric games.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: OASIS very very early alpha tech demo

Post by Godzil »

Chema wrote:
Godzil wrote:Chema: did you find this by yourself, or did you also read the same blog as me? ;)
He he, I am aware indeed of those sites, and they are really interesting. However I knew about the walkbox system and other internals before I ever read them. Can't remember where I learnt about that, but surely read it somewhere... I did not invent it :)
The walkbox system is quite "stupid" and so clever at the same time, stupid because it's really easy to implement and does not need complex algorithm, and clever because it solve a lots of problems that you need to look at on nomal path finding and need low cpu resources :)
User avatar
Chema
Game master
Posts: 3014
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: OASIS very very early alpha tech demo

Post by Chema »

Hello again. Some little progress I'd like to share with you. This time the preliminary UI and Action system.

I want to make the user interaction as smart as possible. You can see there is no "Walk to" verb, as it is the default action. If you click on anything which is not an object, despite the verb you selected, it falls back to "Walk to". You can walk to an object, of course, not only a screen position. Also it updates the action sentence (the line just above the verbs) with any object the cursor is onto automatically (showing the name).

When performing an action, the actor first tries to move near the object in question, and the action may fail if it is not reachable.

Still need to add the possibility of using more than one object (the skeleton of the code is there, but no inventory yet to try) such as in "USE KEY WITH DOOR".

The most tricky part is response to actions. Following the idea in SCUMM, each object has a resource with the script code associated with it. This resource contains a table with all the possible verbs which could be applied and an offset in the script code where the action is dealt with. This way everything is directed by scripts, though I need to set defaults for impossible actions, or usual failures.

When an action is executed, this resource is located and the script code is executed in a thread (concurrently with other scripts).

The programmer can write code dealing with the box, which could be represented as:

Code: Select all

Look at->MakeActorSay(ego, "It's just a cardboard box"); StopScript;
Open->ChangeObjectState(box, OPEN); StopScript;
Close->ChangeObjectState(box, OPEN); StopScript;
...
Of course this is translated into script bytecode as:

Code: Select all

; - Resource Type: OBJECTCODE 
; - Resource Size
; - Resource ID (ID of the object)
; - Table of <verb ID, lo_offset,hi_offset> ending in $ff
; - Script with actions for verbs in the table.
.(
.byt RESOURCE_OBJECTCODE | $80
.word res_end-res_start+4
.byt 2
res_start
.byt VERB_LOOKAT
.word rlookat-res_start
.byt VERB_OPEN
.word ropen-res_start
.byt VERB_CLOSE
.word rclose-res_start
.byt $ff 
; Response to Look At
rlookat
	.byt SC_ACTOR_TALK, 0, 1, 5,  SC_STOP_SCRIPT
; Response to Open
ropen
	.byt SC_ACTOR_ANIMSTATE, 2, 1, SC_STOP_SCRIPT
; Response to Close
rclose
	.byt SC_ACTOR_ANIMSTATE, 2, 0, SC_STOP_SCRIPT
res_end
.)
And so on. Of course script code can use the internal variables to make decisions, set flags, call other scripts, etc. You will be able to ask a given actor to perform a full action. The script interpreter handles some very basic instructions right now, but this will change. Also all the strings are held in other resources. My idea is that all these could be loaded from disk on request.

I know there are still some glitches (the box is selected outside its graphic) and many details to be solved (I already found a few bugs), but again the progress pace is quite good and I still think the foundations are quite solid.

And now a video of all this working.

https://youtu.be/xUJDaTMoNHs


As usually any comment/feedback is more than welcomed!
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: OASIS very very early alpha tech demo

Post by Symoon »

Chema wrote:As usually any comment/feedback is more than welcomed!
Wow. Wow. Wow.
Drooling. :D
User avatar
Hialmar
Flight Lieutenant
Posts: 349
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: OASIS very very early alpha tech demo

Post by Hialmar »

Awesome stuff !
Hialmar
CEO and Silicium member.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: OASIS very very early alpha tech demo

Post by Godzil »

Chema: you are basically the God Master of Oric Game Programming :)
Post Reply