[Game]Celeste classic

release
game
platformer

#21

what’s could be the problem with controls?

originally i made this game for nodemcu and 128x128 tft

and it run perfect on 80 MHz, i got over 30 Fps and i can over-clock it to 160 MHz to get over 50 Fps


#22

You can expect it to run 80fps on Pokitto

EDIT: nope, it wont, because lots of floats and no FPU


#23

@bl_ackrain , please tell me how the controls are supposed to work


#24

in pico8.cpp there is a btn() function that should return if the buttons pressed repeatedly
i couldn’t find a repeated function (like gamebuino buttons.repeated()) , so used button pressed may be that’s the problem


#25

Would these help?

PokittoButtons.h, line 86

    // GB compatibility functions
	static void begin();
    static void update();
    static bool pressed(uint8_t button);
    static bool released(uint8_t button);
    static bool held(uint8_t button, uint8_t time);
    static bool repeat(uint8_t button, uint8_t period);
    static uint8_t timeHeld(uint8_t button);
    static uint8_t pins[NUM_BTN];
    static uint8_t states[NUM_BTN];
    static uint8_t heldStates[NUM_BTN]; // additional, not GB based

Edit: I mean, what kind of function return are you looking for? That returns constantly true when button is pressed or does it have to alternate between 0 and 1?


#26

@bl_ackrain, I checked. What you are looking for is buttons.repeat()


#27

yes, i have update it to use buttons.repeat() could please try it.

Celeste.bin (60.9 KB)


#28

Same behaviour as before.
Is there any reason you don’t try the emulator?


#29

I concur. Celeste jumps and runs to the right, ends up in the pit


#30

i will check it up


#31

Could you post source here again?


#32

Celeste.rar (29.5 KB)


#33

There is something very weird about the code. If I put “return 0” into pico8.cpp line, it still jumps to the right

bool btn (uint8_t i, uint8_t p)
{
    pb.buttons.pollButtons();
    #ifdef POKITTO
    	#define REPRATE 5
        switch(i)
        {
        case 0:
            return 0;//pb.buttons.repeat(BTN_LEFT,REPRATE);
         case 1:
            return 0;//pb.buttons.repeat(BTN_RIGHT,REPRATE);
        case 2:
            return pb.buttons.repeat(BTN_UP,REPRATE);
        case 3:
            return pb.buttons.repeat(BTN_DOWN,REPRATE);
        case 4:
            return pb.buttons.repeat(BTN_A,REPRATE);
        case 5:
            return pb.buttons.repeat(BTN_B,REPRATE);
        case 6:
            return pb.buttons.repeat(BTN_C,REPRATE);

#34

@bl_ackrain

found it

in

platform_pokitto.h

macro POKITTO remains undefined

… therefore buttons are not read with the methods specified in pico8.cpp

#ifdef POK_SIM
    #define POKITTO
#endif // POKITTO


#include "Pokitto.h"

extern  Pokitto::Core pb;

 #define  BLACK         0
 #define  DARK_BLUE     1
 #define  DARK_PURPLE   2
 #define  DARK_GREEN    3

 #define  BROWN         4
 #define  DARK_GRAY     5
 #define  LIGHT_GRAY    6
 #define  WHITE         7

 #define  RED           8
 #define  ORANGE        9
 #define  YELLOW        10
 #define  GREEN         11

 #define  BLUE          12
 #define  INDIGO        13
 #define  PINK          14
 #define  PEACH         15

#35

y

you are right i was thinking that POKITTO macro is defined in pokitiolib


#36

1

Celeste.LPC11U68.bin (62.3 KB)

Can be made to run faster (alot) by compiling in EmBitz with optimizations on


#37

@bl_ackrain , I will need to come back to this, getting late.

We will have this running perfectly tomorrow.


#38

Unoptimized (online compiler does not do -O3 and @FManga’s highly optimized inline asm ) version, working buttons:

Celeste.LPC11U68.bin (62.3 KB)

changes:

  1. “POKITTO” is defined in platform_pokitto.h

  2. Code in Pico8.cpp is now:

/*--------------------------------------------------------------------------------------------
	Input
--------------------------------------------------------------------------------------------*/
bool btn (uint8_t i, uint8_t p)
{
    //pb.buttons.pollButtons();
    #ifdef POKITTO
    	#define REPRATE 0
        switch(i)
        {
        case 0:
            return pb.buttons.repeat(BTN_LEFT,REPRATE);
         case 1:
            return pb.buttons.repeat(BTN_RIGHT,REPRATE);
        case 2:
            return pb.buttons.repeat(BTN_UP,REPRATE);
        case 3:
            return pb.buttons.repeat(BTN_DOWN,REPRATE);
        case 4:
            return pb.buttons.repeat(BTN_A,REPRATE);
        case 5:
            return pb.buttons.repeat(BTN_B,REPRATE);
        case 6:
            return pb.buttons.repeat(BTN_C,REPRATE);
        }
    #elif defined PICOBOY
        return pb.buttons.repeat(i,0);
    #endif // POKITTO

};

#39

@bl_ackrain

I quickly tried making it run faster in EmBitz with all optimizations on

I get around 25FPS

The problem is that we are updating alot of empty black pixels (22336 pixels), meaning we are drawing 2,36 x the amount of pixels we should

@FManga, we need a lcdRefreshPico routine with the relevant areas of DRAM only :wink:

EDIT: its more than 25… I would say around 30FPS

@bl_ackrain, I hope you do not mind me interfering on your coding project this much

This is the last version before I really truly go to sleep. It is very smooth on the hardware

celeste.bin (77.9 KB)

EDIT: I think there is enough room for optimization to allow sound effects also.

Haha

There was a setFrameRate in the game code

I commented that out

We have 45 fps

More than enough for music and sound effects

Edit: its not quite 45FPS around the level. ~38 maybe ?


#40

This is so exciting! Such energy :slight_smile: D