5 ms·
I know this might oversimplify, or perhaps is obvious to many, but when I got into amateur game dev one surprise was realizing that real-time games are just tur
by Waterluvian 4y ago
I know this might oversimplify, or perhaps is obvious to many, but when I got into amateur game dev one surprise was realizing that real-time games are just turn-based games where you don’t control the turns.
- taeric 4y agoSeems a fine way to think about things. Essentially turn based games treat player actions as a clock tick?
- deleted 4y ago[deleted]
- extrememacaroni 4y agoThey're real-time games but over the characters looms an all-powerful controlling entity (like a TurnBasedActionController object) that will only allow one character at a time to think about and execute an action. The others can do fun taunting animations but not much more.
- mikeyjk 4y agoSeems reasonable. Although I would tweak it to say you can't control when each turn ends.
- ytch 4y agoI learned it from games that porting to newer platform with faster FPS. For example, Dark Souls II runs at 30 FPS at release. Then upgrade to 60 FPS after porting to PC, but double the FPS also doubles the weapons break pace.
- jayd16 4y agoFrom seems to be guilty of this even today. Eldenring recently had a dog that did more bite damage at higher fps. I guess they're just ticking damage every frame the dog head and the player collider overlap.
- the_only_law 4y agoI’m currently close to abandoning bannerlord, a medieval combat game where less latency gives you a better chance in MP.
- cinntaile 4y agoIsn't that how it's supposed to be? If you have a good connection, you get the game state earlier than someone with a worse connection.
- Waterluvian 4y agoThere’s an architecture to avoid this by decoupling the simulation tickrate from the renderer. The really simple way is to just pass a delta milliseconds to each system so it can simulate the right amount of time. But yeah, it was wild how DS2 at 60fps fundamentally altered a lot of things like weapon durability and jump distance.
- jstimpfle 4y agoIf you mean the networking architecture, that seems indeed like an oversimplification. AFAIK lockstep synchronization isn't a good networking strategy, and most games netcode will do have some prediction and rollback components.
- taneq 4y agoYou're conflating game logic with engine logic here - whatever hijinks the engine pulls to make things seem seamless (prediction / replay etc.) is (or at least SHOULD be) orthogonal to the game logic. In game logic terms all games are turn based because there are no infinitely fast computers. The turns just happen at your game's tick rate which might be pretty quick.
- DarylZero 4y agoEven with an infinitely fast client computer, the server shouldn't accept infinite ticks from one player before processing ticks from another.
- squeaky-clean 4y agoIf one player is lagging, this would lag every other player. It also allows an easy "freeze the world" hack if the malicious player blocks their network connection for the game.
- jstimpfle 4y agoWhere did I make a distinction between engines and game logic? How can you say I conflated anything? Anyway. I only have unfinished attempts at low-latency netcode and rollback, so can't say I'm speaking from solid experience. But I would doubt that engines implement rollback netcode for you. Essentially the game needs to be structured in a way to accomodate storage of game state as snapshots. And it needs to decide how to incorporate messages that arrive late.
- jayd16 4y ago
- extrememacaroni 4y agofor those unfamiliar, it's because the game's main loop looks like while (!exitRequested) { player.updateState(); someCharacter.updateState(); someOtherCharacter.updateState(); } you could in theory make this kind of updates in parallel but then the entire game becomes a non-deterministic chaos and trying to deal with synchronising threads in a context like this is such a nightmare and I'm sure intractable performance-wise. did anyone even try this, ever? bottom line, real-time or turn-based, a piece of code needs to execute before or after another, not at the same time. the order in which things take their "turn" each frame becomes very important the more complex the game btw, so even the order in which things execute serially cannot be entirely arbitrary. usually for things that depend on other things to update their state in order to accurately update their own state. which is a lot of things in every game. for example, you wanna update the text on the GUI that says how much gold the player has. you'll update the text after everything that could have influenced the gold this frame has updated (i.e. at the end of the frame). player input state (keyboard input e.g.) is updated at the beginning of the frame before you make the player's character do anything based on input. particular stuff can be parallelized or turned into coroutines that "update a little bit each loop" so as to not kill performance. like pathfinding, a character needs to go from point A to point B, he doesn't really need to find the whole path now. a partial path while a separate thread calculates the entire path can do. or just make him think a bit while the pathfinding thread finds a path, the advantage is characters thinking about their actions is also realistic :P
- ratww 4y ago> did anyone even try this, ever? I think it depends on the granularity. Coarse-grained parallelism is already common: some things like AI (like your example), Physics, Resource Management, Shader Compilation, Audio and even Netcode are already commonly run in separate threads. However you won't see the updateInputs(), all the updateState() and sometimes even render() running in parallel for two reasons: first because it's often cheaper and easier/simpler to run in the main thread than dispatching async jobs anyway. Second because each operation often depends on the previous ones, and you can't wait until the next frame to take it into account: you often want instant feedback. However these things can in theory be run in parallel without becoming chaos. ECS is often very parallelizable: you can run multiple Systems in different threads, as long as the output of one System is not a dependency of another running at the same time. You could also process multiple components of a system in multiple threads, but that would negate ECS main advantage: being cache-friendly by virtue of running in a single thread.
- taneq 4y agoI've never thought of it in that specific way before (although obviously when you're writing the game that's how it goes) and that's a great way to explain it. Thanks!
- Tarsul 4y agothat explains how it was possible for the developers of Diablo 1 to turn the game from turn-based to real-time in a single afternoon :) yes, originally it was developed as turn-based and I often wonder if that's one reason why the animations are sooo satisfying. But could be that they simply had great animators.