You must be logged in to post messages.
Please login or register

General and Strategy Discussion
Moderated by John the Late

Hop to:    
Welcome! You are not logged in. Please Login or Register.No replies
Age of Kings Heaven » Forums » General and Strategy Discussion » How does aoe2 record games?
Bottom
Topic Subject:How does aoe2 record games?
local boi
Squire
(id: dragon14)
posted 04-12-19 02:10 AM CT (US)         
Save the state of everything, and save the delta change, which requires a deterministic game. The first takes way too much memory although I imagine it'd be useful for debugging, so I'm thinking about the second:

- mouse movement. Otherwise, locked view playback wouldn't have any scrolling
-- is it all mouse movement that's saved, or just the delta between the last mouse click, or the last screen scrolling? to illustrate the problem, imagine that our game is recorded in a 1024x768 screen. You then play back the game in another computer, using 640x480. There would have to be some scrolling calculations going on. So probably need to save the following information to get scrolling working
1. initial resolution, initial screen position. If the screen resolution changes, save the deltatime (if singleplayer, ignore time spent in menu since the simulation is paused) since the last resolution together with the new resolution. Not a big deal, since this rarely happens. Then, if you're playing back on a screen with bigger resolution, have the client do some easy enough calculations to determine if the player viewport extends outside the watcher viewport; if it does, scroll till it matches. yay. (how it would work the other way around, I do not know. Imagine trying to watch a 1080p game on an old crt monitor)


you might not need to say what unit is selected. You should be able to, from input alone (along with the original game state), create a viewing experience. For example, given a group of 5 men at arms at x:50 y:32, and a double mouse click at the same position, then the game will select them the same way you would normally.

the exception to the recreatable game from just mouse/keyboard input, i think, might be tech research and unit creation from the menus. I could be wrong. but.. hmm, you could simulate the game even from that, if it's storing the location of the clicks on the menu and not just the game. I mean, if you flare or click the minimap, it works, sooo.. yeah. I amend my idea. there is no exception, since the menu size only changes based on resolution, you should already have enough information to figure it out. Although, now that I think about it, isn't there mods to change where the menu stuff actually is? It's been a while since I looked into that, could be wrong. (The alternative I was suggesting to saving mouse or keyboard input, was saving the function names and parameters. But.. the more I think about that, the dumber it seems. (Because names change all the time. with a keypress event or mouse event, it's more reliable, maybe? idk, not a dev)

And anyway, even if the ui was movable, that wouldn't matter if you had like, a wrapper or whatever that tells the game, yes i know normally the ui is here, but in this case its there. otherwise, players with different ui setups (tieing back into the resolution thingy) wouldn't be able to watch the game unless it was played with the same ui. hat would suck.


some events could be safely not saved, because nothing happened
- press hotkey for town center, when you don't have a town center.
- mouse clicked, no function called.
This should be testable. Just set up two games with only 1 player. Let run for 1 minute. Game 1, do nothing. Game 2, click 1000 times. See if file size is affected at all.

what i wonder is how it detects cheats?

For example, I saw on youtube where they're casting an HD game the guy is 100% cheating, spawning in knights and houses and such. I am surprised that makes it into the recorded game. How does it do that? aoe2 is deterministic. sometimes it gets questionable when lag kicks in, like units walking into walls or onto water. but iirc aoe2 even saves those weird bugs. I could be wrong about that one though.

So, back to the cheater. I would assume they are just calling whatever function is called to spawn a unit directly (I guess the psuedo code could be like: here's the position, and the unit to spawn)

right. I'll just assume cheaters find a way. whatever, that was a tangent. More interested in how aoe2 records games that are hours long and only takes a few MB. Also, how it records multiple perspectives, because if i remember correctly there are minute differences depending on whose recorded game you download. I'm not sure if that was voobly only, I might be totally wrong on this anyway. But what's really nice, is you can reopen a recorded game if it goes out of sync


You know what would be embarrassing? If, every time I said I might be wrong, I was wrong. i dont want to be wrong. or if all my speculation was wrong. well, that's why im trying to think. i want to suss out how you implement thing like recorded games and playback of them, and i figured, aoe2 is fun, i like aoe2, i'll think about the problem in aoe2. which is fun.

USA
katsup or mustard

[This message has been edited by local boi (edited 04-12-2019 @ 02:34 AM).]

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames