News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Building Vic20 Shamus In PlayBASIC (Blog)

Started by kevin, January 11, 2019, 11:06:35 AM

Previous topic - Next topic

kevin






Building Vic20 Shamus In PlayBASIC (Blog)

     


Started: 5th Jan 2019





ABOUT:




    in this thread we're going to do something really crazy, we're going to re-create a VIC 20 styled display, then build  game remake (tech demo) of the classic Vic 20 title SHAMUS by Tom Griner.  





What is Shamus ?




   The Vic20 was an 8bit compute by Commodore released in the early 1980's.  It was one of the first colour home computers, notable for two things (that come to mind)  it had a very low resolution display and a tiny amount od RAM, of 5K


  The Vic20
 



  This is Shamus
 









Displaying Vic 20 Styled graphics in PlayBASIC



     To achieve our goal we first have to write some code that will recreate something that resembles a Vic 20/C64 screen mode.   The mode we're going for is the default  22 by 23 character map screen  (from the VIC20).   In this mode, the screen is not represented as an array of pixel data, but rather character indexes that range between 0 to 255 (8bit).   What the system does to display the screen, is read the top left character index (think of it as a map), then uses that index as an offset into the character graphics in memory to draw that 8 by 8 pixel area to the screen, and so on for all the characters on the screen.     To do this in PlayBASIC, I threw together a library called Retro Character Map Video Driver, which is a set of functions that decode our simulation memory and render it out as Pb image, the image is then scaled to the Pb screen to give us the real chunky pixel effect of the 8bit era.

     




Retro Character Map Video Driver (6th Jan 2019)



 This is a video of the character map display mode as you might have seen on a Vic20 system back in the early 1980's.    The screen is made up of 22 by 23 characters, each character is 8 by 8 pixels and has two colour controls in a separate colour map.  The colour map lets you choose the colour of the background and foreground from a palette of 16 colours.  So the character can only have two unique colours within it.    This is not actually how the Vic20 / C64 worked,  but similar enough for what i've got in mind.

The display routines are just big nest of fastPixel plots, where all the combinations are pre- computed in a On GOTO jump table.   I didn't write the jump table, choosing to the write some code that would generate the source code for me.      


Video:

 


 Music: https://bensound.com


Download:

    Get Source Code





kevin

#1
 Retro Character Map Video Driver  -   MULTI Sprite Test   (2019-01-12)

  Here's the second look at our basic retro character map video driver library with sprite rendering logic added.   Since the display is a character map we have to render our sprites into the character set dynamically.  The drawing process comes down to or'ing the set bits (sprite pixels) with the character merging them together.   The trick is dynamically reusing unused characters in our scene and merging unused characters into custom characters on the fly.  We have a limit of 256 possible characters since the screen is a 8bit character map, so in our game we'll use say less than 50 characters for static maps.  

 The goal of this bizarre project is to create a Vic20 styled Shamus remake/tech demo in PlayBASIC.    So what we want to get to do, is get this a point where we have some maps, collisions and basic game play up and running.    



Video

 



Download

     Attached

stevmjon

the year has come around fast. nearly 2 weeks into the new year already.

not a good way to start the year with an injury, stuck on the couch.
what happened to you? have you taught the dogs to fetch food from the fridge for you...
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

Quote from: stevmjon on January 12, 2019, 07:37:47 PM
not a good way to start the year with an injury, stuck on the couch.
what happened to you? have you taught the dogs to fetch food from the fridge for you...


      Not entirely sure what I did it, was doing some mountain goat tricks cutting grass with the whipper sniper along our front fence line about a month ago.     Pulled up  lame in my left hip, then rather than rest, had some busy weeks running around and it just got worse.  The doc thinks it's some pinched nerves, so imagine a few weeks of sharp ice pick styled pain shooting down your leg...

      It's getting better, but it's like taking one step forward and two backwards at the moment..  Feel ok today.

      I wish our dog Emma was able to do useful stuff, but unfortunately she passed away a couple of months ago.       

kevin

#4
 Retro Character Map Video Driver  -  Loading Characters & Looking at Shamus for Mapping Ideas (2019-01-14)

   Here's the third step along our journey to the ridiculous, today we look at how we're importing Character definitions from a text file, which would have been completely impractical back in the day, but today it's pretty trivial, but ugly looking code.   Since he was a way to get character definitions into memory we take a look at the original game to see about how we might represent the tile maps.  

    What you might not know is that Vic 20 only has 5K of ram..  Yes 5K...  now this game came on cartridge, which was only 8 K of rom and still has over 30 rooms in it.   :) -  Now granted the rooms are sparse and even a poorly written run-length compression routine should make mince meat of them, it goes to show just how challenged the poor coder were back in the 1980's  

     For the maps, I think we'll store them as a series of line definitions.  Most rooms would have less than 10 definitions, so it should be pretty easy to throw together something that will parse the rules for creating the level out of a text file.  This way the user can tinker with the level data while it's running, which is always handy.


Video

 



Download

     Attached

kevin


Retro Character Map Video Driver -   Tile Animation Test 1 - (2019-01-17)


 

kevin

#6
 RCMVD -  What Screen Mode Does Shamus Actually Use ??  (2019-01-19)


    Hmmm, so what screen mode does Shamus use on the Vic 20, that's todays rather stupid question !   Since the screen shots of Shamus seem  show 16 * 16 tiles but the screen memory map seems to be smaller than our 22 by 23 characters...   so erm, WTF... I asked some guys over on the Denial forums who are up to date in Vic20 coding hardware, so we'll what they have to say..  

    Originally I just assumed the Vic only had 8 by 8 character modes, but I've seem an 8 by 16 pixel mode referenced.   Not to sure how that actual works, so we'll wait and see.  

   

kevin

#7
 RCMVD -  Shamus Level Mock Up (2019-01-20 )


  And finally here's a look at a recreation of the Shamus first level, the sprites aren't in as yet, so here's just working on the scale of the level, tiles and colouring.   It's not quite right in this version but good enough to show you guys.


Video

   



Download

      Attached

kevin

#8
RCMVD -  Shamus  - Sprite Ripping - Sprite Pack  Format and Loading  (2019-01-23)

  Today we recap the changes made in the sixth example of the project, which focuses mainly on the process of  grabbing/ripping sprite frames from a the video capture of Shamus running in the emulator, then converting those ripped sprites to a mark up (text) format.    


Sprite-Pack Example



[Sprite]
name=Extra-Life-Sprite.png
size=16,16

[pixels]
0000111111000000
0000001100000000
0000001100000000
0000001100000000
0000111111000000
0011000000110000
1100110000001100
1100000011001100
1100001100001100
0011000000110000
0011111111110000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
[/pixels]
[/Sprite]






Video





Download

  attached bellow.

kevin

#9

RCMVD -  Shamus  -  Ripped Sprite Test load and render   (2019-01-25)


   Finally got then sprites working after a somewhat stoooooppppppiiiiidd assumption in the loader code...  That being the address in memory is where I think it is,  of course it wasn't, it was way outside the bounds...  making it do all sorts of odd things..

   None the less, here's the test scene rendering random sprites from the pack instead of the alien sprite.







Download

  attached bellow.



kevin

  Design Document Blues



   Been working on adding design document / Idea pad to for the Shamus source code / tutorial / retro project. The document is just a list of defines about how characters and environment in the game / will work. Figured this might make a handy video before I jump in and start adding this stuff, but damn is editing a longer video a black hole of time .. We'll get there but the last few session have just been about editing.. Hopefully it'll be done tomorrow, even If i have to skimp a bit on the overlays.

  #indiedev #gamedev #design #designdocument #howto #makegames

kevin

Retro Character Map Video Driver  -  Shamus -  Sprite Collision Problems  (2019-02-07)

    While working on a design document video (still not done yet) I needed to show some sprite collisions and thus begins the a couple of fun evenings of debugging the our sprite collision routine. 

     The routine does pixel perfect collisions between a sprite pair, it's just buggy atm.   The routine first does a region check to see they overlap, if so, we move on to comparing the inner blocks of the sprite.  If they overlap, we move down to comparing runs of pixels (bits),  what's interesting is that no matter how many times you've done something in the past,  there's always something that pops up to spoil the day.   

    Oh well, will try and get this working ASAP.. 



Video





kevin


Design Document Blues #2

   Wow this video is taking forever.. Back working on this video today (when time permits).. pretty chessy but, it'll have to do.. The drama has been the length, cut about 10 minutes out and it's still 40 minutes long.. ouch... that nobody will watch :)

   Getting there tho...

stevmjon

make the video as long as it needs to be. i would rather it was longer with the extra info, than cut shorter just to save video length.
if nobody watches it, i just hope at least nobody enjoyed it and leaves a like.

i hope your back is better now. pinched nerve doesn't sound fun.
sorry to read your dog emma passed away. i remember seeing a video you had with your dogs, when you got one from an animal shelter. which one was emma?
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


Hey Steve,

Quote from: stevmjon on February 15, 2019, 05:36:35 PM
make the video as long as it needs to be. i would rather it was longer with the extra info, than cut shorter just to save video length.
if nobody watches it, i just hope at least nobody enjoyed it and leaves a like.

    The only stuff that got cut out was where i'd wander off into unrelated tangent :)  Still has the usual amount of umm and ahhs etc.   

    Uploading now.. So it's good to get it done. 


Quote
i hope your back is better now. pinched nerve doesn't sound fun.

   It's a lot better thanks,  more a niggle now than a screaming ice pick shooting down your leg.


Quote
sorry to read your dog emma passed away. i remember seeing a video you had with your dogs, when you got one from an animal shelter. which one was emma?

   Emma was the stag hound (running around like an idiot) .   We lost her about 5 months ago and have just adopted a Kelpie cross.