Flixel Forums

development => iOS => Topic started by: tokyotron on Wed, Jul 11, 2012

Title: "Auto" playing
Post by: tokyotron on Wed, Jul 11, 2012
This turned out to be more complicated (to me) than I first thought it would be.

I'm wanting to implement a scripted "CPU player" playing the game by itself... Kind of like those arcade games in the 80s where the game played by itself and with the "Insert coin to start play!" message on top. Some ideas I had:

* As the character's movement is controlled by FlxG.touches being in different states at different times (FlxG.touches are probably handled in the FlxGame->update function) , I thought about building something that stores and injects these touches. The problem is, I wouldn't be able to get it exact... there would be timing issues. I think. At least a few milliseconds could be off, and that's enough to make this not work as intended - impossible to script and replay something like a "power play".. etc.

* Store every full screen as a complete frame, and playback those frames as a movie. Problem: Not sure yet how to really store frames :-P Shouldn't be impossible though. However several minutes of frames would be huge (think 30 (or 60?) frames/second) for one or several minutes. Not sure this would work with memory issues, loading times, etc even - changing a FlxSprite the whole size of the screen 30/60 times a second... hmm I'm not sure this port was engineered to do that.

Anyone did something like this before? Got any ideas?
Title: Re: "Auto" playing
Post by: Esti on Thu, Jul 12, 2012
You could do this using the replay recording function. Also you can check the code for "Mode" because it has this.

Title: Re: "Auto" playing
Post by: tokyotron on Tue, Jul 24, 2012
Great. If it only were Flixel iOS...