Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => Topic started by: Oldtown on March 31, 2013, 11:22:45 am

Title: Missing a really good manual for importing
Post by: Oldtown on March 31, 2013, 11:22:45 am
Hello mates ...

I was just watching the development since release of Anteworld until I decided now to take part in modeling and creating content for Outerra.
Unfortenately I miss a really good manual which starts from the blank. For example what is a must have in a exported collada file from 3ds max. I got it sometimes so far that I see a quite simple model (box and four cylinders) in game but then I really cant go on because of missing knowledge.
Stepping around in the forum a whole day and on youtube really couldn't answer all questions. I got some basic knowledge in scripting and some better in 3D Design but no real idea where to start so a guide would be helpful.
I dont looking vor individual help at all. I just need some basics. But I am a bit scared that I have to collect my knowledge from many different sources ... unfortunately I dont really got that much time.
Title: Re: Missing a really good manual for importing
Post by: Oldtown on April 01, 2013, 01:09:25 am
Ok after a long night with 4 energy drinks, a lot of stupid movies in TV and a big trial and error testing marathon i am through!
I hope i can write down my expierience later so other newbies understand why things have to be like this and what has to be changed ... now i gotta take my ass out to the real world :)
wish you all a nice easter monday.

greetz oldie
Title: Re: Missing a really good manual for importing
Post by: Thunderstorm99 on April 01, 2013, 08:38:39 am
Would really appreciate a tutorial from you! Go ahead writing down your experience if you've got time!
Thanks in advance!
Title: Re: Missing a really good manual for importing
Post by: Oldtown on April 01, 2013, 03:16:01 pm
Ok here we go really simple!!!

I build a small car with a small chassis (length: 370 cm; width: 160 cm; height: 140 cm) and four wheels (radius: 30cm; height: 20cm).
The wheelbase is 240cm. I think this small construction should be no problem for everyone who got some expirience with 3d max.

Every Object in 3d max got a name so we can find them easy in outerra later.

Chassis <- the main red chassis
wheel_FR <- front right wheel
wheel_FL <- front left wheel
wheel_RR <- rear right wheel
wheel_RL <- rear left wheel


(http://img4.fotos-hochladen.net/uploads/dwm20130401tqin4uxkha.jpg)


Now some very important facts which caused much trouble in the beginning of my journey to a small car in outerra.

In 3d max 2013 the front of your car should show North! The pivot axis should be aranged with Z (blue) up, Y (green) to the front and X (red) to the side. The pivot have to be aranged this way for the chassis and each wheel! Otherwise we got later some really funny effects ;)

(http://img4.fotos-hochladen.net/uploads/dwm201304012gwh70vfek.jpg)


Now we use the "select and link" button (http://img4.fotos-hochladen.net/uploads/selectandlinks51kr3jo9h.jpg)

Mark with the left mouse button and ctrl all four wheels and after that hover with the mouse over one of the wheels (does'nt matter which one) and leftclick + drag. Aim for the chassis and release the left mouse button. Now all four wheels are connected to the chassis and will stay with it no matter where it goes ;).

Pls check again if all pivots are aligned correct! Export with the free downloadable OpenCollada Plugin (http://opencollada.org/download.html)

Now open Anteworld :)

Hit F7 and click the "Import ..." button. Navigate to the  Folder where you saved the DAE file. If you see the file in the browser of Anteworld mark it so it is highlighted in blue and press "OK". Now Anteworld is processing. Wait until you see the button "Configure >>" and press it.

The first package object is the "EnviromentAmbientLight". It should stay on "ignore".
Press the dropdown button and select the chassis. Select for this "vehicle".

(http://img4.fotos-hochladen.net/uploads/anteworlddomwczieyb.jpg)

Now we see our objects related to the chassis and the names. Mark the bones like I did and press "Import >>" At this point Antworld is missing some UVs but this isn't important now.

The vehicle should hang around in the air in front of you. Until now we cant do anything with this small "beauty". Press close and feel free to take a small walk around the model. If you're done press again F7 and scroll down in the buildings list. Search for your ingame nick and will find soon our new created object. Mark it and press "Place". Our vehicle spawns right below us on the ground. Hit Escape so we leave the menu.
Go close to the car and hit Return so we enter the vehicle. You now see the vehicle from the cockpit view. Press C so we can watch from outside what will happen now.

Press Alt + E

This opens the Editor.
Instead of taking the full example code from here Vehicle Example Script (http://xtrac.outerraworld.com/trac.fcgi/wiki/vehicle) we just take some important parts of it. Its a minimum so we can move the vehicle around and play with some physics.

Let us start ... first we put into the brakets of function init_chassis() ... 

Quote
function init_chassis()
{
  var wheelparam = {
    radius: 0.7,
<-- edit this to 0.3 (remember our wheel radius of 30cm!)
    width: 0.45,
<-- edit this to 0.2 (this represents the height parameter in 3d max of 20cm!)
    suspension_max: 0.2,
    suspension_min: -0.35,
    suspension_stiffness: 5.0,
    damping_compression: 0.2,
    damping_relaxation: 0.12,
    slip: 0.8,
    roll_influence: 0.1};

}

You can play around with the other parameters later. Now we add our wheels so Anteworld knows which objects are used for that and some wheight for our car

Quote
function init_chassis()
{
    var wheelparam = {
    radius: 0.3,
    width: 0.2,
    suspension_max: 0.2,
    suspension_min: -0.35,
    suspension_stiffness: 5.0,
    damping_compression: 0.2,
    damping_relaxation: 0.12,
    slip: 0.8,
    roll_influence: 0.1
  };
   
    this.add_wheel('wheel_FR',wheelparam);
<-- the name "wheel_FR" is the name you used for your wheel in 3d max
    this.add_wheel('wheel_FL',wheelparam);
    this.add_wheel('wheel_RR',wheelparam);
    this.add_wheel('wheel_RL',wheelparam);

    return {mass:800};
should be in kg so I took 800 which represents a realistic wheight for a small car in real life

}

We are almost done!! I dont added anything under the next two sections ... (I think some call them "Events")

Quote
function init_vehicle(){
}

function engine(start){
}

Now watch out! The next part we add before the next Event.

Quote
const EF = 27000.0; <-- this parameter where too much for our small car. I reduced it to 7000.0
const BF = 28000.0;
<-- this one down too to 8000.0 (again you can play around with this later)
const maxkmh = 100;
<-- this explains itself I think ;) ... feel free
const forceloss = EF / (0.2*maxkmh + 1);
<-- I am not sure but I think this is the road friction

function update_frame(dt, engine, brake, steering)
{
}

Now we copy a lot of code which I dont really understand but we need it so ... why take care? Just copy and paste. Maybe someone can explain this part step by step. Important thing is ... we put this now into the update_frame function.


Quote
function update_frame(dt, engine, brake, steering)
{
  var kmh = this.speed()*3.6;
  var redux = engine>=0 ? 0.2 : 0.6;
  var esign = engine<0 ? -1 : 1;
  engine = EF*Math.abs(engine);
  var force = (esign>0) == (kmh>=0)
        ? engine/(redux*Math.abs(kmh) + 1)
        : engine;
  force -= forceloss;
  force = Math.max(0.0, Math.min(force, engine));
  engine = esign*force;

}

So now we add some really important code! Put it right below ...

Quote
function update_frame(dt, engine, brake, steering)
{
  var kmh = this.speed()*3.6;
  var redux = engine>=0 ? 0.2 : 0.6;
  var esign = engine<0 ? -1 : 1;
  engine = EF*Math.abs(engine);
  var force = (esign>0) == (kmh>=0)
        ? engine/(redux*Math.abs(kmh) + 1)
        : engine;
  force -= forceloss;
  force = Math.max(0.0, Math.min(force, engine));
  engine = esign*force;
  steering *=0.6;
  brake *= BF;
 
  this.steer(-2, steering);
the "-2" says that we use the first to wheels which we declared above in this case "wheel_FR" and "wheel_FL"
  this.wheel_force(-1, engine);
"-1" is a 4x4 :) we could do it only for front or rear wheels too but this is the most easy way now
  this.wheel_brake(-1, brake);
same like the force
  this.animate_wheels();

}

And now ... click "reload". The Car should drop on his wheels and show some bumping. Press Alt + E again to exit the script. Have fun now :)


I hope I dont bring any mistakes in here. If something doesn't work feel free to reply. I know my english isn't the best because it is not my main language but it should be enough for this. It is my first attempt to write something like this down. Remember I was until last night totally new to this all ... would be cool to see your results. I go now to the caterpillar website and get some inspiration.

Btw ... I WANT A TANK CLASS!!! My Jagdtiger (or should I call it Antetiger) is waiting for Outerra.
Title: Re: Missing a really good manual for importing
Post by: cameni on April 01, 2013, 03:44:58 pm
Great tutorial, thanks for contributing :)

Quote
Btw ... I WANT A TANK CLASS!!! My Jagdtiger (or should I call it Antetiger) is waiting for Outerra.
Actually you can simulate the suspension & physics on tank wheels in the script already, track animation support will be coming. But it will still be under the 'vehicle' category; the category determines the underlying physics engine used, which is the same for all tracked & wheeled vehicles.
Title: Re: Missing a really good manual for importing
Post by: Thunderstorm99 on April 01, 2013, 07:09:25 pm
Thanks a lot. i will post some problems i had today working with it but  i got my first working block to drive ;)
Title: Re: Missing a really good manual for importing
Post by: mLichy on April 14, 2013, 06:28:34 pm
Quote
And now ... click "reload". The Car should drop on his wheels and show some bumping. Press Alt + E again to exit the script. Have fun now

So, I got my car working :)  But I don't see this reload button?  Best I can do is reload outerra completely?
Title: Re: Missing a really good manual for importing
Post by: Oldtown on April 15, 2013, 01:33:49 am
(http://img5.fotos-hochladen.net/uploads/jtscript5g30r1flq6.jpg)
Title: Re: Missing a really good manual for importing
Post by: mLichy on April 15, 2013, 09:20:05 am
Unless Save is now Reload?  But I click Save and it does not re-drop the vehicle.

(https://dl.dropboxusercontent.com/u/6895456/outerraLoadBug.jpg)
Title: Re: Missing a really good manual for importing
Post by: Oldtown on April 15, 2013, 09:43:57 am
You should update outerra manualy.

Quote
Attention! Versions 0.7.13.3456 and 0.7.13.3475 have a broken updater and won't automatically update to any newer version. To update from these versions (and from any older version) please download the latest installer from:

  http://www.outerra.com/forum/index.php?topic=637.0 (http://www.outerra.com/forum/index.php?topic=637.0)

you are on Version 0.7.13.3478 and mine is 0.7.13.3624

Is this an Impala you're working on?  :o 8)
Title: Re: Missing a really good manual for importing
Post by: mLichy on April 15, 2013, 09:51:55 am
Ah ok. Ya that would do it. Thanks!
Title: Re: Missing a really good manual for importing
Post by: M7 on April 15, 2013, 02:08:49 pm
Me i was finally able to successfully import a car from sketchup and able to drive. It was quite a trial and error process. First to get the car (a web import) rightly configure in sketchup and then getting the .js file to work.

Again for me the only way to get a working .js config was to copy past the one from Giucam's BMW and edit the wheel's name and the FPS position. But then the car was still tumbling in the air at every reload until i started to play with the "com" command and its "y" coordonate which is for center the gravity i think.

The problem i have now is that Giucam script is quite complex and when i try to play around with the numbers in the script to see what effect each command has on the car, it screw things every time and take me back as if there was no script at all. The only thing i can do then is restart the game, load the car, copy Giucam script, edit the wheels, fps and com. Only then will it work again.
Title: Re: Missing a really good manual for importing
Post by: mLichy on April 15, 2013, 02:52:20 pm
Hm. I used 3ds Max 2012. Was very easy to do.
I was able to get a test car working in about 3 min. Following this tutorial.

The hardest stuff yet, is the script or materials. I'm not sure yet how to setup a good glass shader yet or cubemap for the car paint.

I have glass working but it lights/draws bad at some angles and lighting.
Title: Re: Missing a really good manual for importing
Post by: jeffmorris on April 15, 2013, 09:01:03 pm
The red car is 1957 Chevy Belair. The first Chevy Impala was made in 1958.
Title: Re: Missing a really good manual for importing
Post by: mLichy on April 15, 2013, 11:23:49 pm
He got it right on , 57 belair.

Made it for GTA IV, decided to put in here too.
Title: Re: Missing a really good manual for importing
Post by: ZeosPantera on April 15, 2013, 11:32:12 pm
The hardest stuff yet, is the script

I would love to help code the physics for you. I am a stickler for the physics stuff and the classy cars would be best.
Title: Re: Missing a really good manual for importing
Post by: M7 on April 16, 2013, 12:52:48 am
Was able to import two cars so far from sketchup file and have them drivable. The ferrari turned out bigger than i expected.  I've also been playing with the JS script  while driving, in order to find out what does what. It's quite fun to learn that way. Next i'm taking on a tank.

(http://imageshack.us/a/img203/1441/mustangferrari.jpg)

Title: Re: Missing a really good manual for importing
Post by: mLichy on April 16, 2013, 11:07:39 am
Have you tried setting up cubemaps/gotten a good paint shader yet? 

I'm going to be messing with that over the week when I get time.  I saw some guys do some nice chrome, so paint should be able to look decent I'd imagine. 
Title: Re: Missing a really good manual for importing
Post by: Oldtown on April 16, 2013, 02:44:44 pm
It would be cool if we have soon a real working script for tanks. The one we got until now has some physical problems within the script. So we have to wait until this is fixed. Also I am waiting for Trailer support and moveable Trains with Trackeditor like the Roadeditor. A lot of work to do for our Outerra Team  ;D
Title: Re: Missing a really good manual for importing
Post by: monks on May 08, 2013, 03:44:07 pm
This is really useful. I was going to make a post detailing the steps I took to get my first models in. I've got a few more things to try out yet, but it would be useful if someone posted a walkthrough, about for eg, importing a heirarchical textured model, and stickied the thread or wikid it so peope who have no experience can do it. It's not *that* difficult so far...but I think there's still a barrier to people who've never done this kind of thing before.

monks
Title: Re: Missing a really good manual for importing
Post by: bugsblake on May 24, 2013, 07:48:52 pm
hi all. i followed this tut and got my mustang bullet in outerra but having big problems! like M7 said my car is flipping in the air a lot and even if i get it standing still its on one wheel with the other 3 floating! i saw M7 said he played with the com command to fix it but i cant find it? where is the com command? it looks like my car wants to stand on its side so im sure thats what i need to change to fix it! so where do i find it? thanks

ps. thanks for the tut! :D
Title: Re: Missing a really good manual for importing
Post by: mLichy on May 24, 2013, 08:30:11 pm
Nice looking car.  Seems like either COM (Center of Mass), or suspension is not set to compress enough possibly.

COM should be under init_chassis()

 
Code: [Select]
return {mass:1570, steering:1.0, steering_ecf:10000, centering: 2.0, centering_ecf: 10, com:{y:0.2, z:-0.20}};
Title: Re: Missing a really good manual for importing
Post by: M7 on May 24, 2013, 08:54:46 pm
Also If you dont want to play with the com for future import, in your 3d software (i use sketchup) you need to place the car centered with the default pivot (x,y,z axis)
Title: Re: Missing a really good manual for importing
Post by: bugsblake on May 24, 2013, 09:06:53 pm
thanks so much guys! :) been playing with the com but no luck as yet. will get there in the end! thanks for the tip about the setup in max! i will do that before export next time! :)

EDIT: almost there! stopped the car jumping now! :) was a pain! just working the suspention now! will upload it and post it here in the vehicles thread shortly! though you may want to edit the setting to suit you! being this is my first go! ;) thanks again for the help! got over 100 of theses cars i could put in outerra!  :D
Title: Re: Missing a really good manual for importing
Post by: Atrax on May 29, 2013, 03:44:59 pm
Again me with questions. xD
Wheels on car models I have are not one piece tube like it is on this sample car in this thread. So I was wondering do I have to attach rims and tyres together, or what do I need to do with them? Or just leave them as they are and just set pivot points for tyres and rims seperately?
I know that these questions might sound stupid, but I've never done something like this before and am complete newb at all this. xD
Title: Re: Missing a really good manual for importing
Post by: bugsblake on May 29, 2013, 03:49:44 pm
if the wheel is made up of many bits, just group them! same with the chassis! the pivot point should be center to the wheel as shown in the tut!
Title: Re: Missing a really good manual for importing
Post by: Atrax on May 29, 2013, 04:12:51 pm
Thanks, will try that now. It's much appreciated!