construct 2 can't do this ?

0 favourites
  • 12 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • hi,

    i want to make a replay system for an rts game

    game use bullet behavior for all movement

    i can not record every unit x and y and then replay it becuase there is diffrent type of units and they creating in realtime

    so i have to save only user input and then do the exact same things

    i did that but when i replay the game in different framerate or different timescale , the replay changes and its not exact same thing

    so how can i do that ?

  • Hmmmm a bit tricky i guess, but I think I would try to use an array to record all the unit positions and commmands, for the last few seconds. (depending on how long playback do you need) if only a few seconds i think array would be fine, but if you want to record the whole game you probably have to output to a log file or something, then replay the log in some way. I'm pretty sure it can be done.

  • Hmmmm a bit tricky i guess, but I think I would try to use an array to record all the unit positions and commmands, for the last few seconds. (depending on how long playback do you need) if only a few seconds i think array would be fine, but if you want to record the whole game you probably have to output to a log file or something, then replay the log in some way. I'm pretty sure it can be done.

    hi

    i just said it can not be done by recording every tick every position

    there is alot of units (30 unit ) and with diffrent variables like health - type - attack{ower - attackSpeed - ...

    so it can not be done with that.

    the exact game must be replay with just recording inputs

  • You wouldn't record every xy. That's useless information.

    You would record the angle, and when it changed.

    Array as a stack in a container for each object.

    Along with the Timer behavior.

  • you dont neeed to record xy positions every tick. Maybe just once every 5 seconds for the last 30 seconds so you have a starting point for the playback every 5 seconds. From that startingpoint as newt said you only raplay the commands. Mouse clicks, buttons presssed etc etc..

  • Rex has a plugin that can help.

  • Every time you ask your units to do something. Record the action and what time that action happened. If the opponent is AI, u can record the AI commmands also. Something like that I would go about.

  • Every time you ask your units to do something. Record the action and what time that action happened. If the opponent is AI, u can record the AI commmands also. Something like that I would go about.

    i have some actions wich do happens in every sec or less then that like every 0.1 (like shooting)

    by time you mean tick or a custom every x secound time ?

    i want my game do exact same thing and no matter what is timescale or framerate and i want to replay the game in the different speed and still exact same thing happens

  • Sorry, I can't give you a complete solution for your replay feature as it sound very complex, and I don't know how your game is built. Just gave you some ideas how I would try to do it. I'm sure you'll find a way, or Try the plugin that 99Instances2Go mentioned, maybe it can do the things you requested.

  • Replaying input would be hard to get exact. I mean you could save the time with the input used but as you said, a variable framerate would through it off.

    You could change your logic to run a fixed number of times per second so input would only be handled at those times. Then to keep things smooth you'd interpolate object positions between logic steps. The pro is replays will be practically exactly the same, but the con is a huge invasive rewrite of your game. Probably too tedious to do since you also wouldn't be able to use behaviors since we can't control when they update.

    The first idea you said won't work sounds better. It can be made to work with different types as well as with objects getting created and destroyed. The simplest way to save a frame would be to take an empty array and the for each of each object type, push it's name, its position and any other info. When that's do you can store it in another array by using array.asJson of the first array.

    Loading a frame is then just a matter of taking one of those json strings, loading it into an array and looping over it and creating objects based on the saved name. Basically just recreating everything every frame.

    To have it work with varying framerate or a different playback speed you'll need to save the time with the json of the frame, and then interpolate between the two closest frames.

    An example is needed here to fully illustrate it. There are probably a few nuances I'm not thinking of.

  • Oh, but rewriting whole game is (in my opion) just necessary.

    If i may use an image to explain myself. The game is probaly acting as a jpeg compared to a eps.

    In a jpeg, each pixel has coordinates and properties.

    In a eps, each liine/curve/fill has a mathematical description.

    'Recording' a sequence of jpegs leads to the amount of data compared to a video (you can still do that some way, if you own YouTube)

    'Recording a sequence of eps can be done with only tweeking the changes in the mathematical descriptions, that is just recording a few numbers. A circle is a curve that is "radius" away from a central point. Only need to store the changing radius.

    And that last 'option' is the basic goal. I did't try / nor figured out how rexrainbow 's plugin exactly works. But in the glance i took, it seems to couple decissions to a recordable timeline. Only have to playback the 'decissions'.

    Thats a new aproach for me, an i certainly will jump in that pool one day soon.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Try it and see.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)