Jump to content
  • entries
    312
  • comments
    862
  • views
    245,366

Leprechaun goo

Sign in to follow this  
Guest

375 views

Time, she be precious and in scarce supply. I'm trying to put together all of the various bits & pieces I've written or thought about and make something a little closer to a playable version. My current goal is to get most of the player logic done so you'll be able to move the little block around with the joystick.Most recently I've been working on player joystick handling for when the player isn't "on grid". I want to allow the player to reverse direction in "mid stride" as it were. Hopefully this will make the game feel more responsive. This then lead me to thinking about the equate values for the various actions (Run_Right versus Run_Left) to make it simplest to reverse those directions with an XOR. Which then lead me to think about action to sprite lookups, and how to do that efficiently.It's all inter-related. Lots of back & forth. Making tweaks in one part of the code to make it more efficient (less cycles & bytes), then trying to then make sure you've fixed any cross dependencies & assumptions in other parts of the code. i.e. I decided to bit encode the actions, with the 2 LSbits being taken from the current position (or dig counter) for easy animation and the next LSbit being a direction (L/R or U/D). So now I've got to go back through the code and sync up anything where I assume the L/R bit was a different bit.Which then brings me to thinking about sprites. To start with I need 8 running sprites (4 left, 4 right), 8 swinging sprites, 4 climbing sprites & 8 zapping sprites. Unfortunately, I can't figure out how to squeeze a STA REFPn into the top of the kernel so I have left & right duplicates. That's a total of 28 sprites. Now, I know that each level uses 4 pages (256 bytes) of data: 160 bytes for the background, 20 bytes for the gold; which leaves 76 * 4 bytes for other uses, like the sprites. A 8 bytes per sprite, that means I can have 36 different sprites. Enough for my basic needs, but not enough to have separate player & enemy sprites unfortunately. I've also got to figure out how to efficiently copy those sprites into the 16 byte high blocks the foreground bitmap uses.I'm dripping in glue logic.

Sign in to follow this  


6 Comments


Recommended Comments

Why can't you squeeze in STA REFPn?

Right now the kernel is pretty stuffed. There's a critical 3 line section (eigth line of a row, sprite reposition line, first line of the next row) which is really tight for cycles, both in number and timing. Perhaps after I get a chunk of the glue logic working I'll see if there's 3 cycles available to squeeze the STA REFPn into. And, unfortunately, since REFPn is bit 3, I'll probably also need 4 cycles for the LDA ABS,Y to retrieve the value.

Share this comment


Link to comment
Why do you actually need to set it *inside* the kernel?

Because I reuse sprites. Every 8 lines the kernel reuses one of the two sprites (alternating). So multiple sprites on separate rows (or two sprites on the same row) won't flicker. Important when you have 5 fully independent sprites (player + 4 enemies).

 

If there are >2 sprites on a single row, then there is an "intelligent" flicker routine. Actually, I think I stole your idea (from Starfire?) where I do two loops through a bubble-sort routine, sorting the sprites by which has been skipped for the most frames. So 3 sprites will cycle through on-on-off, and four will cycle on-off-on-off (in theory). It actually can be more complex than that, since the re-use alternates between rows plus falling/climbing sprites have only one choice while others have two choices.

 

It's a little confusing, but also one of the breakthrough ideas I had (with some helpful suggestions) at the beginning of the project. Back in April 2003, according to my original development blog.

Share this comment


Link to comment

Hi there!

 

Because I reuse sprites.  Every 8 lines the kernel reuses one of the two sprites (alternating).  So multiple sprites on separate rows (or two sprites on the same row) won't flicker.  Important when you have 5 fully independent sprites (player + 4 enemies).

 

Hm... for 5 or 6 sprites, the Venture engine is also pretty good. It does constant 30Hz flicker on all 6 sprites though.

 

If there are >2 sprites on a single row, then there is an "intelligent" flicker routine.  Actually, I think I stole your idea (from Starfire?) where I do two loops through a bubble-sort routine, sorting the sprites by which has been skipped for the most frames.

So 3 sprites will cycle through on-on-off, and four will cycle on-off-on-off (in theory).  It actually can be more complex than that, since the re-use alternates between rows plus falling/climbing sprites have only one choice while others have two choices.

 

Star Fire does only 1 bubble sort iteration, the idea of doing 2 was a rather recent one. Even C7 does only 1, because I think overlapping sprites will be pretty rare in the end and it will never have 4 sprites overlapping at once :)

 

If you based the code on Star Fire, I found a little bug in the sorting code since, the branching should be

 

BCS DontSwap

 

rather than

 

BPL DontSwap

 

The later only works if your kernels line count is less than 128

(which it isn't anymore in C7 :x)

 

Also, if you based the sprite skipping code on the one from Star Fire, this can be done much more efficient for your game, since your sprites positions can only be on the visible part of the screen. There's much fuss involved for the Star Fire *universe* being *open* to all sides :sad:

 

Greetings,

Manuel

Share this comment


Link to comment

I simply used the concept of doing a partial sort rather than the actual code. I do 2 passes on the logic that if all sprites are on the same row, then 2 will be displayed, so they need to bubble to the bottom of the priority list. (The pattern in this case would be on-off-on-off-off, or 12-34-51-23-45.)

Share this comment


Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...