Skip to main content
6 votes
Accepted

How to avoid lots of booleans

Oldschool RPGs with lots of these switch/lock-and-key style steps but a strictly linear progression would often implement this as a "Quest Stage" integer or enumeration. Let's imagine a linear ...
DMGregory's user avatar
  • 136k
4 votes
Accepted

Data Structures for Game State

This is sort of open ended, but I would generally recommend that you have a list of open quests, separate from your other state. When something interesting happens, you generate an event that ...
jasonb's user avatar
  • 56
3 votes

Unity Save System - is there a better way?

Unity does not have a build-in system for saving and loading gamestates, so there is no standard solution for this. Which means that there are as many approaches to gamestate serialization as there ...
Philipp's user avatar
  • 122k
3 votes

How can I synchronize state in my Asteroids game with many networked players?

Is it possible to save the game's current state to disk? If yes (hint, the answer is always yes) then you have a means by which you can synchronize players. Even if it is horribly inefficient. But ...
Draco18s no longer trusts SE's user avatar
2 votes
Accepted

Let both clients know of complete game-state in turn-based game?

This is not safe. As soon as you let client know something, consider the player knows it too. Even if the information is hidden from players view in GUI, it can be more or less easily extracted from ...
Kromster's user avatar
  • 10.7k
2 votes
Accepted

How do I guarantee that important one-time events in my UDP network protocol get received?

One approach I've seen is to include in each packet an ID of the last update you received from this client/server, or a bitmask of which packets you've received in a sliding window. When forming an ...
DMGregory's user avatar
  • 136k
1 vote
Accepted

The state that is synced when a window is broken in a FPS game

I will go over the how state synchronization works, and later will go over your particular cases. But before that, let me tell you that you do not need to implement all that I say here. If you have a ...
Theraot's user avatar
  • 27.5k
1 vote
Accepted

Disable input and score count in pause menu?

The problem is that I don't really understand this kind of pausing code, I'm "used to" the regular boolean one. You can grab your boolean using your GameState: ...
Evorlor's user avatar
  • 5,840
1 vote

Disable input and score count in pause menu?

So because I can't see how your StateMachine is running, I've made up a simple example that hopefully demonstrates what the purpose of the Statemachine is in the first place. In your scenario ...
Pheonix2105's user avatar
1 vote

Networked game with physics and client side prediction and server reconsiliation causes lag

Keep track of unconfirmed inputs (basically an array of the actual state of player's control buttons in each frame) on the client. Upon receiving the game state from the server, put the player back ...
Fanick's user avatar
  • 121
1 vote
Accepted

How to pass data between game states?

StateStack can route 1 parameter to the state's constructor. Notice how states are registered in Application::registerStates. ...
Shadows In Rain's user avatar
1 vote
Accepted

How to deal with race conditions on a game server between network and physics update loops?

One option is to copy the state to a buffer after each simulation step. This operation is typically not that time consuming when compared to performing the step per se. The network thread then ...
Vaillancourt's user avatar
  • 16.4k
1 vote
Accepted

Game states and events

I don't have the luxury to write a full answer, unfortunately, but here it is, at a glance. Note that there seems to be some fundamental architecture differences between what we have and what you have,...
Vaillancourt's user avatar
  • 16.4k
1 vote
Accepted

If online games use permalinks

There are generally two ways to refer through the URL to a specific state The state itself is stored in the URL. The State will be serialized and then encoded to a string of valid URL-Characters. ...
tkausl's user avatar
  • 1,860
1 vote
Accepted

How to protect save game data when saving game over the network?

Use HTTPS Sign and/or encrypt the data with a key included in the app. This won’t stop somebody from modifying the app, but it will stop casual MITM attacks using a proxy server. If you want to get ...
Ed Marty's user avatar
  • 5,249
1 vote
Accepted

Overlaying Menus with a State Machine

One solution to this problem is by executing EACH state on the state machine, or having speicfic states (or transition states) that are defined to execute one before another. A typical implementation ...
Joshua Hedges's user avatar
1 vote
Accepted

Problem with transitioning to previous state(State Stack)

Do you remember these cartoons where the goofy character saw the branch of the tree, but realized too late that he was on the wrong side of the cut? That's what you seem to be doing here. ...
Vaillancourt's user avatar
  • 16.4k
1 vote

Issues with events changing game state

I think the difficulty here is that, because you have bits of non-state code (the objectives system in this case) interfering with normal operation of the state machine, the state machine will get ...
Victor T.'s user avatar
  • 1,381

Only top scored, non community-wiki answers of a minimum length are eligible