Game Development Community

Space Sim in the Torque Game Engine - Setting up the Gravity Mod

by Rob Evans · 07/10/2007 (4:14 am) · 23 comments

Well... after some fiddling around, I have been unable to make the gravity mod (link) work with 1.5.2 so I'm going to edit the engine myself.

Instead of fiddle with lots of code internally, I have decided that because we want to keep gravity for everything except ships when we're in space, I'm just going to create a new vehicle from the flying vehicle code called SpaceVehicle. Any vehicle created with the SpaceVehicle datablock will have no gravity. This is cool because we can keep all the gravity stuff for when we're on planets or walking around space stations etc.

I am using the WarSparrow object available for purchase here at GG and I suggest you purchase it to continue. I will NOT include or distribute this part of the code to anyone so you HAVE to buy it if you want to follow what I'm doing here.

However, if you are knowledgeable in the creation of vehicles in TGE, there's no reason you can't make your own first.

Follow the warsparrow install readme, then open warsparrow.cs and replace all instances of the word "Flying" with the word "Space". Now the warsparrow will work with our SpaceVehicle code.

Also, in "example\game.cs" change the code that says:

%player = new Player() {
dataBlock = PlayerBody;
client = %this;
};

to this

%player = new SpaceVehicle() {
datablock = WarSparrow;
client = %this;
};

Now our warsparrow will fly around like a space-ship... sort of. I will need to tweek the space vehicle movement stuff later, but for now it will suffice.

Here's a pic of our new space-ship next to a space-station I added into the level with the world builder to test the gravity stuff.

v2.wastedwebspace.co.uk/gamedev/spacesim_screen8.png
Page«First 1 2 Next»
#21
07/12/2007 (4:55 pm)
I would LOVE to read those tutorials. I am very interested in how you made that space background!!
#22
07/13/2007 (5:40 am)
OK, I'll write a resource on it and drop a link in here in a minute... keep in mind that I'm not a professional artist and wouldn't even say I'm worthy of being called a novice so there may be much better ways of doing / making what I've done :o)
#23
07/13/2007 (6:09 pm)
Here's the link to the resource I've just written to make these sorts of nebula backgrounds...

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=13281
Page«First 1 2 Next»