Jump to content

mksmith

+AtariAge Subscriber
  • Content Count

    1,152
  • Joined

  • Last visited

  • Days Won

    1

Blog Entries posted by mksmith

  1. mksmith
    Well it's been a pretty productive week - been busy working on quite a few projects over this period in the end. Things will slow down a bit now as I get back to work but we'll push on.

    Tower of Rubble
    Haven't done as much as I thought I would have but a very special thanks to @cimmerian for not only featuring Tower of Rubble on the his ZeroPage Homebrew show but also for helping me debug a frame overrun issue when starting the game on hardware (still waiting for my Harmony cart). The code for initialisation and beam processing is now nicely spread across many frames (although I did just see a beam one still exists somewhere ).
    Read more: http://atariage.com/forums/topic/287107-tower-of-rubble-wip/

    VS Code extension for batari Basic
    Was having a few issues with Visual bB whilst editing (the source is getting quite big) which were really starting to annoy me so I thought why not! Lets start another thing. So I've created an extension of batari Basic which gives me syntax highlighting, compilation and optional launching of Stella! Also just added a dasm option which does the same so you can compile assembly directly also. Still doing some testing as a I go - finding the odd issue or compilation error I haven't catered for but working nicely. Hope to release soon for the community.
    Read more: http://atariage.com/forums/topic/287262-visual-studio-code-extension-for-batari-basic/

    TIATracker module for batari Basic
    So why not just work on 2 things when you can add a 3rd! I saw @Muddyfunster posted on the forum about whether a music sequencer called TIATracker worked for batari Basic. As music a foreign area for me I was intrigued (I need some for Tower of Rubble). After having a play (still learning batari and the joy of assembly) I finally stumbled over a way to incorporate this into batari Basic (mostly automated but some manual editing required). Must say I was pretty happy with myself when I first heard the tune playing. My daughter didn't understand my joy when she came into the office though!
    Read more: http://atariage.com/forums/topic/287435-tiatracker-module-for-batari-basic/ and about the TIATracker here: http://atariage.com/forums/topic/250014-tiatracker-a-new-sound-routine-and-sequencer-application
  2. mksmith
    I've posted a first WIP release of my take on Tower of Rubble for the Atari 2600 using batari Basic and DPC+.

    Been really enjoying programming a game again after not doing so for quite a period of time. Still have a few things to knock off (especially sound which I'm dreading). Probably another few weeks to finish.
  3. mksmith
    So after a few more days of work i've now got a new titlescreen with some scrolling text and flashing colors (bank6 now full!), a more varied and colored tileset (still not sure of the colors yet) and the first beam/lazer?? dropping blocks. I've had to re-arrange stuff and play around to try and get access to certain things across a couple of banks. The main loop is in bank2 and I now have the player code in bank3 and the enemy stuff in bank4. Hoping this will work ok on a real machine but until I get a Harmony cart (or release a build soon) for some testing I can only keep my fingers crossed.

    I've converted some tile and data bank code into Macros which work quite well across various banks - except when you need to draw tiles!! I've setup a data bank to store some variables to check back in bank2 whether I need to drop a block. I have the requirement to draw the initial map and drop tiles but these are in different banks currently - hopefully I can fit it all into one eventually.

    I have a couple of way of dying now but need to get the game over process sorted next and tidy up a little bug in the player jumping. Once this is done I might release a build - hopefully some time in the next week or two. Reasonably happy with progress though.


  4. mksmith
    As discussed in the previous blog post, i am interested in a reasonably reusable animation engine which allows me to call a SetAnimation function to initialise a new animation then use generic UpdateAnimation and DrawAnimation functions to process it regardless of what i need animating. I need to set the total frames, the speed of the animation (by screen update generally), the frame to display and any positional (x and y) change.

    When starting this game I followed a few example games across the forum for inspiration which generally make use of the gosub ... to set the specific frame to the sprite required with a number of lookup data tables. The one benefit of this game is the animation will process and finish before the next check is required which does simplify everything just a bit - I don't need (thankfully) to make changes during the animation (might make a nice engine for something like Lode Runner maybe). As I want to eventually make this a 2 player game I want to reuse the animation frames when required but I didn't want to just duplicate it all.

    As noted in the previous blog I found this forum post discussing how to make this a little more dynamic (but due to pointers it still carries a bit of duplication per sprite). So armed with this I setup the following:

    dim player0AnimationId = k
    dim player0AnimationFrame = m
    dim player0AnimationSpeed = n
    dim player0IsAnimating = o

    const ANIMATION_STATIONARY = 0
    const ANIMATION_FALL = 1
    const ANIMATION_HANG = 2
    const ANIMATION_MOVE = 3
    const ANIMATION_CHANGE_DIRECTION = 4
    const ANIMATION_JUMP_UP = 5
    const ANIMATION_CLIMB_UP = 6
    const ANIMATION_CLIMB_DOWN = 7
    const ANIMATION_JUMP_SMALL = 8
    const ANIMATION_JUMP_LARGE = 9


    function SetPlayer0Animation
    rem temp1=AnimationId
    player0AnimationId = temp1
    player0IsAnimating = 1
    player0AnimationFrame = 0
    player0AnimationSpeed = 0
    return

    function UpdatePlayer0Animation
    rem validate
    if !player0IsAnimating then return

    rem prepare (got offset)
    ftemp1 = PL_ANIMATION_OFFSET[player0AnimationId]

    rem update position? (only on 0)
    if player0AnimationSpeed > 0 then goto _SKIP_UPDATEPLAYER0ANIMATION_MOVE

    rem read x and y to offset
    rem data is TotalFrames,TotalSpeed(+2),Frame(+0),X(+1),Y(+2)
    rem update x
    fresult = ftemp1 + 2 + (player0AnimationFrame * 3) + 1
    ftemp2 = PL_ANIMATION[fresult]
    if _Bit2_Player0_Dir_Left{2} then player0x = player0x - ftemp2 else player0x = player0x + ftemp2
    rem update y
    fresult = fresult + 1
    ftemp2 = PL_ANIMATION[fresult]
    player0y = player0y + ftemp2

    _SKIP_UPDATEPLAYER0ANIMATION_MOVE

    rem increment speed
    player0AnimationSpeed = player0AnimationSpeed + 1
    ;fresult = ftemp1 + 1 : if player0AnimationSpeed < 50 then goto _SKIP_UPDATEPLAYER0ANIMATION_FRAME
    fresult = ftemp1 + 1 : if player0AnimationSpeed < PL_ANIMATION[fresult] then goto _SKIP_UPDATEPLAYER0ANIMATION_FRAME
    player0AnimationSpeed = 0

    rem increment frames
    player0AnimationFrame = player0AnimationFrame + 1
    fresult = ftemp1 : if player0AnimationFrame < PL_ANIMATION[fresult] then goto _SKIP_UPDATEPLAYER0ANIMATION_FRAME

    rem complete
    player0IsAnimating = 0 : player0AnimationFrame = 0 : player0AnimationSpeed = 0

    ...

    _SKIP_UPDATEPLAYER0ANIMATION_FRAME

    return

    function DrawPlayer0Animation
    rem prepare
    ftemp1 = PL_ANIMATION_OFFSET[player0AnimationId]
    fresult = ftemp1 + 2 + (player0AnimationFrame*3) + 0 : ftemp2 = PL_ANIMATION[fresult]

    rem get frame pointer
    asm
    LDX #<PL_ANIMATION_FRAMES
    STX ftemp5
    end
    rem get frame
    player0pointerlo = ftemp5+(ftemp2*8 )
    asm
    LDA #((>PL_ANIMATION_FRAMES) & $0f) | (((>PL_ANIMATION_FRAMES) / 2) & $70)
    STA player0pointerhi
    end
    return

    I then configured the data as below. The offset gives me the location in the PL_ANIMATION table for the active animation. From there I can look up the Total Frames and Speed, then for the current animation frame I can grab the frame to display and the x and y offset for the frame.


    rem ANIMATION
    rem 0-0 Stationary
    rem 1-5 Fall
    rem 2-31 Hang
    rem 3-36 Move
    rem 4-62 Change Direction
    rem 5-79 Jump (up)
    rem 6-87 Climb (up)
    rem 7-113 Climb (down)
    rem 8-139 Jump (small)
    rem 9-153 Jump (large)
    data PL_ANIMATION_OFFSET
    0,
    5,
    31,
    36,
    62,
    79,
    87,
    113,
    139,
    153
    end
    data PL_ANIMATION
    1,1, 0,0,0,
    8,2, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1, 1,0,1,
    1,2, 2,0,0,
    8,1, 0,1,0, 3,1,0, 4,1,-1, 5,1,0, 6,1,0, 7,1,0, 8,1,1, 9,1,0,
    5,2, 10,0,0, 11,0,0, 12,0,0, 13,0,0, 14,0,0,
    2,3, 15,0,0, 16,0,0,
    8,3, 17,1,0, 18,0,-1, 19,1,-1, 20,2,0, 21,1,-2, 22,1,-2, 22,1,-1, 22,1,-1,
    8,3, 22,-1,1, 22,-1,1, 22,-1,2, 21,-1,2, 20,-2,0, 19,-1,1, 18,0,1, 17,-1,0,
    4,2, 23,0,0, 24,0,0, 25,0,0, 26,0,0,
    8,2, 23,1,-1, 23,1,0, 24,1,0, 24,1,0, 25,1,0, 25,1,1, 26,1,0, 2,1,0
    end


    data PL_ANIMATION_FRAMES
    %00011000
    %00000100
    %00011000
    %00111100
    %01011010
    %00011000
    %00101000
    %00100100

    %01000010
    %01011010
    %00100100
    %00011000
    %00011000
    %00111000
    %00101110
    %00100000

    %10000000
    %10110000
    %01000000
    %01110000
    %01101000
    %01101000
    %10100000
    %10100000

    ...
    end


    So i've got some further ideas about how this could work for a 2 player game (or multiple sprites such as enemies) using the same code by storing/restoring the state of the active object via some additional vars or DPC+ ram.

    If anyone has any suggestions to tiding up this further I'd be grateful - it has saved me about 700 bytes so far. I do find I'm needing to use a lot of temp variable declarations particularly around calculations. I guess I can't be too hard - being able to do this quickly in basic is pretty cool!
  5. mksmith
    So over the past week or so I've started a new game in batariBasic based on Tower of Rubble! Actually not too long after starting I saw that another user had also started their own version - looking forward to seeing what can be done in 4k with someone who appears to know what they are doing!

    I've been putting this together in DPC+ and its been a learning experience getting to understand some of the modest limitations of programming for the Atari 2600. One of the more interesting issues has been getting a little framework for animation. I've got a process I'd developed over time for Blitz/Monkey which worked pretty well but this is probably going to be too hard to bring over - essentially you provide all the key stuff such as frames (images), speed to animate, x & y adjustments etc and it went off and did it's thing. Referencing pointers to gfx seems to be a biggy in bateriBasic as I like to separate out each movement (ie. moving, jumping, falling etc) into it's own set but this is where it comes unstuck.

    I'd like a process I can re-use around frame-strips which I found a general solution to here but unless I put everything into the data section (haven't tested the 256 byte alignments here - there are about 26 frames from memory) you have to essentially hard-code your pointer due to how it compiles thus would need to duplicate a lot of code. I want to do a 2 player survival winner take all mode eventually and wish to reuse the player movement code for both players.

    Anyway after testing 8x8 tiles with a 8x8 sprite (using pfread) I wasn't happy how it all fitted on-screen, so I re-started this time creating a ram array (via DPC+) and storing the tile map here so I now have a 16x8 tiles which does fit better with the sprite size (though at the reduction of whats on-screen). I have also completed the full player movement though the animation side is very much still a WIP and is reasonably messy.

    I'd also started to get things ready for 2 player requirements but I've now stripped that all out so I can get back to concentrating on actually finishing the core game up first. I have also done a brief test of dropping a block onto the map with the little lazer? guide thingy but have yet to implement this back into the new game code. I've also run out of room in Bank2 where i've currently got the main loop and player code so will need to move this (thinking of just having the main loop and branching off to the player and falling stuff in other banks). I've also got a pause mode setup but the colors are not right currently.



    Anyway I've attached the current build below if anyone wants to have a go...



  6. mksmith
    I've created a template for batariBasic containing a basic game structure with the following features:
    DPC+ kernal Utilising multiple banks Title screen (bank6), play screen (bank 2), game over screen (bank 3) Pause mode (bank 3) - using B&W switch

    This is an adaption of the ex_title_screen_and_game_over.bas generously created by the following people (thank you!):

    ; Example program by Duane Alan Hahn (Random Terrain) using
    ; hints, tips, code snippets, and more from AtariAge members
    ; such as batari, SeaGtGruff, RevEng, Robert M, Nukey Shay,
    ; Atarius Maximus, jrok, supercat, GroovyBee, and bogax.

    Original available here: http://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#sprite_missile_bankswitching_example

    Note: I've put this here (mainly) for my own uses going forward and will update it as needed. Free to anyone who wishes to use.


    Last updated: 12 Dec 2018, v1.1


  7. mksmith
    Well this has come a surprise over the past 6 months. Earlier this year I picked up a C64 and 1541 II off eBay having started watching a number of retro videos in the period proceeding that purchase. All of a sudden I was back into my youth playing some classic games from the past - much to the probable annoyance of my wife and kids (I'd previously planned and built an Arcade cabinet [Nintendo - Donkey Kong] over a 10 year period so just another thing to clog up the house) though my son seemed to appreciate a game of Wizball.

    Not long after for some reason I started searching for some Atari 2600s to 'do up' ie clean, re-cap and sell (profit, any profit pfft!). So now 6 months later having spent a (fair) bit of money (this hobby isn't cheap in Australia) I still have 3 2600jrs each with a least one joystick and 1 to 3 games ready to sell all nicely presented in a box. I've certainly enjoyed the process of buying, cleaning and learning to solder and repair and have even got pretty good at doing it.

    During this I thought hey lets get one for myself - so I picked up a Vadar and modded it for RGB output (tried a 3rd part one which output was average - so I built one myself in the end). Now this was early on and my soldering skills nearly killed it but I persevered and it's now working quite nicely (also got some joystick parts for Bests and fully restored).

    Next up I wanted more so I then picked up a light sixer which was sold as not working. Replaced the power socket which got it working and then cleaned up some rough soldering around the switches eventually finding the RIOT was faulty also. Replaced that with a spare I had and now working nicely. Then for some reason on my final testing I must have shorted the joystick and nothing on the left was working arrrr. So my first post here asked for some help and eventually socketed the 4050 and unsoldered/re-soldered the joystick port and we are back up and running. The kids will not appreciated the history of such a beast but looking forward to opening my Christmas present shortly!

    Anyway, been a long time coder of games [remakes of stuff I love generally] using products such as Amos, BlitzBasic (all forms), Monkey etc as well as VB.Net which I've built a commercial product for my business (since seen the light and now coding a redo in c#). So hey I'd love to learn to do some stuff for the 2600!! So the last couple of weeks I've tried to plug away in assembly picking up bits and pieces but really going nowhere. So on the weekend I started looking at batariBasic and I've got to say for getting up and running very quickly this is a great tool. I've got a game I recently came across on the PC (and also the c64) which is simple but a bit of fun - so armed with batariBasic within a day I've got a little man running around animated and so forth.

    So (hopefully) going forward I want to remake this game on the Atari and maybe some others. The key will be finishing and not abandoning - fingers crossed!

    Wish me luck!






×
×
  • Create New...