Author Topic: CPCRetrodev 2021 : Fitzroy Dives Deep  (Read 1944 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 714
  • Country: fr
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #25 on: 14:47, 05 December 21 »
I didn't see your interrupt safe stop so I did without it but I'll have a look for v1.2.

The  function named PLAYER_ARKOS_STOP_IT in beginning of code example.
like
0
No reactions

Offline awergh

  • 464 Plus
  • *****
  • Posts: 324
  • Country: au
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #26 on: 15:02, 06 December 21 »
The  function named PLAYER_ARKOS_STOP_IT in beginning of code example.
Ah yes, I think what actually happened is I did my post without checking to see if there were any further replies (excited to be finally done bug fixing I think).


I have updated the first post with the change log and a copy of the game binaries in case people are too lazy to look at the itch.io page.
I started finishing (or is it continued finishing) the level that I didn't finish on submission night but it seems I don't quite remember what my plan was whoops...


Thinking about checkpoints again I assume that the most logical thing to do is let you use a checkpoint as many times as you like (this makes sense if a map has multiple checkpoints) rather than making them single use. My thought is that I will track the position of the activated checkpoint and use that to draw an updated graphic rather than changing the interactable from ready checkpoint to activated checkpoint (requiring two interactables that I don't have). I also can support multiple checkpoints this way as I can only restore the player to the last activated checkpoint.
like
0
No reactions

Offline awergh

  • 464 Plus
  • *****
  • Posts: 324
  • Country: au
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #27 on: 12:35, 20 December 21 »
I am now ready to release the second update for the game focussing on improving the difficulty of the game and adding an additional level that did not get completed in the initial release.
See the itch.io page or the first post (for the lazy) for the game binaries.

The biggest change is the inclusion of checkpoints. When a checkpoint is activated you will be able to restore their position on death to the checkpoint that was activated. You will retain all their progress in the level up to the point of death. If the checkpoint is unfriendly (eg underwater with no oxygen) you can choose not to restore the checkpoint and instead restart the level (resetting the level and player items).


I did experiment with flipping the enemy graphics but it turns out because I add the graphic to the backbuffer I can't just use a fliptable.
My initial attempt copying the graphic, flipping and then adding it to the backbuffer was visibly slower (didn't seem to play much slower but the enemies definitely moved side by side when comparing with and without).


I am happy to do a v1.3 if you have any suggestions that I should really include or any new improved bugs I have included in this version.
I would like to do something with flipping the enemies still. I was thinking about caching the graphics in some way (really only ever have 2 enemies on screen at a time) but decided better to release it then to agonise over it too much. I'm probably a bit tired of the game at this point but feedback is still welcome. I'm still keen to release the map editor in some form if it could mean some new levels. It would be fun to see what other people could make.


Changes in v1.2 (Build 578)
  • Removed yellow pixels from the U character in the font.
  • Removed an unnecessary pipe from collect and place pipes level ( level 9 ).
  • Add a dialog to allow the player to accept whether they want to restore from checkpoint or restart the level at the beginning.
  • Play switch sound effect when activating checkpoint.
  • Moved checkpoint in health water level ( level 8 ) so that it is not above a spike.
  • Changed oxygen cylinders to oxygen water in health water level ( level 8 ) to make sure the level is possible when loading from checkpoint.
  • Reduced the length of Player.c function logicPlayer() by splitting the function into several smaller functions. This was to make it easier to compile the game on low memory systems. This also provided a significant memory saving (when the right code was moved out).
  • Reduced number of points that can be gained on the first level.
  • Reduced number of points that can be gained on the second level.
  • Extra lives for points can only be awarded on easy and normal difficulties.
  • On the end of each level if the player has accumulated about 30K points an extra life will be awarded.
  • Added brutal difficulty (previously was hard).
  • Normal difficulty becomes hard difficulty (same as normal but no checkpoints).
  • Checkpoints can now only be used in easy and normal difficulty.
  • Replaced cpct_getScreenPtr with cpctm_screenPtr when used with constants to save memory.
  • Replaced cpct_px2byteM0 with cpctm_px2byteM0 when used with constants to save memory.
  • Display pipe count in collect and place pipes objective level.
  • Added collect and place pipes map to game as level 9.
  • Added checkpoints to game levels.
  • Draw an active checkpoint graphic onscreen if the player has activated it. (Only one checkpoint can be active at a time)
  • Created graphics for checkpoints (both active and inactive).
  • Added a checkpoint interactable that the player can activate to save their place within a level. If they die after a checkpoint has been saved it will start the player at the checkpoint location instead of the start of the level. (The state of the level and the player items will remain the same.)
  • Implemented activating a linked interactable when placing pipe.
like
4
Members reacted like:
XeNoMoRPH,ervin,Gryzor,ajcasado,

Offline awergh

  • 464 Plus
  • *****
  • Posts: 324
  • Country: au
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #28 on: Yesterday at 16:55 »
Having had a bit of a break from this I thought it was time to have another look at flipping sprites.
I feel I am being a bit hopeful to try and use cpct_drawSpriteHFlip_at to draw to a backbuffer but thought I would try anyway.

Ignoring whether that is impossible or not I cannot seem to get it to compile.
I added the following the top of the C file.
cpctm_createPixelFlippingTable(g_flipTable, 0x7F00, M0);

However when trying to use the fliptable it fails to compile. According to the documentation this looks like what I am supposed to do but it isn't working so far.
cpct_drawSpriteHFlip_at(sprite, mapMemory, TILE_WIDTH_BYTES, TILE_HEIGHT, g_fliptable);

I haven't got any examples outside of the user manual, I probably should be doing this in a separate single file project but its late (because of course it is :P ) so I am being lazy.
like
0
No reactions

Offline SpDizzy

  • Supporter
  • CPC664
  • *
  • Posts: 85
  • Country: es
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #29 on: Yesterday at 18:52 »
Hi awergh, what is exactly the error it shows on compile?

Maybe the flipping table is not declared on the file you are trying to use it?
If that's the case, you just need to declare it this way to be used:

Code: [Select]
cpctm_declarePixelFlippingTable(g_flipTable);That's just a declaration to make it accessible from different code files, it does not generate any code.

Also take into account the flipping table ocuppies 256 bytes, so be carefull to not overlap parts of your code
« Last Edit: Yesterday at 20:01 by SpDizzy »
like
0
No reactions

Offline Nesu

  • CPC464
  • **
  • Posts: 8
  • Country: 00
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #30 on: Yesterday at 19:27 »
cpctm_createPixelFlippingTable(g_flipTable, 0x7F00, M0);
...
cpct_drawSpriteHFlip_at(sprite, mapMemory, TILE_WIDTH_BYTES, TILE_HEIGHT, g_fliptable);
g_flipTable is not equal to g_fliptable (case sensitive)
like
2
Members reacted like:
SpDizzy,awergh,

Offline SpDizzy

  • Supporter
  • CPC664
  • *
  • Posts: 85
  • Country: es
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #31 on: Yesterday at 19:55 »
g_flipTable is not equal to g_fliptable (case sensitive)
Damn!! That's the error :)
like
0
No reactions

Offline awergh

  • 464 Plus
  • *****
  • Posts: 324
  • Country: au
    • Awards
Re: CPCRetrodev 2021 : Fitzroy Dives Deep
« Reply #32 on: Today at 02:34 »
Well that is a little embarrassing :doh: , but I'm sure I'm not the only person who missed the obvious.
I didn't really think I would be able to use it to try to the backbuffer but worth trying anyway.

So given cpct_drawToSpriteBuffer doesn't take a fliptable do I have to copy the sprite flip it and then add it to the backbuffer?
I have tried this but it is visibly slower (side by side enemies move faster without it).



Code: [Select]

void addActorSpriteToBackbuffer(u8 x, u8 y, u8* sprite, u8 direction)
{
    // Determine the position within the backbuffer that the new sprite should be added to.
    u8 position = y * backbufferWidth + x;
    u8* mapMemory = backbuffer + position;
    u8 flippedSprite[64];


    cpct_memcpy(flippedSprite, sprite, 64);


    if (direction == DIRECTION_LEFT)
    {
        cpct_hflipSpriteM0(TILE_WIDTH_BYTES, TILE_HEIGHT, flippedSprite);
    }


    // Draw the specified sprite on the back buffer as pointed to by mapMemory.
    cpct_drawToSpriteBuffer(backbufferWidth, mapMemory, TILE_WIDTH_BYTES, TILE_HEIGHT, flippedSprite);
}



I don't have the memory to add a 64 byte buffer to the enemy struct as 15x64 is a lot of memory.
(There is probably plenty of memory to be reclaimed by 960 bytes seems like a bit much).
I don't think I ever have more than 2 (maybe 3) enemies on the screen at once so I could sacrifice 192 bytes and effectively cache the sprite but I feel like this will require a fair bit of code to get working correctly.
like
0
No reactions