Quantcast

Jump to content

» «
Photo

.RRR format explanation (Carrec.img)

12 replies to this topic
Seemann
  • Seemann

    Ruhe

  • Members
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2013 "Sanny Builder"

#1

Posted 11 October 2007 - 03:13 PM Edited by Seemann, 04 February 2014 - 07:59 PM.

Main Article: wiki:Carrec

The RRR files (R3 files) are stored in the archive carrec.img. These files contain information about predefined paths used in missions of GTA:SA. When a vehicle is assigned to such a path with opcode 05EB or 085E, it is moving along the path without taking into account game physics and environment (traffic cars). Also it does not damage when collided. Opcode 0706 moves the vehicle to the next point along the path. 06FD sets a multiplier for the vehicle’s speed.

The R3 files structure is very simple. It’s a binary file being just a set of structures, without header. Each structure has a size of 32 bytes. A path point structure described below:

(offsets are decimal)

CODE

 

00  dword    time
04  word     velocity in direction X * 16383.5
06  word     velocity in direction Y * 16383.5
08  word     velocity in direction Z * 16383.5
10  byte     XYZ.right.x * 127.0
11  byte     XYZ.right.y * 127.0
12  byte     XYZ.right.z * 127.0
13  byte     XYZ.top.x * 127.0
14  byte     XYZ.top.y * 127.0
15  byte     XYZ.top.z * 127.0
16  byte     Steering Angle * 20.0
17  byte     Gas Pedal Power * 100.0
18  byte     Break Pedal Power * 100.0
19  byte     Handbrake used flag
20  float    XYZ.pos.x
24  float    XYZ.pos.y
28  float    XYZ.pos.z
32  end

 

(XYZ is the structure that store information about a 3D-object world position (+0x14 offset)).


There’s a way to create new R3 path and use it in the script. I wrote a CLEO script which allows to record a vehicle movement data in-game and write it to a custom RRR file. This file is need to be added to the carrec.img then using any IMG archive editor and it’s ready to be used.

http://sannybuilder.com/dev/carrec.txt (source)
http://cleo.sannybui...ipts/carrec.rar (compiled CLEO script)

To get it work, you need to install CLEO 3 Library, put the carrec.cs to the "game\CLEO" folder, and start the game. Take any vehicle, press Shift+R (you should get a message box) to start recording. Then drive you vehicle along the path you want to create. When you finish, press Shift+R again to stop recording. The new RRR path is stored at the data\paths\carrec900.rrr file (by default; it could be changed in script).

The RRR file editor made by Sanchez:
http://sannybuilder.com/files/R3D.rar

Examples of new RRR paths made with the script are downloadable here:
http://sannybuilder....p/carrec900.rrr
http://sannybuilder....p/carrec998.rrr

Pay attention, that the game can only operate maximum with 475 RRR paths. The original installation has 426 of them, so the number of paths to add safely is 49.

Original source:
http://sannybuilder....opic.php?id=107

Enjoy.


Beep
  • Beep

    Ywa FTW!

  • Members
  • Joined: 22 Oct 2006

#2

Posted 11 October 2007 - 03:47 PM

Good work Seemann! Keep it up icon14.gif !

Midnightz
  • Midnightz

    Populus vult decipi.

  • Members
  • Joined: 05 Feb 2007
  • United-States

#3

Posted 05 November 2007 - 08:05 PM

Wow, that was helpful! Now I understand some of the issues I was having when writing a mod - thank you very much. Worthy of a PIN, IMHO.

I look forward to utilizing CLEO and the recorder function! icon14.gif

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#4

Posted 08 December 2007 - 12:21 PM

Excellent cookie.gif cookie.gif cookie.gif
Thats what we need to let car drives safe on their route

Please correct 2 details in your post
QUOTE
When a vehicle is assigned to such a path with opcode 05BE or

05BE is 05BE: AS_kill_actor @54
you mean 05EB: assign_car 35@ to_path 706
and the your carrec.sc stores the carrec.rrr in in GTASA\data\Paths

I made a exemble script.
press key 11// YES-key, in any state
It teleport the player to SF Airport on motorbike and spawns an actor on motorbike to drive around the airport terminal

click to get the necessary carrec.rrr

CODE
004F: create_thread @Drive_1

CODE
:Drive_1////------------------sannybuilder code
03A4: name_thread 'DRIV'

:DRIV_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @DRIV_11
077E: get_active_interior_to $ACTIVE_INTERIOR
00D6: if and
0038:   $ACTIVE_INTERIOR == 0
00E1:   player 0 pressed_key 11//<<<<<-------------press YES-key in any state
004D: jump_if_false @DRIV_11
016A: fade 0 time 250
0001: wait 250 ms
01B4: set_player $PLAYER_CHAR can_move 0
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at -1338.5 -408.1 14.1
0173: set_actor $PLAYER_ACTOR Z_angle_to 90.8
0001: wait 500 ms
0247: load_model #NRG500
0247: load_model #MAFFA
07C0: load_path 840

:DRIV_128
0001: wait 0 ms
00D6: if and
0248:   model #NRG500 available
0248:   model #MAFFA available
07C1:   path 840 available
004D: jump_if_false @DRIV_128
00A5: 1@ = create_car #NRG500 at -1333.5 -408.1 14.1
0175: set_car 1@ Z_angle_to 280.0
0224: set_car 1@ health_to 2000
00A5: 7@ = create_car #NRG500 at -1354.5 -419.1 14.1
0175: set_car 7@ Z_angle_to 280.0
0224: set_car 7@ health_to 2000
020A: set_car 7@ door_status_to 4
02AC: set_car 7@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
01EC: make_car 7@ very_heavy 1
0129: 9@ = create_actor_pedtype 24 model #MAFFA in_car 7@ driverseat
0223: set_actor 9@ health_to 3000
04E4: unknown_refresh_game_renderer_at -1333.5 -408.1
03CB: set_rendering_origin_at -1333.5 -408.1 14.1
029B: 23@ = init_object #AD_JUMP at -1576.02 -202.34 13.76
0177: set_object 23@ Z_angle_to 270.0
01C7: remove_object_from_mission_cleanup_list 23@
0382: set_object 23@ collision_detection 1
029B: 24@ = init_object #AD_JUMP at -1597.9 -506.5 21.7
0177: set_object 24@ Z_angle_to 270.0
01C7: remove_object_from_mission_cleanup_list 24@
0382: set_object 24@ collision_detection 1
029B: 25@ = init_object #AD_JUMP at -1375.9 -581.5 13.69
0177: set_object 25@ Z_angle_to 270.0
01C7: remove_object_from_mission_cleanup_list 25@
0382: set_object 25@ collision_detection 1
029B: 26@ = init_object #AD_JUMP at -1374.9 -585.5 13.69
0177: set_object 26@ Z_angle_to 270.0
01C7: remove_object_from_mission_cleanup_list 26@
0382: set_object 26@ collision_detection 1
0177: set_object 23@ Z_angle_to 135.0
0177: set_object 24@ Z_angle_to 225.0
0177: set_object 25@ Z_angle_to 280.0
0177: set_object 26@ Z_angle_to 280.0
0249: release_model #NRG500
0249: release_model #MAFFA
0001: wait 250 ms
036A: put_actor $PLAYER_ACTOR in_car 1@
0001: wait 250 ms
016A: fade 1 time 1000
0001: wait 1000 ms
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR can_move 1
085E: assign_car 7@ to_looped_path 840//<<---vehicle repeat the course again and again
//0705: car 7@ assign_to_path 840 and_drive_normal//<<---vehicle stops after one round
06FD: set_car 7@ speed_on_path_to 0.95

:DRIV_601
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @DRIV_601
00D6: if and
8119:   not car 1@ wrecked
8119:   not car 7@ wrecked
8118:   not actor 9@ dead
004D: jump_if_false @DRIV_601
00D6: if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1333.5 -408.1 14.1 radius 650.5 650.5 50.5
004D: jump_if_false @DRIV_702
0002: jump @DRIV_601

:DRIV_702
0873: release_path 840
01C3: remove_references_to_car 1@ // Like turning a car into any random car
01C3: remove_references_to_car 7@ // Like turning a car into any random car
01C2: remove_references_to_actor 9@ // Like turning an actor into a random pedestrian
0108: destroy_object 23@
0108: destroy_object 24@
0108: destroy_object 25@
0108: destroy_object 26@
0002: jump @DRIV_11

scarface1994
  • scarface1994

    Multi Theft Auto supporter

  • Members
  • Joined: 02 Aug 2008

#5

Posted 07 August 2008 - 02:16 PM

QUOTE (Seemann @ Oct 11 2007, 17:13)


The RRR file editor made by Sanchez (updated) :
http://foolroot.nm.ru/R3D.rar


please reestablish the link.
thanks

atfburner
  • atfburner

    under the trapdoor

  • Members
  • Joined: 19 Sep 2006

#6

Posted 07 August 2008 - 11:26 PM

R3D.rar

dtd mods
  • dtd mods

    gta coder

  • BUSTED!
  • Joined: 07 Jul 2008

#7

Posted 12 January 2009 - 01:46 AM Edited by dtd mods, 21 January 2009 - 09:27 PM.

QUOTE (Seemann @ Oct 11 2007, 15:13)
Main Article: wiki:Carrec

The RRR files (R3 files) are stored in the archive carrec.img. These files contain information about predefined paths used in missions of GTA:SA. When a vehicle is assigned to such a path with opcode 05EB or 085E, it is moving along the path without taking into account game physics and environment (traffic cars). Also it does not damage when collided. Opcode 0706 moves the vehicle to the next point along the path. 06FD sets a multiplier for the vehicle’s speed.

The R3 files structure is very simple. It’s a binary file being just a set of structures, without header. Each structure has a size of 32 bytes. A path point structure described below:

(offsets are decimal)
CODE
00  dword    time
04  word     velocity in direction X * 16383.5
06  word     velocity in direction Y * 16383.5
08  word     velocity in direction Z * 16383.5
10  byte     XYZ.right.x * 127.0
11  byte     XYZ.right.y * 127.0
12  byte     XYZ.right.z * 127.0
13  byte     XYZ.top.x * 127.0
14  byte     XYZ.top.y * 127.0
15  byte     XYZ.top.z * 127.0
16  byte     Steering Angle * 20.0
17  byte     Gas Pedal Power * 100.0
18  byte     Break Pedal Power * 100.0
19  byte     Handbrake used flag
20  float    XYZ.pos.x
24  float    XYZ.pos.y
28  float    XYZ.pos.z
32  end


(XYZ is the structure that store information about a 3D-object world position (+0x14 offset)).


There’s a way to create new R3 path and use it in the script. I wrote a CLEO script which allows to record a vehicle movement data in-game and write it to a custom RRR file. This file is need to be added to the carrec.img then using any IMG archive editor and it’s ready to be used.

http://sannybuilder.com/dev/carrec.txt (source)
http://cleo.sannybui...ipts/carrec.rar (compiled CLEO script)

To get it work, you need to install CLEO 3 Library, put the carrec.cs to the "game\CLEO" folder, and start the game. Take any vehicle, press Shift+R (you should get a message box) to start recording. Then drive you vehicle along the path you want to create. When you finish, press Shift+R again to stop recording. The new RRR path is stored at the data\paths\carrec900.rrr file (by default; it could be changed in script).

The RRR file editor made by Sanchez (updated) :
http://foolroot.nm.ru/R3D.rar

Examples of new RRR paths made with the script are downloadable here:
http://sannybuilder....p/carrec900.rrr
http://sannybuilder....p/carrec998.rrr

Pay attention, that the game can only operate maximum with 475 RRR paths. The original installation has 426 of them, so the number of paths to add safely is 49.

Original source:
http://sannybuilder....opic.php?id=107

Enjoy.

With what opcode can i move the vehicle along the path but to have the game physics and environment like the other cars and damage as well.

DvD463
  • DvD463

    Player Hater

  • Members
  • Joined: 02 Dec 2008

#8

Posted 19 February 2009 - 04:16 PM

PLEASE PLEASE PLEASE How can i create my own cleo script??????

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#9

Posted 19 February 2009 - 05:15 PM

QUOTE (DvD463 @ Feb 19 2009, 13:16)
PLEASE PLEASE PLEASE How can i create my own cleo script??????

Read tutorials about SA Coding. Dont ask offtopic questions please.

-ATP-
  • -ATP-

    GTA United Developer

  • Members
  • Joined: 10 Oct 2009
  • Germany

#10

Posted 18 July 2010 - 09:55 PM

Hi,
I found a bug in the R3D tool, I cuts up the number of path point if it has more than 3 character, like here:

user posted image

I tried to expand this column, but it doesn´t work.
Is there any solution?

Joints
  • Joints

    tha muthaphukkin real

  • Members
  • Joined: 11 May 2010

#11

Posted 19 July 2010 - 10:04 PM

nice work. although i dont think i will never need to use this

klm889
  • klm889

    Player Hater

  • Members
  • Joined: 06 Jul 2007

#12

Posted 11 December 2010 - 03:43 PM

Will the car stop at the stops if I stop and stand near the bus stop 10 seconds.

or need to write code "...car stopped at point... radius 10 10 10 ?

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#13

Posted 11 December 2010 - 08:33 PM

QUOTE (klm889 @ Dec 11 2010, 12:43)
Will the car stop at the stops if I stop and stand near the bus stop 10 seconds.

or need to write code "...car stopped at point... radius 10 10 10 ?

The car will do the exact same thing you did. If you stopped it will stop, if you did not it wont.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users