Timeline for What is "game logic code?"
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 27, 2016 at 21:50 | comment | added | HolyBlackCat | @SeanMiddleditch Now I understand what you mean. Your idea with clocks looks like a nifty solution. And now I think I misunderstood your answer. I thought that you've called a world tick Update() and a world render Draw(). Now I see that you've meant Update() = system tick + several iterations of world tick if needed, and Draw() = world render. | |
| Jan 27, 2016 at 21:12 | comment | added | Sean Middleditch | @HolyBlackCat: Nothing I was getting at would preclude use of 120hz rendering. I absolutely was not recommending a fixed draw rate; that's just amateurish. There should be one global game clock whose delta is measured in terms of render frames that feeds into the accumulation value for the fixed-rate game logic tick. That global clock drives graphics, including interpolation. You can pause graphics by setting the clock scale to 0. You can have hierarchical clocks so e.g. UI still runs and animates while character interpolation stops, too, very very easily. | |
| Jan 27, 2016 at 10:40 | comment | added | HolyBlackCat | @SeanMiddleditch I agree, almost always you can write Draw() in a such way so it always draws same picture when called several times in a row. One should do that if possible. But there are cases when you don't know at what frequency Draw() will be called. For example, if you want full support (actual 120 FPS) for new 120hz monitors and you turn vsync on. What if I want to pause graphics? Then you pass 0 instead of actual delta time to the Draw(). | |
| Jan 27, 2016 at 8:25 | history | edited | Thomas | CC BY-SA 3.0 | Corrected typo |
| Jan 26, 2016 at 23:02 | comment | added | Sean Middleditch | @HolyBlackCat: that's arguable. What if I want to pause graphics? What if the frames of animation affect the game (attack animations corresponding to hitboxes, etc.) ? Visual interpolation still implies that "time" (as in the game's delta time) is passing, but if time is passing and you're not Updateing then what else is getting out of sync? Player inputs being missed, network events not being processed, etc? The game should be driven off of a single clock, with fixed "ticks" for game logic or physics derived from that clock, and derived graphics state also driven by that same clock. | |
| Jan 26, 2016 at 21:57 | comment | added | Josh Grosso | iff meaning if-and-only-if? | |
| Jan 26, 2016 at 16:05 | comment | added | HolyBlackCat | Properly written Draw() may draw different pictures as the time passes. For example, frames of animated sprites may continue to change. Also, objects may continue to visually move forward if rendering code uses a common trick and adds velocity * time since last update / period of update to visible position of objects (while their real position remains unchanged). | |
| Jan 26, 2016 at 12:51 | history | answered | Thomas | CC BY-SA 3.0 |