News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

CPCRetrodev 2021 : Fitzroy Dives Deep

Started by awergh, 08:36, 14 November 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arnaud

Quote from: awergh on 13:32, 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.

awergh

Quote from: Arnaud on 13:47, 05 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.

awergh

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.

awergh

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.

SpDizzy

#29
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:

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

Nesu

Quote from: awergh on 15:55, 21 January 22
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)

SpDizzy

Quote from: Nesu on 18:27, 21 January 22g_flipTable is not equal to g_fliptable (case sensitive)
Damn!! That's the error :)

awergh

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).





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.

Arnaud

#33
Hi @awergh,
here the function cpct_drawToSpriteBufferHFlipM0

Simply unzip in your cpctelera/src/sprites/drawToSpriteBuffer folder
then go to cpctelera folder and enter make.

I have tested with the softDoubleBuffer example, but it's a mode 1, not mode 0.

Arnaud

awergh

#34
Thanks heaps Arnaud  ;D . It is slightly slower side by side but I think it is manageable and I see there is no flip table which is nice memorywise.
I think there might be a bug (see below) the player and the snail are both currently flipped but they are displayed one pixel into the block underneath.

Nesu

Quote from: Arnaud on 10:20, 23 January 22
here the function cpct_drawToSpriteBufferHFlipM0
I think when calculating the starting drawing point:146       ;; Make HL point to the right-most byte of the first row of the buffer to be drawn
147       dec  a                        ;; [1] A = width - 1
148       add_hl_a                      ;; [5] HL += width - 1 (Point to last byte at the buffer)
it should be as:  ld a,c  ;; A = sprite width
  dec a
  add_hl_a
as at that point of the code A was holding sprite_width+buffer_width

Also, in function explanation, input parameters A and B are swapped (also wrong in CPCtelera's cpct_drawToSpriteBuffer)

Arnaud

Thanks @Nesu,
your correction is right  :)

Here the fixed version.

awergh

Thanks Arnaud and Nesu it is working now :).
I'm mostly done with flipping although I am keeping my memcpy solution for wincpctelera for now.
This means I am definitely doing v1.3.
So is there anything else I should be doing that I have overlooked as I don't really have much I was planning to change but am happy for some more suggestions.

Arnaud

#38
Quote from: awergh on 13:55, 24 January 22
I'm mostly done with flipping although I am keeping my memcpy solution for wincpctelera for now.
I should have to make a pull request for this code on cpctelera github, but i am not sure it will be taken in account :'(

Quote from: awergh on 13:55, 24 January 22This means I am definitely doing v1.3.
So is there anything else I should be doing that I have overlooked as I don't really have much I was planning to change but am happy for some more suggestions.
Making animations for Fitzroy movements ?

awergh

Quote from: Arnaud on 18:26, 24 January 22
I should have to make a pull request for this code on cpctelera github, but i am not sure it will be taken in account :'(
Yes you should but it does seem that progress has been a little slow lately with cpctelera unfortunately.
I'll include your additions with the source code instructions to make it easier for anyone to build it.


Quote from: Arnaud on 18:26, 24 January 22
Making animations for Fitzroy movements ?
I was thinking about some simple animations for Fitzroy's movement.

awergh

#40
I am now done with update number three (v1.3), this was a smaller release adding some extra sounds as well as some basic character animation and enemy sprite flipping.
See the itch.io page or the first post (for the lazy) for the game binaries.


I'm happy to consider work (mostly cosmetic changes in v1.3) on the game complete unless there are some bugs I need to fix.
I would like to provide the map editor and see if anyone wants to try making a level although it would need to be packaged up and instructions written.
It might be all too hard for other people to make levels (someone needs to compile the game to test the level) but I'll never know if I don't try.  ;D

Changes in v1.3 (Build 598)


       
  • Fixed bug where following collision with the player an enemy would start moving backwards.
  • Fixed unavoidable enemy in water health level (level eight) that could occur after the cracked tiles were removed.
  • Added sound for placing a pipe (repair sound).
  • Fixed a bug where the player sprite would cycle between walk and jump when standing on a floating platform.
  • Added sound when an enemy is hit by a projectile.
  • Added sound for opening a door.
  • Add player walking sprite to animate the player when walking on land.
  • Add player sprite for when they are jumping or falling on land.
  • Implemented flipping enemy sprites (enemies now turn around).

Arnaud

I find really better with player animation and flipping enemy sprites, it makes your game really more polished.

I'll try to finish this time your game with this version.

awergh

Quote from: Arnaud on 20:18, 02 February 22
I find really better with player animation and flipping enemy sprites, it makes your game really more polished.

I'll try to finish this time your game with this version.
Thanks, it certainly feels the most polished.
I'm still aiming to finish it from start to finish on brutal in one sitting but so far I've died on level 9.

ervin

I've finally given this game the playtime it deserves.
It's fantastic!
I think you've done a great job with the updates, and it is indeed much more polished now.

awergh

Quote from: ervin on 13:17, 03 February 22I've finally given this game the playtime it deserves.
It's fantastic!
I think you've done a great job with the updates, and it is indeed much more polished now.
Thanks, how far did you get?

Recently I set myself a goal to finish my game on brutal in a single sitting without any snapshots and I can now say on the 9th attempt I was successful ;D .
(It has been quite a while since I finished one of my games from start to finish, it is so much faster to play the levels individually.)
You cannot view this attachment.

WinAPE lets you record the play session so if you have a spare 1h 12m 21s spare you can see me play it not quite perfectly (there were a few mistakes) but pretty good as there were no deaths in the final attempt  :o .
Playback isn't quite as convenient as a video but this way I didn't have to worry about getting to the end only to discover the video broke.
You cannot view this attachment.

I'm guessing .snr files are not normally posted as its not one of the permitted attachments.

Powered by SMFPacks Menu Editor Mod