Advanced NPC system using custom .rec files
#1

Hi,
I just resurrected one of my extreme old and yet unfinished projects: analyzing and understanding the .rec file format for the NPC recordings. The system behind it is mostly quite simple, and I already allocated most things in the on-foot-recordings just by comparing and testing.
I already tried that about 1,5 years ago, but gave it up after some first successes as i lost interest in it.
This time im more serious with it, my next step will be decrypting the record file for vehicles.

Why Im doing this? Well, im wondering why noone did that before, at least not in public. I know that there were plans for this around here, but Ive never seen an actual result yet. Knowing how the .rec files work allows a lot of improvements to the default NPC system. Starting with the ability to create editors for the .rec file, to alter, create, or merge different npc recordings without actually recording a single movement ingame, it also allows live creation of NPC recordings on a server. This means, it would be possible to create a NPC recording using scripting stocks, without walking around manually for the record.
So for example you would build a taxi path part-by-part ingame when someone calls a npc taxi, then it is stored to a .rec file and the taxi driver npcs plays it back. So NPCs would be way more dynamic.
Also functions like NPC_WalkTo would be possible and allow very smooth movements.

However, this isnt perfect of course, as going the way with creating .rec files is quite dirty and inefficient. The NPCs reaction time will be quite high, but still good enough for dynamic driver routes and similar things. Also an accurate acceleration for vehicles is difficult, as it is unique for every vehicle, so acceleration and curves might look ugly.


The final result (if i should decide to create it) would come as a plugin, a pure script version isnt possible as it needs to have access to the recordings folder of course. I would also release all information about the .rec file format, as long as this isnt a problem for the developers.


So far. Before beginning to create the plugin, Id like to ask if this would be useful for anyone. It isnt as good as CNPC was, but completely without memory hacking, and still more dynamic than the default NPC system.
Also, please give me any suggestions you have regarding this, and Ill see if they can be realized.


Update: I wrote down what I know about the format. It can be found here: https://sampwiki.blast.hk/wiki/.rec_file
Reply
#2

Looks interesting! (:
It must be quite hard to decript a .rec file, because we have no info of it :/
Reply
#3

Being able to dynamically script a .rec file really seems promising. You could even give the NPC very smart AI. You should really keep working on this.
Reply
#4

Your idea is pretty amazing. And ofcourse I'm interested in it.

Were you able to understand how the .rec file works?
Does it record stuff like the way default GTA:SA's recording system? (F1 Key.. xD)
If so, it'll be cool, I'll also look into developing somethings and tell you about.
Reply
#5

Impressive work.
Reply
#6

Ok, so far I also understand about 58/68 bytes for the vehicle recordings, and 58/72 bytes of the on foot recordings. Seems as both got some unused bytes for upward/downward compatibility.

The files themselves consist of a header, followed by data blocks. Every block represents the player/vehicle data at a moment (position, velocity, weapon, pressed keys, animations, etc etc). Each block is executed by the NPC at a specified time offset (relative to recording playback start), that is also part of the block.

I guess a wiki page about the rec file format would be the best, Ill write that down before working on a plugin
Reply
#7

Good luck with this, this is very interesting.
I am curios how far this will go!
Reply
#8

Yay for Mauzen !
Reply
#9

Hehe, the basic structure is written down now: https://sampwiki.blast.hk/wiki/.rec_file
Its not 100% complete, but offers all information needed to create custom .rec files with a little bit knowledge of binary files and hexadecimal editing. So developement can start, maybe also someone else would like to use that for anything, interesting to see what follows. Ill also create the plugin as I said, just need to think about a logical and easy script interface and structure
Reply
#10

I would gladly help with this, if you can tell me how to stop the .rec file looking like this:
Код:
      [`        –еµDn@Е аXAš9+?        mO>?d                                _b        –еµDn@Е аXAš9+?        mO>?d                                вc        –еµDn@Е аXAš9+?        mO>?d                               d        –еµDn@Е аXAš9+?        mO>?d                                “e        –еµDn@Е аXAš9+?        mO>?d                               •f      € –еµDn@Е аXAsф$?        ЕC?d                               tg    € € –еµDn@Е аXAsф$?        ЕC?d                               ўg    € € 8еµDf@Е аXAsф$?        ЕC?d ^‚ы»a%*:                      Чg    € € 1дµDO@Е аXAsф$?        ЕC?d ж:‚јЬN3;                       h    € € §вµD-@Е аXAsф$?        ЕC?d œПІјl2v;                      /h    € €  бµD@Е аXAsф$?        ЕC?d мЕјA¤‡;                      ph    € € ЇЮµDХ?Е аXAsф$?        ЕC?d с
Ѕ'!ѕ;                      ™h    € € ЬµDš?Е аXAsф$?        ЕC?d ґђ%ЅЈхг;                      Нh    € € аЧµD>?Е аXAsф$?        ЕC?d Yо'Ѕƒ7з;                      i    € € 9ФµDо>Е аXAsф$?        ЕC?d ј='ЅXDж;                      1i    € € kСµDЇ>Е аXAsф$?        ЕC?d UЅЅa*У;                      fi    € € ŸОµDq>Е аXAsф$?        ЕC?d R§	Ѕw‡Ѕ;                      Џi    € € DМµD=>Е аXAsф$?        ЕC?d дsЅH^¶;                      ѕi    € € жЙµD	>Е аXAsф$?        ЕC?d _СЅсŸ№;                      мi    € € …ЗµDХ=Е аXAsф$?        ЕC?d RЅРC»;                      j    € € EЕµD¤=Е аXAsф$?        ЕC?d Ј.	ЅNбј;                      Dj    € € ёВµDl=Е аXAsф$?        ЕC?d ŒЅк"А;                      yj    € € сїµD/=Е аXAsф$?        ЕC?d –БЅ/tЦ;                      Ёj    € € ўјµDе<Е аXAsф$?        ЕC?d p©,Ѕ»н;                      Сj    € € š№µDў<Е аXAsф$?        ЕC?d 6'ЅМ9ж;                      k    € € ‚¶µD^<Е аXAsф$?        ЕC?d \GЅ¬¦Ж;                      5k    € € ґµD&<Е аXAsф$?        ЕC?d [ŒЅJ#А;                      ik    € € Ќ±µDп;Е аXAsф$?        ЕC?d ;ŒЅ#А;                      Ќk    € € 4ЇµD»;Е аXAsф$?        ЕC?d *к
ЅfeГ;                      »k    € € ¬µDt;Е аXAsф$?        ЕC?d ?х@Ѕ&о
<                      рk    € € `©µD8;Е аXA€s#?        хE?d šЅy{П;                      l  €я€ € ш§µD;Е аXAІ"?        Ж¦E?d ,ЗЅµ(Ю;                      <l  €я€ € э¤µDИ:Е аXAu¦?        –H?d юЛЅQ‡<                      el  €я€ € KўµDt:Е аXA:‘?        cŠJ?d lЅСю%<                      ”l  €я€ € (ŸµD
:Е аXA?        ѕ»K?d 1’$ЅВї0<                      Йl  €я€ € œµDœ9Е аXA;?        FSL?d +%Ѕ%У6<                      юl  €я€ € Ё˜µD!9Е аXA;?        FSL?d 3‘!ЅR-8<                      2m  €я€ € щ•µDЅ8Е аXA–r?        	кL?d UŠЅpђ)<                      mm  €я  € 
“µDO8Е аXA–r?        	кL?d NEЅLя<                      ђm  €я  € ‹‘µDe7Е аXA–r?        	кL?d TЅ‰ј$^=                      Еm  €я  € ‘µD5Е аXA–r?        	кL?d @зп:0‚=                      ъm  €я  € Р‘µD(2Е аXA–r?        	кL?d ]ў$<ИŸ=                      (n  €я  € Й’µDн.Е аXAJL?        R?d №„K<aXž=                      cn  €я  € >”µD‘,Е аXA ?        Н Z?d рGЇ<|=                      Œn  €я  € я•µDk*Е аXA‘|?        §[?d jОН<І0v=                      Зn  €я  € ?˜µDE(Е аXAҐ?        …'\?d Гє<ХС)=                      хn  €я  € šµDў&Е аXAќ ?        дЈ]?d k[Ѕ<Ґ)=                      $o  €я  € з›µD2%Е аXAп>        yab?d єšВ<Ёд=                      Mo  €я  € XќµD^$Е аXADЏЭ>        "Кf?d ЧЩ<?„и<
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)