Day 2&3


Started coding on Sunday & Monday! 

I'll be using Godot 4 for this project, so a lot of time of day 2 was spent exploring that.

First goal was to implement a real-time system with save & load functionality: The pet's hunger increases with each X minutes passed even when the game is not open. 

At first I was pretty lost and thought about doing it with Godot timers -> Start a timer for X minutes then increase hunger and start a new timer.  This would work to add hunger during a play session but what if the player closes the game and the timer isn't finished yet? I would have to track the remaining time or save a time stamp of when the last hunger increase happened. Too complicated!

So I decided to check how others implemented similar things and found this nice and simple solution:

Godot timers could be ok to use for random events that happen during a play session though. Like for example making the pet sneeze or change it's idle animation for a while. (Events that have no impact on the stats)

Saving&loading the game was also interesting (and so easy!). I saw a lot of tutorials that used JSON files but they explicitly advice against it here: Link so I didn't... b-but I like JSON.

For now the system works. I've implemented a few other parameters as well:

idk about saving the stats in a Dictionary... I think it's fine for the scope of this project? For now?


Godot 4 Docs used:

https://docs.godotengine.org/en/stable/classes/class_time.html

https://docs.godotengine.org/en/stable/classes/class_fileaccess.html


BTW: It seems like I can't upload new images to itch anymore!! Probably have to look for another place to post the logs... it's not pretty here anyway. Options are Ko-fi and Fanbox because both offer a "store" where I can host the game as a download at the end. Fanbox needs Booth for that tho so it kind of sucks.

Leave a comment

Log in with itch.io to leave a comment.