Game Development Community

dev|Pro Game Development Curriculum

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 «Previous 1 2
#1
07/10/2007 (4:20 am)
You should maybe start posting this in the Discussion forums, instead of using the Blog area.
#2
07/10/2007 (6:59 am)
Well at least give a explanation :) Rob just can't show or (post) any actually code changes in the public blog, but since he just posting the results of his changes and showing off the progress of his work then whats the problem.

Here is a great site by Jongware that details the inner workings of how elite with a nods to the creator Braben how he pulled off the entire galaxy and all its little details.

Galaxy One
#3
07/10/2007 (7:06 am)
I'm just saying that flooding the the blogs with every change he makes is not "good manners". A sensible thing would be creating threads and linking to them all from one Blog entry discribing what he has completed and what he's working on. Give an overall view.

But anyway... Do you as please, I guess.
#4
07/10/2007 (7:14 am)
I don't want to upset anyone... I just thought the blog system was the most appropriate place for this stuff. Should I just move this over to my own site and link to it from here? What's the general code of conduct on this sort of thing? Is there somewhere that peeps are being flooded with my changes?
#5
07/10/2007 (7:37 am)
There's no code of conduct really. I would think that people that blog want people to see it for day or 2.

These kind of changes should go to the forums in my opinion. Then in your blog you give an overview off all the things you've done and link to them. This way the Blog entries dont get pushed out of view. Or I guess you could move it to your site, but then you wont be able to show any engine changes.

Dont get me wrong. Your work is great, and you have the enthusiasm, which is great to see. I've even learned something from your Polarizing Texture urrhm... supposed to resource ;) And I'll try it tonight.

When you get get stuck I'll even throw you some of my code ;-)

EDIT: Cool screenshot... I really should start playing with Constructor
#6
07/10/2007 (8:13 am)
I don't see anything wrong with this .plan.
#7
07/10/2007 (8:16 am)
@James - Yeah constructor is so easy and quick... by far the most useful tool for TGE! I can't understand how peeps got on without it! Wait till I post the next screenshot... it's gonna have a planet... :o)
#8
07/10/2007 (10:49 am)
I started making a spacesim the same way using the gravity mod and sky sphere resources. I have a space vehicle code (only script side) that works fairly well and changes the keybinds while your flying and has the explosions built in when you shoot them. If you want a copy let me know. This is just what I was doing but I didn't have any graphic artists helping out so it didn't go too far. I did make some basic asteroid objects (not the best looking) also if you want some temporary props... you can make them explode also.
#9
07/10/2007 (11:22 am)
Blogs are supposed to be a form of an online LOG, or personal journal. At least that what they started out as, then as some people thought it would be a good way to share their thoughts with people that were interested in what they write, they made lots of them public accessible. Since then Blogs have become common at almost all sites, there should nothing wrong really with keeping track of your progress here, in your own Blog, does text really take up that much room?
Cheers
#10
07/10/2007 (1:20 pm)
@mb - I would totally be interested in both the space vehicle code and your asteroids! Not only from a technical point of view but also to use in my game! That would be totally awsome! My address is mira_001@yahoo.com. Cheers!
#11
07/10/2007 (5:59 pm)
people are very sensitive with blog postings on this site even though they never are forced to open someone's blog
#12
07/10/2007 (6:09 pm)
I think if you're blogging daily on GG, then perhaps it should be in the forum. I don't know how other people use it, but I guess I expect it to be for a "big" update. For example, my blogs come months apart. So when I look in the "What's new" on the community page, I get a little disappointed when I see it's the same few frequent bloggers' next minor updates. Plus, we all want exposure for our "big news" and if someone floods that little "What's new" box with a bunch of tiny posts, then our exposure time gets minimized.

I'm not meaning to be jerky, I just wanted to relate to James in that I've noticed this trend with a few posters as well.
#13
07/11/2007 (3:06 am)
LOL... I think the comments on this blog post are getting a little off-topic... perhaps someone should open a forum post... oh the irony! :o)

Anyway, I'm gonna be holding back on posts for a while if peeps are going to get upset about it. Just seems a bit silly to me... I didn't even know there was a "What's New" page until it was mentioned and I can't imagine ever using it.
#14
07/11/2007 (3:37 am)
Does anyone know how I can get the sun flare to look better here?

v2.wastedwebspace.co.uk/gamedev/spacesim_screen10.png
Notice how the local flare overlaps in an obvious way?

Maybe I need a different flare graphic? Anyone got any examples they've done?
#15
07/11/2007 (5:42 am)
Hey... try using different textures for Local and Remote bitmaps. Local being for Lensflare and Remote being the "Sun/Star" texture.

I'm also not happy with the results... In fact the fxSunlight sucks and needs a rewrite imho.
Something like found in Eve would be nice... When in LOS it's big... and as it gets out of LOS it gets scaled down.

I guess the fxSunlight is suitable for FPS games (which TGE was designed for).
#16
07/11/2007 (5:48 am)
Yeah, I've been thinking about changing the sunlight code. I've had a quick look and came to the same conclusion but the only way I could think of to make the local texture scale based upon LOS was to use a load of LOS points around the center to determine the scale size. Like this:

v2.wastedwebspace.co.uk/gamedev/spacesim_screen11.png
My only worry is the FPS dropping if checking LOS this many times...
#17
07/11/2007 (5:52 am)
I've reduced the alpha on the local png to 69% and changed the blendmode to 3... the results look better but it's still not as cool as EVE LOL - like I'll ever be able to make eve-like graphics anyway!

v2.wastedwebspace.co.uk/gamedev/spacesim_screen12.png
#18
07/11/2007 (9:09 am)
New nebula background screeny for anyone that's interested.

v2.wastedwebspace.co.uk/gamedev/spacesim_screen13.png
v2.wastedwebspace.co.uk/gamedev/spacesim_screen14.png
If anyone is interested in how to make these sorts of backgrounds in Photoshop, I might make a tutorial.
#19
07/11/2007 (2:41 pm)
I like the nebula look :)
#20
07/12/2007 (5:27 am)
nice start..
may be you will be intersted in this

www.garagegames.com/mg/forums/result.thread.php?qt=64330
Page «Previous 1 2