Make bots replay real alien player movement to practice aim

botelhoruibotelhorui Join Date: 2006-11-02 Member: 58192Members
Hello there,

I don't know much about ns2 mapping/modding, but I am interested in making something that will be usefull to practice aim.

For example, I want to play as skulk, and record my movement in a certain map, using some command like "recordpath", then "stoppathrecord".

One scenario could be a marine player defending nanogrid in ns2_veil and then one skulk comes in walljumping really fast and the marine tries to kill the skulk. After killing the skulk or timeout it would show a message like "Trial complete. Accuracy: 13% "

To make it more interesting would be having many different paths going into nanogrid, that I guess would take some work to create.

Is this possible? Are guides and resource avaiable for this specific case?

Thank you

Comments

  • MephillesMephilles Germany Join Date: 2013-08-07 Member: 186634Members, NS2 Map Tester, NS2 Community Developer
    I personally thought about something similar. I asked myself if the server actually records the status of all ingame entities (for players that would be position and direction they are facing for example) and saves them into some kind of log file. Then give the client the option to download that log file and program some AI to be able to read that log. Then start a local server where you are forced as spectator and import that log file. The server creates bots with the same properties as the players that got recorded in the log and let those bots replay the match exactly like the server recorded.

    If this is possible we have a replay system for ns2^^
  • botelhoruibotelhorui Join Date: 2006-11-02 Member: 58192Members
    You are right, no replay system implies this wouldn't work.

    I wonder if an adhoc mod could make something good enough...

    (1)Can a server mod add a callback to each server tick? Then it would record the position in a different thread. (2) Can you use threads in mods?
    We would need to decide the permanent storage file format. I don't know the specifics of the NS2 packets contents, what do they contain, what does server do with it?

    Something like a text file with each line:
    <player_id><timestamp><list of pressed keys><mouse movement>
    <player_id><timestamp><chat>
    <server><timestamp><chat>

    About replay, I assume that current ns2's bots use some algorightm to go to places, shoot/bite , and build. I think in training mode you only play agaisnt skulks, therefore assuming only that lifeform is supported. But! I was just some minutes ago in the game main screen and in the background of the Cave hive in ns2_mineshaft, and a Lerk gestated from an egg, got in the air and stayed there hovering.

    To replay one would only need to read from the replay list of events:
    Again, can you control bots in mods? like "press w for seconds" ?
    Then at each server tick the mod would read the command from the replay.

    One problem that I don't know enough, is about the stored timestamps. Does it make sense to save absolute time or relative time to the start? Or should the timestamp be the logical clock that counts the server ticks?

    Should there be a clock synchronization between the running computer and the replay? Because the clock drift from the replay may be different from the current computer clock drift. And that would result in for example a bot turning to early and pressing w facing a wall.

    I'm sure replays have been discussed a lot. But maybe devs now have different opinions.

    Thanks
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Is it possible? Yes, but I doubt that would be something easily created. Tracking all player moves and entity states would be reasonably feasible, but that is no where near enough to capture then entire game state. You would struggle with time drift if the sim was not running at exactly the same speed. You would be missing a majority of the effects and countless things which are triggered by netmessages.
  • botelhoruibotelhorui Join Date: 2006-11-02 Member: 58192Members
    I dont need the entire game state, only a lifeform path. Other coop games that have entities moving and flying around can do it, except the pathfinding part, like in an event.
    Why can't we? How do those games define entity paths?

    //lunch brb
  • CalegoCalego Join Date: 2013-01-24 Member: 181848Members, NS2 Map Tester
    Demos exist, they just don't do great job of representing what each person's perspective was, and they break between builds IIRC.

    So somehow the scope of the "demo" would need to be limited and then replayed as AI.
  • MephillesMephilles Germany Join Date: 2013-08-07 Member: 186634Members, NS2 Map Tester, NS2 Community Developer
    demos also break if you don't use the same mods the server you recorded on used. Also I think a problem here is that it will be a big strain for the server since the hitreg command already puts a strain on it which only records engagements afaik
  • botelhoruibotelhorui Join Date: 2006-11-02 Member: 58192Members
    edited January 2016
    Seems like another person tought about the same as I did:
    http://forums.unknownworlds.com/discussion/comment/2265587/#Comment_2265587

    Meanwhile I will try to install a bot mod I saw on workshop, and if it works I will give a look at the code.
Sign In or Register to comment.