News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Fabrizio Radica

Castle Dungeon - Locomotive Basic

Started by Fabrizio Radica, 10:17, 02 October 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fabrizio Radica

Patch 1.1
Castle Dungeon patch 1.1
- Keys and Doors
- Fighting scenes
- some optimizations

Quote from: Fabrizio Radica on 19:02, 04 October 18OK... Final version of Castle Dungeon  ;)
but... without interrupts... :(

Sykobee (Briggsy)

Nice work - a little like my 2017 10-liner BASIC dungeon game except the monsters moved too slowly in mine, and you have implemented limited visibility.

Fabrizio Radica

Quote from: Sykobee (Briggsy) on 17:01, 05 October 18
Nice work - a little like my 2017 10-liner BASIC dungeon game except the monsters moved too slowly in mine, and you have implemented limited visibility.
where i find your game? :)

zhulien

I just thought of the following worth a try perhaps.  If you leave your player always in the same physical position of the screen eg... The middle. And move the entire map when the player moves. This might also be a speed improvement because... You only need to physically draw the bits of wall that change.  You can also do this with 2 temporary arrays 3x3 or 5x5... You fill 1 with what needs be viewed. Checking the map with this against should-be-viewed array to create a should-be-updated array. Then physically update the screen.  There may also be further array optimizations possible after that where array 2 is then also applied to array 1 so array 1 never needs a full read loop.


Other benefits would mean map sizes unbound by physical screen size but without any actual screen scrolling... You already have the illusion of it scrolling by fixing your players physical position. 

Fabrizio Radica

I've in mind a shooter with scrolling.Obviously, in Basic it's unthinkable to scroll all tiles together without firmware calls.  :doh: So i think to use this technics for unlimited scrolling :)
Thank's for your help :)


Quote from: zhulien on 03:06, 06 October 18I just thought of the following worth a try perhaps.  If you leave your player always in the same physical position of the screen eg... The middle. And move the entire map when the player moves. This might also be a speed improvement because... You only need to physically draw the bits of wall that change.  You can also do this with 2 temporary arrays 3x3 or 5x5... You fill 1 with what needs be viewed. Checking the map with this against should-be-viewed array to create a should-be-updated array. Then physically update the screen.  There may also be further array optimizations possible after that where array 2 is then also applied to array 1 so array 1 never needs a full read loop.


Other benefits would mean map sizes unbound by physical screen size but without any actual screen scrolling... You already have the illusion of it scrolling by fixing your players physical position.

Gryzor

Interesting mechanics in this one. And with the speed updates it certainly is quite playable!

GUNHED

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

zhulien

looking at the logic in here, a fairly small change could give you likely double the performance.  Currently you have a map array and a camera array for which you are looping twice, the y% then the x%.


Instead of the map and camera being a 2 dimentional number array, if you make them single dimentional string arrays, then you can output transfer the map to the camera and output the camera faster.  The only iterators you then need in BASIC are the y% iterators.  The x% iterator you replace directly with a camera(y%) = mid$(blah, 3, 3) and for displaying just output the entire camera string at the right screen location.  Since BASIC's print function is now handling the x% iterator it will be much much faster than treating everything a character at a time.


Another speedup once that is done, does not require any code change - but rather using one of the available fasttext patches - so that string output is inherently faster besides your BASIC logic. 


Once those 2 speedups are done, you should be running around your maze.

zhulien

#33
Quote from: Fabrizio Radica on 16:38, 03 October 18
Now i would like to play music, but it's not so simple in basic.  ::)


if you want to play a simple tune in basic, just put some data statements somewhere for the music notes, make a small function (gosub) that reads one and ouputs the notes.  call it every 50th of a second with the every command. you can speed up or slow down the actual music using a counter, eg: every 50th of a second gosub blah, blah most of the time will just subtract the counter and return.  You can tailor the counter to be any value to calibrate your data element to time, eg: 1 data element read = 1 second?  Remember don't block the basic program by having a simple busy loop within the every function, but rather just return if you want to do nothing vs read and output the next notes.

eto

Oh, nice little project... I'm still stunned what is possible in Locomotive Basic if done properly. This would have been a GREAT type-in back in the days.

Too sad the BAS file is not on the DSK.

andycadley

Quote from: zhulien on 07:02, 05 July 21

if you want to play a simple tune in basic, just put some data statements somewhere for the music notes, make a small function (gosub) that reads one and ouputs the notes.  call it every 50th of a second with the every command. you can speed up or slow down the actual music using a counter, eg: every 50th of a second gosub blah, blah most of the time will just subtract the counter and return.  You can tailor the counter to be any value to calibrate your data element to time, eg: 1 data element read = 1 second?  Remember don't block the basic program by having a simple busy loop within the every function, but rather just return if you want to do nothing vs read and output the next notes.
You really don't need to do anything that complicated in Locomotive BASIC, you can just use ON SQ to have your subroutine called when there is a slot free in the relevant sound queue and BASIC itself will take care of avoiding the music from blocking the rest of the program.

Powered by SMFPacks Menu Editor Mod