Object-to-object collision is working. So all enemies move around the map, obey map collision, player obeys map collision, enemies coming in contact with player bounding box detected.

It’s almost a real game engine. Right now, the player and enemies move on a 16×16 pixel grid movement. When you press a direction, the player moves for 16 pixels in that direction. It’s quick. It doesn’t sound quite right for an action game, but Arkista’s Ring got away with it so I figured I could as well – for a mini game.

But I’m rethinking that approach. I might change it to 8×8 or 2×2. Something smaller than 16×16. I’ll have to change the map collision routines for the player, but that’s not hard. Object/Object collision works on a pixel basis, so that has no effect on the map/player movement.

Next is to add projectiles (and protruding weapons/swords/etc), to the object handing queue.


13 Responses to “Game”

  1. How are you managing your object list? Fixed array, linked lists?

    • I have them set in priority groups. NPCs/enemies are one set, player is another, objects are another. Mask sprites for the BG layer (so parts of the BG layer pop over regular sprites) are the highest order.

      I started doing a pseudo link list (like on the MD), but then realized that I didn’t need it. I just clear all sprites (set all Y positions to off screen) at the start of every frame. This takes about 340 cycles, so it’s quick enough (though a vram-vram DMA could do that for me). It writes directly to vram, so I don’t need clear any local SAT or NPC entries.

      Then I just parse the NPC list and write to vram. The objects in the list, point to a sprite animation sheet which gives meta-cell decoding (if more than 16×16 sprite size), vram cell number, attributes, palettes, X/Y offsets, etc. The values are read, added/modified, and then written to vram.

      The NPC list is 8 entries long. The NPCqueue.ID,x value indicates if the slot is active or not, if not then skip it and go onto the next.

      I have a second NPC list for scrolling between screens (Neutopia style), so I parse 16 NPC objects total when scrolling between them (the new screen and the old screen).

      So, the sprite entries are not fixed. Object groups get written to the SAT in vram, and those could be different lengths from frame to frame. I have an index marker that keeps traps of the next free SAT entry in vram. So when the next group gets called to be drawn in the SAT, it picks up where the last group ended. Any remaining entries in the SAT, were already cleared on the initial SatReset call, and I don’t have to worry about writing to them. A link list would have saved me ~340 cycles, but it’s not a big deal considering I have ~119,436 cpu cycles a frame.

      I don’t keep a local copy of the SAT in ram, since on the PCE there isn’t much need to (vram is free to write during active display). I just build the SAT entry on the fly, and write it to vram on the fly.

      Heh, I hope I answered your question.

  2. ahah, writing sprites attributes directly in vram is what i do since my first shmup demo ..
    VRAM sat is well named SATB no ?? πŸ˜‰
    Then why using a 2nd buffer and do the job twice …
    Writing directly in VRAM is more faster,and i’am glad you do the same ..

    • “Then why using a 2nd buffer and do the job twice …”
      Exactly. I think.. there might have been one instance where I needed a buffer in ram, but now I can’t remember why now.

      How’s your shmup coming along?

  3. For now my shmup is in stand by, i want to finish my karate game first, it’s my priority .
    My shoot will be my secong big project, and BTW i have also a BTU for sgx in mind but i don’t know if i will use the AC or not ..

    • For my shmup i have some good routines already ( hud,score, hiscore, map/sprites collisions detection, player shoots, pods,and of course graphic routines for PCE/SGX)

  4. I don’t have any scripts mecanism, and any enemies sprites management yet, i’am far from stage design lol ..

  5. Ahh, ok. Can’t wait to check it out when you have that up and running.

  6. thank’s, i have a solid dev kit now, i think a good mix of Huc and asm .
    i customised all huc libraries and i’am all writing now in asm, and surprisingly i ‘am faster at coding than pure C, and add this to a damn smaller compiled code, asm speed.

    • Yeah, I’ve always held the idea that once you get use to ASM – it’s not difficult or inefficient (time wise) to code in. I can code out ideas/logic fairly fast. The only bad thing about ASM, and 65x (and RISC) more so – is that you have a high number of simpler instructions per unit of operation – which leads to more writing bugs (accidentally used the wrong mnemonic, forgot a support mnemonic, or got the address type wrong). With using macros, I’m able to cut that number of errors in my code, and prototype stuff a little bit faster, and condense the code for easier reading. Though, for regular 6280 code – I’ve learned to indent my stuff based on specific instructions (to stick out in the list) and to show dependent.

    • I recently made a nice FarCall function (with macro loader). It’s light on resource and doesn’t have a large foot print (7 bytes per ‘call’ instead of 4bytes for local JSR). I’ve been able to condense my game libs into banks of 8k, and leave a whole 32k open for data/extra bank-ram use. I still have a fixed 8k lib banks for important near-function calls. It makes code management that much easier, and I don’t have to worry about optimizing for library banks so much. It’s like have a larger linear address range (like the 68k). The assembler handles all the bank/address calculation, and I use the regular stack for the calls – so I can nest all kinds of ‘farcalls’.

  7. i ‘am not bothered by the simple ISA of 65x archi, i think it’s a benediction .
    Huge levels of optimisation should not be possible whit a complex one (like 68k or Z80).
    The real think which is a pain in the ass for me is mapping,this is why i keep huc, i let him handle all datas .Of course i do some by hand mainly for code .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: