Tsukihime 1,489 Posted July 21, 2012 (edited) So after some consideration, I have thought of something that might be remotely interesting to create using my Event Wrapper script. EDIT: forget game camera, I'm just going for replays since it's easier lol It is functionality that allows you to create game replays. Sort of. Currently I'm only thinking of on-map stuff, not things like battles. Won't automatically support things like ABS. So the script is basically a "route recorder": every character keeps an instance of a "recorded_route" MoveRoute object. You can then take that move route and plug it into another event and have it follow the same steps that the original event had moved. In the case of a replay cut-scene, you might use a script call to setup the cut-scene, and then transfer the player to that scene to watch the "video". Here is a demo of the route capture idea (honestly I only spent a couple minutes so it's nothing fancy): http://db.tt/FnVP88Nh But now I'm not sure how to proceed. Any ideas? Edited July 21, 2012 by Tsukihime Share this post Link to post Share on other sites
Cidiomar 39 Posted July 21, 2012 You can grab a "shadow" of everything in $game_* and of the scene, record all Input actions and try to put everytinhg in action together. Share this post Link to post Share on other sites
Tsukihime 1,489 Posted July 22, 2012 (edited) I think the hard part would be recording the inputs. As well as stuff generated at run-time. But sure I can just go into the methods that check for player input and then add some extra "recording" lines and create some custom "command" objects. I'll probably need to write an interpreter with a set of syntax for handling things like scene calls, confirmations, and other things to simulate keystrokes at certain times. Oh and I will also need to record the frame count that they occur... Replay system seems pretty long! LOL I should aim for something that takes less time otherwise I might just get bored halfway. I'll just start with providing a good way of recording movement. Edited July 22, 2012 by Tsukihime Share this post Link to post Share on other sites
Cidiomar 39 Posted July 22, 2012 (edited) **UPDATED module Input #---------- GetKeyboardState = Win32API.new('user32.dll', 'GetKeyboardState', 'I', 'c') SetKeyboardState = Win32API.new('user32.dll', 'SetKeyboardState', 'I', 'c') #---------- @input_queue = [] @recording = false @playing = false #---------- class << self #---------- def start_input_record @input_queue.clear#@input_queue.each {|q| DL.free(q.to_i)} # > Not sure with DL free the allocated memory with the object @recording = true @playing = false end #---------- def stop_input_record @recording = false @playing = false end #---------- def play_recorded_input @recording = false @playing = true end #---------- def stop_playing @playing = false end #---------- def next_input unless (ptr = @input_queue.delete_at(0)) stop_playing return end # DL.free(ptr.to_i) # I know SetKeyboardState.call ptr end #---------- alias :play_input_or_not :update def update if @recording ptr = DL::CPtr.malloc(256) GetKeyboardState.call(ptr.to_i) # 0.upto(5) {|u| ptr = 0} # Exclude Mouse @input_queue << ptr end #----- next_input if @playing #----- play_input_or_not end #---------- end end Edited July 22, 2012 by Cidiomar Share this post Link to post Share on other sites
Tsukihime 1,489 Posted July 22, 2012 (edited) Pretty cool. Can I also send keystrokes through script calls? I'm not sure how it determines which key is sent in order to write some wrapper methods. One thing: @input_queue = [] at the top doesn't run for so it complains that it's nil. Not sure why though. Edited July 22, 2012 by Tsukihime Share this post Link to post Share on other sites
Cidiomar 39 Posted July 22, 2012 Tested, everything working now. Script updated in the post Share this post Link to post Share on other sites
Tsukihime 1,489 Posted July 22, 2012 How do I modify the script so that it adds a keystroke when I press a certain button? That way it's not adding a new element to the array every frame when I don't really need it. Share this post Link to post Share on other sites