I think we write our code in different enough ways that we’re not seeing eye to eye.
Tracking the state of the game being paused, when the menu is open and when the game is saved can all be a single match statement on a current “game state” variable which just holds “running/paused/paused and saved/exit” and when it becomes exit, it checks the save time. Only 2 lines of code and adding an enumerated state to the variable to add this functionality. Since the variable is enumerated, it’s really difficult to mess it up when refactoring because if you can’t pass the wrong code or else your game doesn’t save or close
Complexity being added at updating also feels wrong to me. Let me pseudo code some rust (just the language I know best off the top of my head right now) at you, cause it feels like maybe I’m just not understanding something that’s making this seem easier than it is.
<span style="color:#323232;">Enum Game_State
</span><span style="color:#323232;"> Paused
</span><span style="color:#323232;"> Paused_Saved
</span><span style="color:#323232;"> Running
</span><span style="color:#323232;"> Loading
</span><span style="color:#323232;"> Exit
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">///Technically you could make Menu() part of the enum but I'd probably leave it elsewhere
</span><span style="color:#323232;">
</span><span style="color:#323232;">Match Game_State
</span><span style="color:#323232;"> Paused </span><span style="font-weight:bold;color:#a71d5d;">=></span><span style="color:#323232;"> Menu()
</span><span style="color:#323232;"> Paused_Saved </span><span style="font-weight:bold;color:#a71d5d;">=></span><span style="color:#323232;"> Menu()
</span><span style="color:#323232;"> Running </span><span style="font-weight:bold;color:#a71d5d;">=></span><span style="color:#323232;"> Main_Loop()
</span><span style="color:#323232;"> Exit </span><span style="font-weight:bold;color:#a71d5d;">=></span><span style="color:#323232;"> Exit()
</span>
And then your other functions always return a game_state. You’re right that adding that return would be a huge undertaking if it’s not handled in the initial building of the game, but it’s a QoL for the user that’s easily maintainable and is therefore worth doing IMO. But these two things, defining the possible game states and then always routing decisions through that game state, makes this kind of feature relatively doable
My point was “are state machines really that complicated? Isn’t it just something like this pseudo code and a return value from your functions?”
Basically I feel like this is a 2 step process but you seem like you either know more than I do or have a different philosophy about how this would be implemented, so I want to understand what I’m missing
Hey today I wanted to show something amazing from the Stanley Parable-inspired game I’m developing. Might be a long read so bare with me: at the end of my demo The Narrator is annoyed that the player presses The Button (in a game called Do Not Press The Button)! So he demands the player to send a 500 word essay on why they...
Not quite “just works” but I’d be willing to bet that your computer defaulted to the iGPU instead of your dGPU because you didn’t specify as such in your launch options
Today’s game is Red Dead Redemption 2. Me and a friend managed to find time to play Red Dead Online today and while we were delivering a bounty I came across this river and noticed how gorgeous the water looks (I have a thing for water in video games if you saw my Mario Galaxy Post). I quickly hopped over to single player to...
This screenshot made me long for NMM. Spending hours curating mods to create the perfect look and feel, then spending less than half the time playing the game lol
Someone spent 100 days mapping Super Mario's entire planet – and the result is epic (www.creativebloq.com) angielski
Don't forget to make a 2nd save file just in case. angielski
Players Actually Sent Me 500 Word Essays For My Narrative Game (Full Story): (lemmy.world) angielski
Hey today I wanted to show something amazing from the Stanley Parable-inspired game I’m developing. Might be a long read so bare with me: at the end of my demo The Narrator is annoyed that the player presses The Button (in a game called Do Not Press The Button)! So he demands the player to send a 500 word essay on why they...
[Tom Warren] The PS5 Pro still hasn’t sold out in the US or UK. Looks like the $700 price point will mean this console will be readily available this holiday (lemmy.world) angielski
Ubisofts stock tanked this morning ahead of the markets opening angielski
Day 55 of posting a Daily Screenshot from the games I’ve been playing until I forget to post Screenshots (lemmy.world) angielski
Today’s game is Red Dead Redemption 2. Me and a friend managed to find time to play Red Dead Online today and while we were delivering a bounty I came across this river and noticed how gorgeous the water looks (I have a thing for water in video games if you saw my Mario Galaxy Post). I quickly hopped over to single player to...