#STARCRAFT 2 GAME ENGINE CODE#
And when you do figure it out, you'll probably find that it requires completely different code from the function used to home-in on a target. Off the top of my head, I haven't got a clue. In order to play a replay backwards, you would basically have to rewrite the ENTIRE engine all over again.Įven something as simple as a dragoon's projectile homing-in on a target: ask yourself how the heck you would determine its trajectory in reverse, keeping in mind both the dragoon and its target may have been moving while the projectile was travelling. StarCraft 2's engine is programmed so that time elapses in only one direction: forwards. Granted I don't know what StarCraft 2's game engine really looks like, but I can take a pretty good guess. This might sound technical to non-programmers, but being a C++ and Java programmer, this is actually very easy.ĭo you have ANY idea how hard your idea is?
![starcraft 2 game engine starcraft 2 game engine](https://guides.gamepressure.com/starcraftiiwingsofliberty/gfx/word/78009953.jpg)
only a little bit of technical thinking reaches a solution that is easily implemented. this seems to be reasonably good accuracy if you want to enable back-skipping in replays.īut let's look back at the replay-rewind option, and we'll see that it's actually not technically impossible, nor is it technically difficult.īut this can easily - I repeat, EASILY be solved - and the previous thread's assertions that it is difficult is actually null. you will need games under 10 minutes and resoltions over 1680px width to have one snapshot streching over 3 pixels. Snapping more often than 5 seconds will not be noticable in a vast majority of cases. considering that many people will still play 1280x1024, they will end up getting almost exactly 1 snapshot per pixel during a 20 minute game (256pixels covering 240 snapshots). that means that in a 20 minute game, every snapshot only occupies 2 pixels at one of the highest resolutions availible for mass consumers. if you create snapshots every 5th seconds, you end up getting 480 snapshots in 40 minutes or 240 snapshots in 20 minutes. Now most games will be less than 40 minutes or 2400 seconds.
![starcraft 2 game engine starcraft 2 game engine](https://gadgetsin.com/uploads/2011/11/starcraft_2_battlecruiser_time_lapse_video.jpg)
assuming a resolution of 1920x1200, we end up having 480pixels worth of progress bar estate. seeing as 8x speed had troubles producing smooth framerates during war3 and even tft launch on mid-range hardware, i am not seeing this happening.Īssuming the replay controls will have about the same screensize in sc2 as they had in sc and war3 we have 25% of screenwidth (war3 has just 20%) availible for a replay progress bar.
![starcraft 2 game engine starcraft 2 game engine](https://www.researchgate.net/profile/Stefanie-Tellex/publication/221250675/figure/fig2/AS:669572021641228@1536649818610/2-Screenshot-from-Battle-of-Survival-a-game-built-using-the-Stratagus-game-engine-The_Q640.jpg)
I seriously doubt the 44x speed value for sc2. The point is that by taking both save state, and fast forward speed into account you can create a significantly less ram consuming advanced system. Why take a state every second, when it would take 1 second to process 44 seconds of play? If those (made up) numbers are accurate you would at most take a save state every 44 seconds. If for example you know you can fast forward at 44x speed. This process could be further refined to lower ram costs by taking the fast forward function into account. Reversing the gameplay will not be possible. and since my explanation is largely based on this concept. reversing videostreams (other than back-playing I frames or prerendering b and p frames for reverse play) is also not technically possible. like when did i say that reversing the gameplay would be possible. The main problem i see is that it is not invertible by design, game engine only takes few parameters and then does complex uncontrollable loops that only go one way, forward.īesides that the "function" is self recursive (things that happened early on effect how later things happen) so having an engine which will play things in reverse is out of the question without redesigning every aspect of it where every bit of information is stored.
![starcraft 2 game engine starcraft 2 game engine](https://i.pinimg.com/736x/95/ab/8d/95ab8d86c3cfce8ddfd1c660e6ee7b6a--game-engine-starcraft.jpg)
you are trying to invert it (feed time to get gamestate). Look at replay playback as a multidimensional function which has some unique value (gamestate or snapshot if you will) at a given point in time.