Devlog #3: Main menu, Game Over and Replay


Decided to do this once every two weeks, because some weeks I have a lot of work and have minimal time to make big progress. Last week was one of those weeks. That aside, in the last two weeks I made some updates to the main menu, and polished the game over menu and stages between "game end" and "game over screen" display.

Main Menu


Instead of a static image, there's a looping animation. For now, I've embedded a video into the scene because that was far easier for me than setting up the 3D scene with the car following a path. I'm not sure that's the best idea depending on the quality of the video and how that might impact the size of the app. However, it works and if necessary I'll optimize the approach later. The animation was done in blender by linking all the different assets into one file and then animating them by proxy. 


Game Over

>


Now if the player hits a rocket or runs out of fuel, the car spins out and, while the rest of the rockets travel through the tube, the game over UI shows up. I was trying to come up with some sort of background for the game over screen, and anything other than trivial grid patterns were going to end up being more work and lower quality (from me). I thought the game was looking good though, so why not just let the where you end up in the game be the background for the UI? I think it works out pretty well. I probably want to fade in the UI to avoid the abrupt entrance you see currently. 

While adding the spinout animation I confirmed something I wasn't 100% sure about before dealing with animations. Currently Godot doesn't deal with multiple animations on a non-skeletal object very well. It's trivial for now because I can add a single bone to the car and have it be the root of the animations, but I think it's still good to know.

Replay

While not phenomenal, the game is fully replayable now. However, I want to call attention to a specific problem with recreating the scene for a new round that I stumbled upon. I've solved it, but I don't know why it really happens.

Godot uses a scene hierarchy system, where each scene is composed of nodes and each scene itself is treated as a node. When the game is being played, everything is happening on a single scene tree (including the game over UI, since the actual 3D game is still in the background). Normally, restarting the game is as simple as:

get_tree().reload_current_scene()

And indeed, that is what I was doing when the player clicks "restart." However, when the next round started the car would travel on some path completely unrelated to the tubs currently being drawn in the new path.  I had some debugging cameras setup, and when I used them along with actually drawing the path being created, I saw what was happening.


It might be unclear from the gif, but I can see that the path (purple line) generated in the first round is being reused in the second round, even though I'm supposedly reloading the scene. The fix I found was to check "Local to Scene" for the curve that is being generated by the Path node. That way the curve is local to the current scene, and re-created when the scene is reloaded. I'm not certain why it wasn't already recreated when the scene is reloaded. My only hunch is that in trying to save memory on resources, some objects generated by Nodes are not cleaned. Their references are simply managed to point to the new scene nodes.


Overall it's a pretty short update, but I'm hoping to get into some effects and sound by the next update. Thanks for stopping by, and if you've been visiting my stream, I appreciate it.

Leave a comment

Log in with itch.io to leave a comment.