So, I have a 3d platformer. And I want to have a button that, if you hold it, makes you "go back in time." Fortunately, the game is quite simple and has only one essence, so the only thing that needs to be saved for each frame is this.
struct Coord { float x; float y; float z; } structure Bool6 { bool front; bool back; bool left; bool right; bool top; bool bottom; } struct Player { Coord Pos; Coord Vel; Bool6 Col; }
But I'm afraid that this is a lot of data, especially because my game theoretically goes somewhere around 60 frames per second, and it would be nice to have 5 seconds or so (300 frames) of data that could be obtained by reverse viewing . I reviewed every frame doing something like this
Player Data[300]; for (int i = 299; i > 0; i--) { Data[i] = Data[(i-1)]; } Data[0] = "THIS FRAMES DATA";
However, it seems that this means that an outrageous amount of processing power occurs only when each frame is saved.
Is it a more efficient way to store this data, keeping all the data in order?
Also their way I can tell the array slot is that it has nothing? So what their problems arent if the player tries to rollback before all the slots of the array are full or after rollback? I believe in C #, I would set it to NULL ... but this does not work in C ++, probably because im uses structures.
Thanks a lot!
source share