Author Topic: Castle Dungeon - Locomotive Basic  (Read 3480 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabrizio Radica

  • Supporter
  • CPC664
  • *
  • Posts: 135
  • Country: it
  • Amiga and CPC6128 User
    • Retroacademy
  • Liked: 129
  • Likes Given: 125
Re: Castle Dungeon - Locomotive Basic
« Reply #25 on: 17:13, 05 October 18 »
Patch 1.1
Castle Dungeon patch 1.1
 - Keys and Doors
 - Fighting scenes
 - some optimizations

OK... Final version of Castle Dungeon  ;)
but... without interrupts... :(
Amstrad CPC6128 <3
http://www.facebook.com/groups/retroacademy/
Retroacademy.it - retrocomputing, retrogame anni &#039;70, &#039;80, &#039;90
Retroacademy.it - retrocomputing, retrogame anni '70, '80, '90

Offline Sykobee (Briggsy)

  • 6128 Plus
  • ******
  • Posts: 841
  • Country: gb
  • Liked: 317
  • Likes Given: 505
Re: Castle Dungeon - Locomotive Basic
« Reply #26 on: 19: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.

Offline Fabrizio Radica

  • Supporter
  • CPC664
  • *
  • Posts: 135
  • Country: it
  • Amiga and CPC6128 User
    • Retroacademy
  • Liked: 129
  • Likes Given: 125
Re: Castle Dungeon - Locomotive Basic
« Reply #27 on: 19:03, 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? :)
Amstrad CPC6128 <3
http://www.facebook.com/groups/retroacademy/
Retroacademy.it - retrocomputing, retrogame anni &#039;70, &#039;80, &#039;90
Retroacademy.it - retrocomputing, retrogame anni '70, '80, '90

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 787
  • Country: au
  • aka Vorax
    • 8bitology
  • Liked: 319
  • Likes Given: 339
Re: Castle Dungeon - Locomotive Basic
« Reply #28 on: 05:06, 06 October 18 »
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. 

Offline Fabrizio Radica

  • Supporter
  • CPC664
  • *
  • Posts: 135
  • Country: it
  • Amiga and CPC6128 User
    • Retroacademy
  • Liked: 129
  • Likes Given: 125
Re: Castle Dungeon - Locomotive Basic
« Reply #29 on: 12:54, 06 October 18 »
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 :)


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.
Amstrad CPC6128 <3
http://www.facebook.com/groups/retroacademy/
Retroacademy.it - retrocomputing, retrogame anni &#039;70, &#039;80, &#039;90
Retroacademy.it - retrocomputing, retrogame anni '70, '80, '90

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 17.010
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 4086
  • Likes Given: 7383
Re: Castle Dungeon - Locomotive Basic
« Reply #30 on: 15:06, 06 November 18 »
Interesting mechanics in this one. And with the speed updates it certainly is quite playable!

Offline GUNHED

  • 6128 Plus
  • ******
  • Posts: 2.795
  • Country: de
  • Reincarnation of TFM
    • FutureOS - The quickest OS for the CPC and Plus
  • Liked: 1300
  • Likes Given: 3034
Re: Castle Dungeon - Locomotive Basic
« Reply #31 on: 18:13, 06 November 18 »
Very funny!!!  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2021.01.24)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.07.15)

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 787
  • Country: au
  • aka Vorax
    • 8bitology
  • Liked: 319
  • Likes Given: 339
Re: Castle Dungeon - Locomotive Basic
« Reply #32 on: 08:56, 05 July 21 »
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.

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 787
  • Country: au
  • aka Vorax
    • 8bitology
  • Liked: 319
  • Likes Given: 339
Re: Castel Dungeon - Locomotive Basic
« Reply #33 on: 09:02, 05 July 21 »
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.
« Last Edit: 10:37, 05 July 21 by zhulien »

Offline eto

  • Supporter
  • 464 Plus
  • *
  • Posts: 430
  • Country: de
  • Liked: 272
  • Likes Given: 243
Re: Castle Dungeon - Locomotive Basic
« Reply #34 on: 10:08, 05 July 21 »
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.

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.003
  • Liked: 487
  • Likes Given: 82
Re: Castel Dungeon - Locomotive Basic
« Reply #35 on: 10:25, 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.