Graviteam
March 19, 2024, 09:21:56 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Donken's Barn, the easy-learning series.  (Read 9271 times)
0 Members and 1 Guest are viewing this topic.
Kyth
Generalfeldmarschall
*****
Posts: 2044


« on: September 02, 2011, 05:30:22 AM »

Here is a "quick" run-through on preparing the model.

If it's clear enough, good, anyway I'll be posting up screenshots later on, 

Don't worry, you'll get better as you go along Grin


Preparing the Model

1. Import the Barn and the Destroyed Barn models into your favourite 3D modeling program (Blender, in this case)

2. Scale the models to human-size. As a rough rule of thumb, the doorways should be about 2.5 units high, which is recognized as 2.5 metres in the game.

3. I reassembled the broken pieces like a jigsaw puzzle into their proper places, using the intact Barn as a guide. There are 21 of these fragments, which you need to rename to something more descriptive. After that, for convenience, set the Foundation as parent to the other broken pieces (temporarily) so they'll move around as a group.

4. Sync up the centre of gravity for the Barn and the Foundation. Make sure they're positioned at coordinates 0, 0, 0.

 

5. It's helpful if you designate one of the sides as the 'Front'. In this case, it's the side with the small door.

6. Rotate everything so the front faces along the z-axis and the roof faces along the y-axis. This is how it's supposed to appear in the Object Editor... 

7. Wait, the x-axis is pointing the wrong way! Blender uses right-handed 3D coordinates. The game uses left-handed 3D coordinates. If you care about this, mirror everything along the global x-axis. The model will appear the correct way again when it's imported to the game.



8. If everything's nice and satisfactory, now's the time to select everything and apply all the transformations (scaling and rotation).

9. Now, here's an important point in this exercise: please take careful note of the x, y, z coordinates of all 21 of the fragments. It's a good idea to
tabulate them in Excel so you can use them later on.



10. Good work! Now release all the fragments from their parent settings. They're all supposed to be independent pieces again. Position them all at
coordinates 0, 0, 0.

11. Set the Hit-boxes for all the pieces and the intact Barn itself. Don't set them too large and try not to enclose any large empty spaces with your hit boxes. You may need several boxes to cover big objects like the barn and foundation. Smaller fragments can make do with their own individual bounding-boxes.



12. Slanted objects like the roof fragments need to be rotated to lie flat. Take careful note of the angle and axis of rotation. Tabulate these values in Excel, you'll need them later. Apply any transformations (rotations), after that.

 

You'll need to do all this before exporting to .x (directx) format! Good luck, after the 12 easy steps above, you're nearly there! (the exporting bit, I mean) See you later!
« Last Edit: September 05, 2011, 03:30:34 PM by Kyth » Logged

"What am I, chopped liver..?"

"Yes."
Donken
Generalmajor
*
Posts: 460


« Reply #1 on: September 02, 2011, 03:07:08 PM »

Ah, Great Kyth!

ah, even i can learn something, preparing the model a little better maybe Roll Eyes Great start Kyth!
Logged

The real heroes are those that never came back.
Kyth
Generalfeldmarschall
*****
Posts: 2044


« Reply #2 on: September 03, 2011, 12:57:30 AM »

Hi everyone, continuing with the short and simple guide  Smiley

3 Levels of Detail.

1. Separate the Barn and its hitboxes into a separate file.

2. The export settings are 'right-hand mesh'. All other options remain un-checked. I use the name 'saray1' to make things a lot easier later on, when I'm copying the config files. Export the file as "saray1_l1.x" (that's small-case L, One.)



3. Sharp-eyed observers may notice I'm using a slightly earlier version of Blender (2.49). There's a very useful tool here called 'poly-reducer' which trims down the number of polygons in the model, while retaining all the UV-map settings.



4. Set the ratio at 0.5 or 0.6 and click okay to proceed

5. Export the file as "saray1_l2.x" (small-case L, Two). Same settings : Right-hand mesh, all other options unchecked.

6. Do the poly-reducer thing one more time, and export the resulting model as "saray1_l3.x" (small-case L, Three)

7. If everything goes well, you'll have 3 x-files sitting in the same folder.



8. Start the Object Editor, press 'F9' and select 'saray1_l1.x'. You'll get a funny error message and Notepad popping up. Never mind about that! Just click 'Load File' and go back to the same folder, you'll find everything converted to '.go' format, plus one extra file, 'saray1_l.go'. That's the one you want!



9. Open up 'saray1_l.go'. Remember to set the hit boxes to 'hidden'. The Num-pad '+' and '-' will let you view each Level of Detail, L1 is the full-detailed model and L3 is the blocky one with least detail but hopefully still bears a good resemblance.  Grin



10.Save the new file here:



11. Separate the destroyed pieces and their hitboxes into separate files also. I didn't bother with the LODs for the fragments.

12. Do the export of the parts to x-file format, same settings - 'right-hand mesh'. All other options remain un-checked. Open them up in Object Editor, and save them here:



Congratulations, you're nearly there! The next simple step is to configure everything. See you soon!
« Last Edit: September 03, 2011, 12:59:34 AM by Kyth » Logged

"What am I, chopped liver..?"

"Yes."
Kyth
Generalfeldmarschall
*****
Posts: 2044


« Reply #3 on: September 05, 2011, 03:28:50 PM »

Hi everybody, time to get configuring!

As mentioned before, now that all the bits and pieces have been imported, it's time to do the proper book-keeping. It's pretty easy  Smiley

Appetite for Destruction.

1. Get down to the following folder. If you can't find it, you'll have to extract it from the 'main.datapack' file.



Take note of 2 files to edit, builds.engcfg and brokens.engcfg, and create a new file, broken_saray1.engcfg. You may wonder why I keep referring to the barn as 'saray'. Simple reason, it makes it a lot easier to copy the existing config files  Grin

2. Open the builds.engcfg file, make a copy of the 'saray0' block and edit the new block as 'saray1':

Quote
saray1()
{
   //object type
   type    =   %OT_BUILDING%;
   //name of the mesh
   mesh   =   saray1;
   //object name
   name   =   txt_ob_saray1;
   //Lod number of levels
   mesh_lods=   3;
   //weight
   wei    =   -10;
   //material
   material   =   wood;
   //shared mesh
   shared   =   true;
   //group collisions
   flags      =   0x10;
   //resistance (momentum)
   imp      =   20000;
   imp_dem   =   15000;
   //potential for fire
   flame_p   =   0.3;
   //description of destruction
   destr_desc = saray1_d;
   //type of collision
   col_type   =   2;
   //may become dynamic
   dynamic   =   true;
   //armor map
   armor_map = armor_maps\objs\saray0_armor.tga;
   //chunks of collisions
   col_bounds()
   {
      //name, the accuracy of fragmentation, the number of levels of Lod
      s_collision_01,   0, 0, true;
      s_collision_02,   0, 0, true;

   }

}

Rename all references to 'saray0' as 'saray1' except for the armor map, which we're borrowing together with the main texture  Smiley Note that there are 2 collision boxes instead of one, due to the L-shaped built-up area.

3. Open up the 'broken_saray0.engcfg' file and copy it as 'broken_saray1.engcfg'. Open the new file and go through every block, each block is supposed to represent one of your broken fragments (there should be 21 of them). Here's a sample:

Quote
roof01()
{
   //òèï îáúåêòà
   type    =   %OT_OBJECT%;
   //èìÿ ñåòêè
   mesh   =   roof01;
   //êîëè÷åñòâî ëîä óðîâíåé
   mesh_lods=   0;
   //ìàòåðèàë
   material   =   wood;
   //ïðî÷íîñòü (èìïóëüñ)
   imp      =   1000;
   //ìîæåò ñòàíîâèòüñÿ äèíàìè÷åñêèì
   dynamic   =   true;
   //çàøàðåííàÿ ñåòêà
   shared   =   true;
   //íå äîáàâëÿòü â êîëëèçèè
   no_coll   =   false;
   //ìàññà, êã
   mass   =   500;
   //ìîìåíòû èíåðöèè x, y, z
   j      =    2000, 2000, 2000;
   //÷àíê öåíòðà òÿæåñòè
   center_mass   =   d_roof_01;
   //êàðòà áðîíèðîâàíèÿ
   armor_map = armor_maps\objs\saray0_armor.tga;
   //÷àíêè êîëëèçèé
   col_bounds()
   {
      //èìÿ, òî÷íîñòü äðîáëåíèÿ, êîëè÷åñòâî ëîä óðîâíåé
      d_roof_01,   0, 0, false;   
}


Make sure you name and label each block after one of your parts. The 'd_roof_01' mentioned above refers to the main chunk of the 'roof01.go' model. It also doubles up as the collision box for 'roof01'. Not all of the parts get away with just one collision box, for instance the foundation, 'found01':

Quote
   col_bounds()
   {
      //èìÿ, òî÷íîñòü äðîáëåíèÿ, êîëè÷åñòâî ëîä óðîâíåé
      s_collision01,   0, 0, true;
      s_collision02,   0, 0, true;
      s_collision03,   0, 0, true;
      s_collision04,   0, 0, true;
      s_collision05,   0, 0, true;
      s_collision06,   0, 0, true;
   }

'Found01' has 6 collision boxes because of its odd shape, covering just the edges of an L-shaped floor area.

Just to emphasize again, Go through all 21 of your fragments and make sure every one has its block in this file!

3. Okay good work, now Open up 'brokens.engcfg' and add in a new line:

Quote

#include "broken_saray0.engcfg"
#include "broken_saray1.engcfg"
#include "broken_build0.engcfg"
#include "broken_bridge0.engcfg"
#include "broken_well0.engcfg"
#include "broken_misc.engcfg"


4. Remember all the coordinates and rotations for your 21 fragments? I hope you've still got them  Wink You're supposed to compile them neatly as follows:



Here's what I understand about the various columns:

A - the destruction model name (referenced in the builds.engcfg file)
B - link to the object data
C - name of the fragment
D - the dust effect when things come crashing down
E - ? They're all '1'
F - X coordinate
G - Y coordinate
H - Z coordinate
I - X rotation in degrees
J - Y rotation
K - Z rotation
L - ? Only the roof parts seem to be marked as 'true'

Make sure every line ends with a ';'.

Okay, save it all as a .csv file. Next up, head over to this folder:



Open up your .csv file in Notepad. Copy the information and paste it to the 'or_agroups()' block in the common_res.engcfg file, like this:

Quote
saray1_d,obj_cfg\objs.engcfg,cross01,dust_br,1,-1.943,2.025,1.465,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,cross02,dust_br,1,1.968,2.025,-0.002,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,door01,dust_br,1,-1.242,1.037,-0.012,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,door02,dust_br,1,1.114,1.033,2.961,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,roof01,dust_br,1,1.005,2.827,2.366,-43,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof02,dust_br,1,-1.172,2.84,0.52,43,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof03,dust_br,1,1.001,2.84,-0.971,0,0,40,true;
saray1_d,obj_cfg\objs.engcfg,roof04,dust_br,1,2.906,2.818,-0.971,0,0,-40,true;
saray1_d,obj_cfg\objs.engcfg,roof05,dust_br,1,2.818,2.887,0.624,43,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof06,dust_br,1,-2.99,2.827,2.366,-43,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof08,dust_br,1,3.451,2.949,1.468,0,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof09,dust_br,1,1.973,2.676,-3.034,0,0,0,true;
saray1_d,obj_cfg\objs.engcfg,roof10,dust_br,1,-4.004,2.677,1.468,0,0,0,true;
saray1_d,obj_cfg\objs.engcfg,wall01,dust_br,1,-3.991,1.278,1.465,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall02,dust_br,1,-1.84,1.278,-0.094,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall03,dust_br,1,-1.676,1.276,3.028,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall04,dust_br,1,3.53,1.28,-0.122,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall05,dust_br,1,1.976,1.28,-3.034,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall06,dust_br,1,0.41,1.28,-1.627,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,wall07,dust_br,1,2.242,1.28,3.034,0,0,0,false;
saray1_d,obj_cfg\objs.engcfg,found01,dust_br,1,0,0,0,0,0,0,false;

That's all for today! We're done with the configuring. Next time, we'll be looking at getting the barn recognized in the Mission Editor! Bye now!

Logged

"What am I, chopped liver..?"

"Yes."
Kyth
Generalfeldmarschall
*****
Posts: 2044


« Reply #4 on: September 07, 2011, 02:07:55 PM »

Okay everyone! Time to get the new barn in the Mission Editor with just a few simple steps!

Barn Crashing

1. Get to the following folder and open up the 'shared.engcfg' file. This file only appears when you create a new map, so if you don't see it here, extract it from the polygon.datapack.



2. Scroll down the shared.engcfg file to the 'me_objects()' block. There you'll find a listing of objects available to the Mission Editor. Not a particularly long list. Add in your new barn as follows:

Quote

me_objects()
{

   //êîíôèãóðàöèÿ, áëîê, ñïðàéò
   obj_cfg\objs.engcfg, block,    barrage;
   obj_cfg\objs.engcfg, slab,       barrage;
   obj_cfg\objs.engcfg, nadolb0,   barrage;
   obj_cfg\objs.engcfg, nadolb1,   barrage;
   obj_cfg\objs.engcfg, nadolb2,   barrage;
   obj_cfg\objs.engcfg, ez0,      barrage;
   obj_cfg\objs.engcfg, wire0,      barrage;

   obj_cfg\objs.engcfg, build0,   build;
   obj_cfg\objs.engcfg, saray0,   build;
   obj_cfg\objs.engcfg, saray1,   build;
   obj_cfg\objs.engcfg, bridge0,   build;
   obj_cfg\objs.engcfg, fence0,   fence;
   obj_cfg\objs.engcfg, gates_left,   fence;
   obj_cfg\objs.engcfg, gates_right,   fence;

   obj_cfg\objs.engcfg, post0,      post;
   obj_cfg\objs.engcfg, mine_atp,   object;
   obj_cfg\objs.engcfg, mine_at,   object;

   obj_cfg\objs.engcfg, fence1_3m,   fence;
   obj_cfg\objs.engcfg, fpost1,   fence;
   obj_cfg\objs.engcfg, fence2_2_6m,   fence;
   obj_cfg\objs.engcfg, fpost2,   fence;
   obj_cfg\objs.engcfg, fence3_5m,   fence;
   obj_cfg\objs.engcfg, fpost3,   fence;
   obj_cfg\objs.engcfg, fence4_2_5m,   fence;
   obj_cfg\objs.engcfg, fpost4,   fence;

   obj_cfg\objs.engcfg, rupor,      post;
   obj_cfg\objs.engcfg, well,      build;
   obj_cfg\objs.engcfg, footgates,   post;
   obj_cfg\objs.engcfg, skameyka1,   object;
   obj_cfg\objs.engcfg, skameyka2,   object;

   obj_cfg\objs.engcfg, rbox,      object;
   obj_cfg\objs.engcfg, gbox,      object;
   obj_cfg\objs.engcfg, rmines,   object;
   obj_cfg\objs.engcfg, gmines,   object;

   obj_cfg\objs.engcfg, wire1,      barrage;

}


Save and exit! Wasn't that simple? Not quite,  Sad

3. We're advised to re-compile the new 'shared.engcfg' file back into polygon.datapack! There's a risk that our new file will get overwritten, the next time we create a new map.

4. Here's how I did it: create a new 'stencil' folder as shown here, with a copy of the new shared.engcfg file:



Now start up the Archive Editor and open the polygon.datapack (you may want to make a backup copy beforehand, this is a little dicey):



What you now need to do is add in the new shared.engcfg file by selecting the 'stencil' folder. Next you need to delete the old shared.engcfg . Then exit. No prompting to save file or anything, all changes take effect straight away! So don't screw this up.  Smiley Delete the stencil folder when you're finished.

5. One more thing! You'll want to give your new building a proper name. Create a new text file in the texts folder, for example, 'loc_newbuilds.text'. Here's the text entry (the string is referenced in the builds.engcfg file):

Quote
loc_eng()
{
txt_ob_saray1() { Barn 2; }
}


6. Okay, enough fun and games, we want to see the new stuff in the Mission Editor! Open up a suitable map and mission, like so:



Create a suitable contour, click the Landscape tab circled above, select Objects, then choose the Object type from a list:



Save and re-generate the map and check out the results:






7. Save the mission and let the fun begin! Drive safely! Bye everyone!





Logged

"What am I, chopped liver..?"

"Yes."
frinik
Generalfeldmarschall
*****
Posts: 3145


« Reply #5 on: September 07, 2011, 03:03:44 PM »

Thanks Kyth for the educational vid! Much appreciated!Although I must say it seems like a lot of work to get a few barns in the game... Huh?
« Last Edit: September 07, 2011, 04:38:14 PM by frinik » Logged
Kyth
Generalfeldmarschall
*****
Posts: 2044


« Reply #6 on: September 07, 2011, 03:06:50 PM »

Well it's actually faster to do it vs describing it  Smiley
Logged

"What am I, chopped liver..?"

"Yes."
Iceman
Graviteam
Oberstleutnant
******
Posts: 141


*Graviteam* (Assistant Deputy Backup Courier)


« Reply #7 on: September 20, 2011, 07:43:14 PM »

added to editor FAQ  Smiley
Logged

дополнительный Помощник младшего Заместителя вспомогательного Курьера
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Simple Audio Video Embedder
Valid XHTML 1.0! Valid CSS!