2014-08-22 04:55:28

I'm a huge TAS fan.
For those who don't know TAS stands for tool assisted speed run. Many console emulators implement a feature where by you can record a precision timed sequence of input into a file as you play a game, then play it back later. On playback, the idea is that the input should be fed back to the game on exactly the same frame or at the exact same point in time, thus causing the game to behave precisely in the same fassion as it did when the human player initially played it creating a movie of sorts.
I decided to try and implement this in to something I'm creating in BGT, and I obviously didn't realize the mess I'd be getting myself into.
I realize that since a cpu may take more or less time to process instructions from one run to the next, wait() is not precise, audio and other data can take varying durations to load and other factors that this could be a monumental task. My question is, do you think it's realistic at all in BGT? I did get it to a point where I could record and play back gameplay on my own computer, but the implementation is ugly:

*I have to store Boolean results in the recording whenever the game checks if a timer has elapsed more than x milliseconds rather than relying on a real timer during playback;
*I had to store the result of every is sound still playing or is voice still speaking check to avoid breaking the game at points where it waits for sound or TTS,
*It's also necessary to store a bunch of other crap like the name of the TTS voice used and the state of the random number generator, but these items make sense and aren't so bad.
As you can see, it's hacky as all get out and is far more than just an input recorder if it has to spoon feed the game so many return values and such.
It works if you play it back on the computer that recorded it, but if you play it back on another system it's sinomatically wrong (points that wait for either audio or TTS will either cut the sound off prematurely or wait too long due presumably to the cpu processing more or less loop cycles than it did on the original computer). It does play back though and doesn't have the player bumping into walls and doing all sorts of dumb garbage as would happen during playback of a TAS which has failed to play back correctly.
I could convert the game to use frames and only a single timer, but this still breaks whenever there's a need to wait on audio or TTS to complete.
Can anyone think of a less hacky, more productive solution off hand?
Thanks.

Official server host for vgstorm.com and developer of the Manamon 2 netplay server.
PSA: sending unsolicited PMs or emails to people you don't know asking them to buy you stuff is disrespectful. You'll just be ignored, so don't waste your time.

2014-08-22 09:55:07

You are going to need to have some hack, but a little easier hack may be to have checkpoints along the game, so that the replay is sent a pause order while speech goes for, say 5 seconds, then starts back up again. this would still be a little dirty, but a little cleaner than what you are doing.

2014-08-22 12:45:58

I would just plain avoid relying on speech/audio timing entirely. Possibly use frames instead of timers. If it's really important that audio finish playing, avoid having frames pass while this is happening if possible (you couldn't get away with this in anything with graphics, but it should be possible in BGT).
If TTS is involved, record at the slowest voice rate you can stand. If laggish audio is likely to be inaccurate to frame count, delay as long as possible (but I think loading sounds is serial, so I'm not really sure if playback on its own does that much lag-wise?).
And if you haven't already, try to implement something that keeps frames as even as possible. You'd want to keep the framerate no higher than it needs to be (I wouldn't go any higher than 50FPS, but you can probably get away with as low as 20 before anyone notices.).

I wonder if someone shouldn't just implement an FPS clock?
... Ah. Then I went and did it in the post before I remembered you could probably do it better.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2014-08-22 14:29:44

Problems similar to this and the inability to send it through 3D audio are the two main reasons I hate screen reader speech.  Possibly enough for me not to use it where the latter would be very nice to have, and especially if I ever figure out how to buy something more realistic.  nevertheless.
I'm assuming you're not trying to implement the tools.  A big part of TAS in my experience is that you're already running in an emulator, which provides both recording and different tools not in the original game.  I'd argue that once it's in the game it's not TAS anymore; at that point, it's merely the secret hidden cheat menu.  So for the purposes of this discussion, recording only.
And to that end, Virtual Audio Cable, Audacity/whatever, and be done.
Why?  because, without access to the BGT source, it's going to be very difficult to do what you want.  Even with access, it's going to be very difficult.  The reason it's not so hard in sighted land is because they just write the frames of graphics and audio to disk: nothing more is kept.  But you don't have any graphics, no access to the frames of audio, and no way to make sure everyone listens at the same TTS speed.  In emulator land, you just grab the emulated graphics card's output and the emulated sound card's output.  I've not seen any on PC--I'm not sure how it's done there, but it doesn't seem to be nearly as popular as the emulation ones and probably just uses a screen capture program.
I'd go so far as to say that you can't rely on your engine for playback capability, for the simple reason of determinism.  Give up random numbers unless you save the seed, give up floating point numbers altogether, etc.  Offhand, I'm not sure what else in BGT is nondeterministic, and thus unsafe-I'd bet a lot, however.  Nondeterminism is why I dropped major client-side simulation for my MMO project (currently on hold).  I tried two different approaches and it was a mess, simply because the list of not-allowed things was enormous.
In terms of time, you need frames at least.  The architectures you are used to are bad for a lot of reasons anyway, but especially here.  I personally use a callback-based approach with a stack of active screens, such that the topmost gets input and can block ones below it from ticking.  In whatever case, times need to be recorded as frame offsets from game start, not as seconds/whatever.  You also need to be *completely* divorced from the system clock.  This won't work either, because--again--emulators grab the emulated sound card and graphics card.  If the emulator slows down, actual sound playback also slows down with it, but again you can't do that kind of thing without BGT source at least.
And recording on the slowest TTS speed you can stand will just slow you down.  I don't think this is the point, and thus I don't consider it a solution.
Tbh, I'd focus on the tools and record your computer with Virtual Audio Cable and Audacity or similar.  I'd also ask how many people are going to TAS your games-it's kinda pointless if it's only you because you wrote them.  We also don't have the tools, and a big part of this is that you figure them out as part of the speedrun; in SNES-land, this isn't so hard, but with BGT it will be.
I'm curious to see how far you get with it.

My Blog
Twitter: @ajhicks1992

2014-09-06 18:45:10

Whether you choose to get your entire CAD training in person by attending class or to supplement your education through online courses that suit your lifestyle, you'll be on your way to a rewarding career in a field that's shaped Americancarrera de animaciónculture and will continue to greatly influence the ways in which we get from one place to another. Who knows, perhaps you've got the ability to design the next supercar, the most advanced hybrid vehicle ever, or maybe a solar-powered car. Even if your biggest goal is simply to enhance current technology, and not necessarily to invent anything new, auto CAD training from ITT can get you there.,