Yet another Rally simulation

Community Forums/Showcase/Yet another Rally simulation

Sweenie(Posted 2005) [#1]
What do you get if you mix BMax, Ogre3D, Newton and a lazy coder called Sweenie?

yet another rally simulation.



http://www.svenberra.net/OgreDemo.zip

--- Controls ---

Arrow-keys to accelerate, reverse and steer.
Space to flip car(hit space several times)
C to toggle skybox
S to toggle shadows
D to toggle drivetype (RWD, FWD & AWD)

The tire-grip is a bit slippy because the friction-handling needs alot of tweaking and the torque on the axles is very large, just for the thrills of course ;)


Damien Sturdy(Posted 2005) [#2]
O.O;;

Sweet :) Can't way to prat around with this :)


big10p(Posted 2005) [#3]
Arg! My PC's at it again - I get "Ogre couldn't be initialized". I'm gonna rename my rig to "AppKiller". :P

1Ghz Athlon, GeForce2 GTS 32MB, win98SE


Mark Judd(Posted 2005) [#4]
Sweenie - more rally than Colin McRae and Richards Burns put together.

Works really nice and smooth here, friction didn't seem too bad (better than TOKAMAK anyhow!).

Only thing is the whole simulation felt like it was running in slowmo. The app reports 60fps but the physics seems to be running through syrup.
(Is this the vsync setting ?)

Nice work as usual though.
I can't wait for "Sweenie Rally - Dice and Easy does it"

cheers

Funky Frank


Geehawk(Posted 2005) [#5]
Slow here too, although I'm only running a 700mhz Athlon PC.
24fps shot up to 70 odd with shadows off. But as Frank says it still felt like slow motion.

FWD, RWD & AWD were definitely different handling wise, but on the whole it felt like the suspension was just too bouncy. Indeed rolling the car whilst cornering seemed a bit easy to do.

Also once in a drift/slide applying opposite lock seemed to have either no effect, or cause snap oversteer.

Nothin that cant be tweaked out I wouldn't have thought.

Great start.


Sweenie(Posted 2005) [#6]
@big10p:
Check the ogre.log file and see if it reports why the app fails.

@Funky Frank:

It shouldn't move in slowmotion even if the framerates are low since I'm locking the physics to a fixed rate(120 updates per second).
If the FPS is below 120, the app will skip some renderingframes which will make the rendering a bit "choppy" at low framerates.
However the dices might decieve your eyes, because the dices are actually 2 meters in size.
Perhaps I should change the texture so that the boxes looks like big crates instead.
The reason that the crates looks like dices is that I was explaining to someone how important scale is in a simulation and that you need some reference to real world objects to get a sense of the scale.
By using the dice texture I did exactly the opposite of what I was trying to preach. :/

@Geehawk
The suspension is indeed a bit too soft.
I will try to tighten it up a bit, but the current spring&dampening system in Newton is a bit sensitive.
A few inches off and the car starts bouncing like crazy.

The methods I use to handle the lateral and longitudinal forces are extremly cheap and therefor the handling of the car is likewise.
For example, I apply a constant torque to the wheels instead of calculating the proper torque involving the engine rpm, transmission, crankshaft and the wheels.
The tire friction must also be derived by involving the tires load, angular velocity and such.

But that will be a later matter since I'm not currently aiming for a lifelike simulation.

The next version of Newton will include a major update of the vehicle-joint(which I'm using) and will simplify the process alot.


big10p(Posted 2005) [#7]
Hmm, methinks I need DX9 to run this, yes?
Error #: 9
Function: DynLib::load
Description: Could not load dynamic library Plugins\RenderSystem_Direct3D9.
System Error: One of the library files needed to run this application cannot be found.

. 
File: \SoftwareDevelopment\C++\OgreSDK\ogrenew\OgreMain\src\OgreDynLib.cpp
Line: 82
Stack unwinding: <<beginning of stack>>



Sweenie(Posted 2005) [#8]
Do you get this error even if you select the OpenGL renderer?


big10p(Posted 2005) [#9]
Sorry for the delay, only just seen your reply Sweenie.

Do you get this error even if you select the OpenGL renderer?
How do I do that. I get the error as soon as I run it.


xlsior(Posted 2005) [#10]
I get the launch screen, where I can pick the renderer: OpenGL works fine, but when I pick DirectX and try to start, I see it switch to an 800x600 screen, and then immediately reboots my computer without error...

(Windows XP, DirectX 9.0c (4.090.0000.0904)

I haven't had any other DirectX games do this to me before...


Sweenie(Posted 2005) [#11]
@big10p:
Hmm...
Try disabling the DirectX plugin.
You should find a file called plugins.cfg, edit it so that the DirectXspecific line has a # before it.

@xlsior:
Weird, Ogre must be doing something that your gfxcard really doesn't like... Does the log say anything?


big10p(Posted 2005) [#12]
Try disabling the DirectX plugin.

Yep, that works - except when I press ESC to quit, my system hangs completely (ctrl+alt+del doesn't work) and I have to reboot.

Nice demo - the physics are great apart from the car felt really top-heavy and prone to rolling over. Did feel kinda like I was in slowmo, as others have said, too. Nice work, though. :)


Geehawk(Posted 2005) [#13]
Just for info I was running in DirectX last time, tried again in OpenGL just to see. 11fps and 23 with everything off.


ckob(Posted 2005) [#14]
just out of curiosity are you wrapping ogre3d for Blitzmax?


Vectrex(Posted 2005) [#15]
yeah a wrap for ogre would be NICE :) Even just the basic funtionallity since alot of cool stuff is native ogre scripts anyway.


Sweenie(Posted 2005) [#16]
Yes I'm wrapping Ogre3D but so far only the parts that I'm using in the car-sim above.

As Vectrex is saying, the scripts controls alot of the visuals so I only had to wrap the part that loads a mesh.
Vertex & Pixelshaders, bumpmaps, normalsmaps, textureanimations and so on are controlled in the materialscripts and thus need no wrapping.


EOF(Posted 2005) [#17]
Works fine for me in both render modes.
The visuals are nice and sharp and the dice physics work well.

The game does feel slow but I've been playing Vordermans much pacier Stunt Car Racer.


Paolo(Posted 2006) [#18]
Sweenie,
this has nothing to do with the topic but since I can not
find your e-mail anywhere, then I'll ask you here,

you will be in my game's credits for the toka-wrapper,
could you confirm me if this is your name

Sven-Bertil Blom (Sweden)

Also, if you want to give me a website link of yours then
I will add it along with your name ...

Thanks :)
Paolo.


Red Ocktober(Posted 2006) [#19]
hey... BIG TIME KUDOS for wrapping OGRE Sweenie...

YOU BE THE MAN!!!

*** added ***

i just tried this out... fan-friggin-tastic!!!!

ok, it worked fine on my XP GeForceFX5200 and with the dx renderer i got about 70 fps with shadows, double that without...

with the OpenGL renderer i got 48 fps with shadows, and about double that with shadows off...

i ran everything in the default 8x6x32 res...

you've gotta give your impressions on OGRE... how was it to interface to... also, are you using the precompiled binary or are you building it from source?

what about OSX stuff... are you planning on playing with that as well?


--Mike


Braincell(Posted 2006) [#20]
Hi

Would you release any examples of how you use Ogre with max?


Duckstab[o](Posted 2006) [#21]
Got to agree been having a look at ogre and it looks excellent.

They demo does speed up and slow down for 1-2 sec when turning shadows on and off but look like thats because of the sudden release and usage of memory


Neuro(Posted 2006) [#22]
wtf...it actually doesnt run on my system.....thats a first...


Sledge(Posted 2006) [#23]
Neat - 60fps+ in D3D mode on my archaic system. OpenGL seems borked, though... 15fps?!


Sweenie(Posted 2006) [#24]
@Eurythmia
That is correct, don't include (Sweden) though, that's just where I live... *grin*
Don't have any website with active content yet, only use it to store files.

@Red & Braincell...

Oh, alot has happened since this post.
I have done alot of work on creating a gameengine on top of Ogre, not for any specific language or game, but just to make Ogre more easier to use.
Working directly against Ogre is possible but it's easy to loose focus when the project grows larger.

I've made it quite wrapper friendly and have wrapped some parts of it over to VB.NET 2.0 (been working on a worldeditor which I'm very proud of)

Now to answer your questions...
At first I was using the precompiled SDKs since I had not much knowledge on how to tackle c++ compiler problems..., after awhile I've successfully compiled the VC 8 source-code and now I've switched over to gcc(mingw) and are using the Dagon version which I fetch via cvs.(had some serious issues with vc 8)...
I am using code::blocks by the way.
I'm loving Ogre more and more by every day.
It's a wonderful renderengine which get's more awesome for every release and combining it with Newton gives you more than enough power to create commersial quality applications.(If gfx & physics was the only requirements for a good game that is)... ;)



I don't have any specific examples, I just did like I used to and that is writing a wrapper dll.

So far I've been busy with my gameengine, but I guess I could make a small testdll for Blitz3D & Bmax, just to give it a litte testspin in another environment.
It's still under heavy developement though.


Braincell(Posted 2006) [#25]
Argh! Vb.net 2.0! Wow, i hope something comes out of it. Do you think you would be able to wrap all of it in that simplified-command mode you mentioned? If i knew c++ well enough i would be willing to help out, but i dont :(


Sweenie(Posted 2006) [#26]
uhm, Vb.Net 2.0 ??!! erhm.. I meant VB.NET 2005 of course, but I guess you understood that. :)

I've been trying to to make the engine as modular as possible.
Every gameobject consists of several components.
For example a FPS-player would likely consist of:
1 Transformcomponent
1 meshcomponent for the visible weapon.
1 rigidbody or 1 intersectionsensor.
1 Controller(probably linked to a script)

The meshcomponent visualises the weapon.
The rigidbody updates the transformcomponent(which holds the gameobjects position, orientation and scale)
If an intersectionsensor is used instead of a rigidbody it could either trigger a scripted action itself or just be available for the Controller script.
The controllerscript will read mouse and keyboard input from the player and handle other logic actions as well.

An automated gunturret could consist of:
1 Transformcomp. (well, every gameobject that's gonna be visible will need a transformcomponent)
1 Mesh for the gunmounting(animated perhaps for extra coolness, like the roofmounted gunturrets in Metroid Prime)
1 "NearObjectsSensor"
1 Mesh for the gun, which will automatically target any nearby gameobjects which would be provided by the sensor above.
1 Controllerscript that handles playing the turret animation, when and if the turret will attack, which nearby object to target and so on.

The controllerscripts are somewhat like a brain that handles the decisions and actions that the gameobjects will perform. Even a flower could have a "brain", but only enough to detect a horribly evil presence and wither.

Basically, the engine doesn't have any clue what a FPS-player is or wether a gunturret is an edible vegetable or not. It just know what it consist of and what to do with the components.

What I strive for is to create some kind of gameobject "plugins", FPSplayer plugin, gunturretplugin, rallycar-plugin, spaceshipplugin and so on.
You get the picture.

Every gameobject will also have a propertybag, that is a set of variables that are required before activating a gameobject.
For example, the meshcomponent require the existence of a stringvariable called "Meshfile" that simply tells what meshfile to use.
A rigidbodycomponent would require a set or variables that defines, hulltype(sphere,convex hull, box, mesh...), bodymass, friction, elasticity and so on.

Using the propertybag to handle immediatestate variables like current velocity, gameobject position and so on might not be a good idea due to overhead when searching the tables for properties, so speed-dependant info would better be provided by functions. Like GameObject_GetPosition or GameObject_GetLinearVelocity.
Now, calling GetLinearVelocity on a painting would put the engine in a troublesome situation, because a painting would probably not have a rigidbody component and thus no velocity.
This is probably best solved by including test at the beginning of the function that first checks if the painting has a rigidbody and issue an exception if it doesn't.
And by the way, if you trying to fetch the velocity of a painting, you have bigger issues to deal with. ;)


DaY(Posted 2006) [#27]
very cool

i get with shadows

380 D3D
170 OpenGL

with out

660 D3D
370 opengl

using the default res


Red Ocktober(Posted 2006) [#28]
sounds great... please keep us updated...

--Mike


Sweenie(Posted 2006) [#29]
Here is a little preview of the engine.
I've included the demo sourcecode so you can see what I meant by using components.
http://www.svenberra.net/enginedemo.zip (avg 6mb) :/



Move camera "FPS-style" and tilt room with up and down keys.(This will make bodies sink into the room a little bit though)


AdrianT(Posted 2006) [#30]
how are you getting along with OGRE? I just got interested in it this past week after finding these rather nice max pipeline plugins.

http://ofusion.inocentric.com/

Would love to play with Ogre in Bmax :) Is there anything out there readily avaliable for playing with ogre in Bmax?


Sweenie(Posted 2006) [#31]
It's going really well.
I'm currently trying out the new features of Ogre 1.2(Dagon) which just got officially released.
They added something called Compositors which makes postscreen effects like Bloom, Heatvision, Black&White, DOF, Motionblur a child's play to use and you can mix them all you want.

I've been trying to "Dewindownize" the engine for the last couple of days, so that it would be possible to port it to Linux and Mac some day. Ogre & Newton already works with both, but my inputhandling was pure DirectX which I now changed to OIS.

Don't expect Linux & Mac support anytime soon though, because I've don't have any experience with either of them.
I've gave Ubuntu a try a couple of weeks ago, but my computer at home don't have a internet connection and thus the progress was halted due to a glorious "missing drivers and a zillion addon packages which I couldn't reach" session which almost made me join a Monestary.

Anyway, the engine is usable in it's current state and I'm thinking about putting together a couple of tutorials.
Mind though that ALOT of features are still missing, such as 2D-graphics and sound.
Multiplayersupport are being worked on and thus not exposed yet.
Currently I'm working on clientside prediction and stuff like that.

So, here is a couple of screenshots and hopefully I could have something for you to play with by the end of the weekend.

Frosty glass
Old TV
Reflection & refraction
Celshading
Oceanshader
Bloomfilter

ps. As a side note... the Oceanshader screenshot was actually taken from a running Blitz3D app.
I've tried making the engine usable from Blitz3D as well.
Though, Blitz3D can't enjoy the callback functionality, but hey, who need callbacks? Right? ;)


Alienforce(Posted 2006) [#32]
Any demo ?


Braincell(Posted 2006) [#33]
Yes i meant VB 2005 (3 weeks ago) :)

Any kind of usability with either blitz3d or vb2005 would be awesome. I'll keep looking out for what you do, maybe you will give us a demo library or something.


Sweenie(Posted 2006) [#34]
I'm about to post a testlibrary right now in the showcase forum, but unfortunately that version won't work with Blitz3D.
The reason is that the dll is compiled with VS C++ 2005 and somehow when exporting the functions using the standard calling convention, newton collisions stops working.
It's nuts, but I guess it's some kind of stack-problem.

I will immediately switch back to codeblocks and gcc so wait just a little bit longer and a Blitz3D compatible version will be available soon.


Alienforce(Posted 2006) [#35]
Woohoo... :)
Kanon!