Jump to content

WIP: ROFF Exporter Plugin for 3ds Max...


Recommended Posts

@@mrwonko and/or @@eezstreet and/or @@Xycaleth -- I've quickly taken a look at the cg_camera.h and cg_camera.cpp files in the cgame folder to investigate the camera ROFF noteTrack properties therein. 

 

It seems to me that this code and the ROFF callbacks somehow automatically appends the camera ROFF noteTracks to an existing ROFF file... rather than being a noteTrack that a user would create inside 3ds Max (or Blender) like an "effect" or "sound" notetrack.  Am I seeing this correctly?  So I'm asking if Camera ROFF notetracks are automatically handled by the game's code and whatever normal Icarus camera scripting one would do? 

 

Should my 3ds Max ROFF exporter be able to create and export camera notetracks as well???  Or would this conflict with what this game code is doing?

 

Thanks!  :unsure:

Link to comment

@@DT85 -- you asked for a ROFF tutorial so I dug this up from my old computer... Perhaps also check the web link on the Internet Wayback Machine.

 

 

Posted by CodJax:

 

http://www.map-review.com/forums/viewtopic.php?p=23963&sid=7da7ebd0f94bd01d87d300d753cab7d7

 

I'm not sure where to post this, but I thought i'd share what i've learned with y'all:

Roffs:

For this tutorial, you will need the following programs/files:


Radiant,
3dsMAX 4 or 5 only (6+ does not work, may work in GMax),
q3map2,
BehaveED,
Vmdexp.dle: (roff exporter plugin for 3dsmax)


At the moment, this is going to be extremely simple and undetailed as I'm not in front of my development rig. I'll add some screens tonight.

1) First thing - create the basic geometry of your map. I'll assume this is already done.

2) Create the object you want to animate. It is vitally important that you model / import this object into exactly the starting position you want, otherwise, later on, you are going to have problems aligning the animation to your map. Also, DO NOT FORGET TO ADD AN ORIGIN BRUSH. This will be the pivot for the animation.

3) Select the immediate area around the object to be animated, including that object and save it to a different file. DO NOT MOVE BRUSHES/MODELS FROM WHERE THEY ARE PASTED.

4) Save and convert to ASE,

5) Before Opening 3dsmax, make sure the Vmdexp.dle is in your /plugins directory.

6) Taken from [soF2_Animating_Objects.doc], To get your animations to properly play in the game you will need to adjust a few settings for scaling purposes:
i) Customize > Preferences
Under the General tab, set your System Unit Scale to 1 Unit = 8.0 Inches.
ii) Customize > Grid and Snap
Under the Home Grid tab, set your Grid Spacing and Major Lines every Nth to 8.0.
For your animation to play at the proper game speed you will need to set your Frame Rate to 20 FPS (Frames Per Second).
iii) Right click on the Play Animation button.
Under Frame Rate, click on the Custom selection. In the FPS area enter 20, for 20 frames per second.

7) Import your ASE. You will need to zoom into your object you want to animate. The ASE conversion process breaks every brush into individual faces, so will have to find the 6 faces that correspond to your origin brush. Weld these faces together and then group the entire object.

8) Setting up the pivot/origin: Click on the Hierarchy tab. With your object selected click on the Affect Pivot Only button, under Move/Rotate/Scale. You will then be able to move the pivot to where you want - make sure it is in the direct centre of your origin brush/box.

9) Create your animation - I just made a spline and converted into a trajectory path, but the beauty of 3dsmax is that you can do practically anything you want. It is important that you do not make any changes to the object in the very 1st frame of the animation as it will mess up where the object will eventually finish in-game.

10) Once animated, ungroup your object, select your origin and go to file>export selected>whatever.rof

You now have a .rof file!

Getting it into the game.

1) Open radiant to your orginal map.
2) Select the object you want animated and converted it to a func_static and add the key: script_targetname whateveryouwanttocallit
3) Create a target_scriptrunner and add key: usescript path to your scriptfile
4) For the purposes of testing, I add a trigger_always and link to the the scriptrunner. This will loop the animation and allow (for me) more effective debugging.
5) Open behavEd, create a script like this:

Affect (whateveryouwanttocallit)
Play (Play_roff) (whatever.rof)

Compile it and save it (rofftest.ibi for example),
6) Compile the lot and then devmap it in JK and voila!

[references: Raven, Torchy and Lassev]

 

Link to comment

But you can read C++ code... no?

So I'm guessing that I can quickly glance at code and automatically understand how it works without a background in the actual content?

 

I guess you can kinda see why that's a false pretense.

I bet you can model in Blender and Milkshape too, since you know how to use a modelling program.

Link to comment

@@Lancer and @@mrwonko -- a hypothetical question:

 

When you are creating a complex script using multiple ROF files, either in a cinematic cutscene or background events going on in a map, where the brush objects that depend on ROFs may animate at different times-- would it be better if all ROFs in that level have the same starting/end animation frames where they would all start playing at same time (with some objects staying still until you reach their true anim start) ...OR would it be best if each object's ROF started animating immediately and the Icarus script controls the global start time in the map?

Link to comment

*I can help with the mapping*

Update: Making good progress with the ROFF exporter... I've gotten all the class methods finished-- except for the two methods to write the binary and ASCII output files. I hope to have them complete in a couple of days... then we should be ready to beta test.

 

We need to start working on a test map-- I want to create the ROFF's with Max5 as a reference proof case.

Link to comment

What do you need in the test map?

nothing much really... a simple, flat, large terrain... to allow for a fighter fly-by (doesn't matter which kind)... Also make a multiple rocket launcher or surface-to-air missile launcher brush model...  we'll use the ROFF's for the fighter's animated flightpath, as well as to animate launcher system tracking the aircraft and then have a missile launching out of its casing and intercepting the fighter.  Maybe, use the Camera ROFF too for a "bullet-cam" view... I believe the Camera NoteTracks are appended automatically to an existing ROFF file by the game code... based on the camera parameters you script in Icarus... best I can tell.  So it'd be good to verify that hypothesis.

 

Or if you have something else you'd like to do I'm open to suggestions.

Link to comment
  • 3 weeks later...

Update: Things are progressing slowly...

 

I've got a bug somewhere in my "CollectNotes" method that is crashing 3ds Max when I do a "File > Reset" after exporting. The exporter does export the scene however... I've requested the help of an experienced 3ds Max plug-in developer to help me track down my bug. In the meantime I wrote the ASCII text file write function and generated the following output:

 

e4of.png

 

When you export your scene... you save the file as your map name... as shown above. The exporter parses the filename generated by 3ds Max (which includes the path...) and generates a unique file name for each scene origin object following the format: mapName_objectName_origin.txt ( and .ROF).

 

Below is the output for a test animation of "Box01" having 10 notes. I still need to write the binary file method and test things out thoroughly...

C:\TEMP\ROFF\mapName_Box01_origin.txtVersion:	ROFF 2#Frames:	61FrameRate:	20 fps#Notes:		10 1:(0.000000,0.000000,1.595922) 0.083730 0.109728 0.052481 (0 2) 2:(0.000000,0.000000,5.927709) 0.328448 0.428063 0.205155 (-1 0) 3:(0.000000,0.000000,12.311398) 0.725850 0.937639 0.450884 (-1 0) 4:(0.000000,0.000000,20.063017) 1.269073 1.619910 0.782571 (-1 0) 5:(0.000000,0.000000,28.498604) 1.952199 2.455464 1.193189 (-1 0) 6:(0.000000,0.000000,36.934193) 2.769789 3.424317 1.675796 (-1 0) 7:(0.000000,0.000000,44.685810) 3.716466 4.506192 2.223539 (-1 0) 8:(0.000000,0.000000,51.069500) 4.786533 5.680781 2.829622 (-1 0) 9:(0.000000,0.000000,55.401287) 5.973642 6.928005 3.487271 (-1 0)10:(0.000000,0.000000,56.997208) 7.270510 8.228267 4.189673 (2 2)11:(1.403554,2.746897,56.997208) 8.668680 9.562691 4.929905 (-1 0)12:(5.317449,10.202761,56.997208) 10.158334 10.913348 5.700877 (-1 0)13:(11.296528,21.190348,56.997208) 11.728156 12.263464 6.495268 (-1 0)14:(18.895639,34.532417,56.997208) 13.365262 13.597601 7.305506 (-1 0)15:(27.669630,49.051727,56.997208) 15.055175 14.901794 8.123753 (-1 0)16:(37.173344,63.571037,56.997208) 16.781874 16.163662 8.941940 (-1 0)17:(46.961628,76.913101,56.997208) 18.527889 17.372427 9.751831 (-1 0)18:(56.589333,87.900688,56.997208) 20.274467 18.518953 10.545122 (-1 0)19:(65.611298,95.356552,56.997208) 22.001791 19.595652 11.313553 (-1 0)20:(73.582375,98.103447,56.997208) 23.689184 20.596359 12.049044 (4 1)21:(80.877083,98.103447,56.512402) 25.315393 21.516188 12.743824 (-1 0)22:(88.166908,98.103447,55.092754) 26.858854 22.351297 13.390542 (-1 0)23:(95.452194,98.103447,52.790424) 28.297903 23.098656 13.982331 (-1 0)24:(102.733238,98.103447,49.657574) 29.611021 23.755760 14.512857 (-1 0)25:(110.010384,98.103447,45.746353) 30.776976 24.320370 14.976281 (-1 0)26:(117.283936,98.103447,41.108925) 31.774986 24.790205 15.367174 (-1 0)27:(124.554230,98.103447,35.797447) 32.584755 25.162668 15.680385 (-1 0)28:(131.821579,98.103447,29.864077) 33.186539 25.434551 15.910827 (-1 0)29:(139.086304,98.103447,23.360971) 33.561165 25.601742 16.053280 (-1 0)30:(146.348740,98.103447,16.340290) 33.690067 25.658907 16.102114 (5 1)31:(153.609192,98.103447,8.854192) 33.054409 23.639927 15.836958 (-1 0)32:(160.867996,98.103447,0.954832) 31.419922 18.148043 15.253332 (-1 0)33:(168.125458,98.103447,-7.305630) 29.183134 10.032459 14.707353 (-1 0)34:(175.381912,98.103447,-15.875036) 26.606319 0.159816 14.477570 (-1 0)35:(182.637680,98.103447,-24.701229) 23.799784 -10.583641 14.733691 (-1 0)36:(189.893082,98.103447,-33.732048) 20.787304 -21.300461 15.564920 (-1 0)37:(197.148438,98.103447,-42.915340) 17.606306 -31.094751 16.974669 (-1 0)38:(204.404068,98.103447,-52.198944) 14.456336 -39.091282 18.790323 (-1 0)39:(211.660294,98.103447,-61.530704) 11.887320 -44.460537 20.503891 (-1 0)40:(218.917450,98.103447,-70.858467) 10.820423 -46.422642 21.264214 (6 1)41:(226.823303,95.673225,-82.637314) 10.907402 -46.070793 20.999666 (-1 0)42:(235.736572,89.053558,-98.518288) 11.132770 -45.062237 20.262760 (-1 0)43:(245.223938,79.250961,-117.243164) 11.421252 -43.466728 19.156708 (-1 0)44:(254.852142,67.271935,-137.553680) 11.686475 -41.355213 17.792065 (-1 0)45:(264.187866,54.122986,-158.191605) 11.849180 -38.801922 16.269966 (-1 0)46:(272.797791,40.810623,-177.898697) 11.848075 -35.885052 14.672717 (-1 0)47:(280.248688,28.341358,-195.416718) 11.643830 -32.686157 13.061146 (-1 0)48:(286.107208,17.721695,-209.487396) 11.218525 -29.288797 11.476645 (-1 0)49:(289.940063,9.958145,-218.852524) 10.572837 -25.776768 9.945478 (-1 0)50:(291.313965,6.057198,-222.253845) 9.722751 -22.232319 8.483614 (7 1)51:(283.157166,4.563955,-216.030731) 8.696651 -18.734589 7.101078 (-1 0)52:(261.017303,3.335570,-199.139435) 7.533064 -15.358306 5.805439 (-1 0)53:(228.390121,2.346680,-174.246994) 6.278984 -12.172934 4.604373 (-1 0)54:(188.771408,1.571925,-144.020462) 4.988487 -9.242225 3.507367 (-1 0)55:(145.656952,0.985943,-111.126900) 3.721400 -6.624307 2.526675 (-1 0)56:(102.542488,0.563374,-78.233330) 2.541725 -4.372353 1.677689 (-1 0)57:(62.923801,0.278856,-48.006817) 1.515695 -2.535821 0.978802 (-1 0)58:(30.296646,0.107028,-23.114395) 0.709325 -1.162295 0.450918 (-1 0)59:(8.156790,0.022530,-6.223107) 0.185416 -0.299875 0.116743 (-1 0)60:(0.000000,-0.000000,0.000000) 0.000000 0.000000 0.000000 (8 2)Note 0: effecteffects/explosion1.efx 0+0+0 0-0-1Note 1: soundsound ( CHAN_BODY, "sound/efx/explosion1start.mp3")Note 2: effect effects/explosion2.efx 0+0+0 0-0-1Note 3: soundsound ( CHAN_BODY, "sound/efx/explosion1loop.mp3")Note 4: effecteffects/explosion3.efx 0+0+0 0-0-1Note 5: effecteffects/explosion4.efx 0+0+0 0-0-1Note 6: effecteffects/explosion5.efx 0+0+0 0-0-1Note 7: effecteffects/explosion6.efx 0+0+0 0-0-1Note 8: effecteffects/explosion7.efx 0+0+0 0-0-1Note 9: soundsound ( CHAN_BODY, "sound/efx/explosion1end.mp3")
I hope to have things ready to beta test inside the game engine within a few days. ;)
Boothand likes this
Link to comment

Update: The binary write method is now fixed and exporting the notes properly (as best as I can tell)-- but no JA ROFs actually used notes; so we'll have to see how the game engine likes them).

 

Technically, everything is done and the exporter plugin is now ready for beta testing... it outputs a binary .ROF file (used by engine via an Icarus Script) and optionally an ASCII .txt file (for human consumption only). The only remaining aesthetic item I have left to do is create a custom progress bar... to provide info on export process. :winkthumb:

 

So far I've only compiled a version that is compatible with Max 6, 7, or 8. I don't want to spend time compiling other versions until I know everything is working properly in-game.

Any mappers and scripters ready to help test it? :)

 

Interested parties can find downloads for 3ds Max 5, 6, 7, or 8 30-day Trials at modacity.net at this link: http://files.modacity.net/software/3dsmax/ ;)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...