Jump to content

» «

Recording "Realistic" driving paths for AI

No replies to this topic
  • PlayPrey

    string ScriptSkillLevel = "Low-Med";

  • Members
  • Joined: 02 Jul 2012
  • Norway


Posted 21 July 2017 - 08:38 AM



I am currently working on a mod where you need to take down vehicles,- and I can't use the built in Task.DriveTo, as they aren't really good drivers and can easily be taken down.


What I have now works, but it is more demanding of the computer, and it doesn't work exactly how I want it to.


How it works they way I made this;


I press G ingame, which enables some flags and a timer, this then adds the following to a list every 25ms:

Vehicles current position, speed & rotation.


When I press G again this is saved to a file, what I now have in that (text) file is many thousand lines of:


case 1:

targetVehicle.Position = new Vector3(0f, 0f, 0f);

targetVehicle.Rotation = new Vector3(0f, 0f, 0f);

targetVehicle.Speed = 0f;

case 2: 


[and so on]


I copy all that code into a class where I have it run that code on some vehicle, on the same interval of the recorder. 


This works and is somewhat smooth, however- since the car "teleports" the wheels re-allign every 25ms, (so they simply shake a lot), the car freaks out if I tried to record a jump, and the engine is always idle.



I have heard some things about .rrr recording/playback, but I haven't been able to learn it.


Any tips? And if this is a lot easier in GTA 5 I guess I could switch to that, I just happen to prefer 4.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users