Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1] 2 3 4
  Print  
Author Topic: Hurtle: the ballistic RTS (physics RTS game)  (Read 63278 times)
nicolas
Community Member
*
Posts: 172


« on: February 22, 2010, 10:55:08 AM »

Hi all!

After familiarising myself with the basic concepts of TV3D (using VB6), I've started on a game with (hopefully) some nice gameplay instead of just another racer (which was my TV3D trial project).

The result is/will be "Hurtle - the ballistic RTS".

The concept is simple: it is a slender version of your standard RTS, but with the focus on using the siege weapons yourself instead of automatically. Almost everything in the game is a physical object, to make the siege warfare really interesting. So this is something like the classic "Cannon Blaster" like 2D game meets Age Of Empires 3. Sorta. Wink

There are a lot of challenges in my approach. I'm making this thread so all of you can follow the progress and hopefully help me sometimes on issues.

The current state of the project is:
-concept of 2D GUI
-concept of terrain generation (the hills are fixed, but all trees, rocks etc are unique for every game session)
-concept of object placement
-testing of animated actors

The next thing to do is work on the graphics a bit, namely shaders.

After that, the major hurdles are:
-ballistics: siege weapon control
-own player AI: resources gathering, pathfinding..
-game logic (building restrictions...)
-opponent AI: resources gathering, pathfinding, attack & defence strategies

I'll also make some posts about the specifics of my project now and then. I'll detail the choices I made; hopefully they can inspire someone else for their own projects.

This is just a hobby thing, nothing commercial. I do everything myself and I'm no excellent designer/modeller/skinner/animator nor programmer.  Roll Eyes

Anyway, here are the first screenshots! As you can see, nothing wrong with it basically, but I really could use some shaders to make things more interesting. Especially shadow maps and maybe some general colour/soften filter (like pain.net's "warm" filter) would be very nice. I've never used shaders before and I'm using VB6, so that's the first big challenge on the agenda.





Logged
asia
Customers
Community Member
*****
Posts: 183


« Reply #1 on: February 22, 2010, 01:21:34 PM »

Just curious: what king of fog are you using? It looks like it was volumetric fog but for that you need a shader…
Any way I am also developing one man projects  :)and I think you are quite good.
Greetings
Fabio
Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
nicolas
Community Member
*
Posts: 172


« Reply #2 on: February 22, 2010, 02:44:29 PM »

Standard TV3D fog.

I'm too tired to try shaders tonight, will be something for later this week.
Logged
Toaster
Community Member
*
Posts: 378


WWW
« Reply #3 on: February 22, 2010, 03:25:22 PM »

Looking good! its good to see new projects in TV. Although the graphics look a bit old I kinda like them it reminds me of AOE2 Smiley

-Toaster
Logged

Visit my site at: Unknown Abstraction
nicolas
Community Member
*
Posts: 172


« Reply #4 on: February 22, 2010, 03:29:31 PM »

The camera

I've chosen to make the camera as free as possible. In fact, all aspects of this game are to be as free, "sandbox" as possible.

Freedom for a camera means the ability to rotate it however you want it, the ability to translate it wherever you want it within the boundaries of the game world and the game logic (you can only see so far; if you want to see further, build more watchtowers). And the ability to zoom to whichever level you like.

Zooming in case of an RTS means that on one hand you want a zoomed out view, to get an overview. The world is relatively large (more than a kilometer in diameter, which in this game means quite some woods to explore), so overview is necessary.

This is a fully zoomed out view (camera is rotated a bit towards the horizon, but can be 90° if you wish. Freedom, remember):



Never mind the seagull. It just happened to fly there at the time of the screenshot. Besides, seagulls are no harm as long as they're below you.  Lips sealed

On the other hand, in these days of 3D RTS games, why not allow for really close zoom in action. Not only because it makes for nice screenshots Wink, but also because you may want some first person perspective when working the siege weapons. A top view can give you a nice view of the target, but a more zoomed in view can sometimes reveal interesting details about obstacles along the way...

This is fully zoomed in:



A word of warning: the seagulls are now above you. OK, they don't do anything except for flying around. Maybe I should rebuild the snow cover shader into a poopoo shader. Wink Cheesy

Fully zoomed out, you can see a complete castle or even the horizon kilometres away. Fully zoomed in, you can see individual leafs of ferns and the thumbs of your soldiers.  Tongue

As the camera offers a lot of freedom, it needs good control. Here, a tradeoff had to be made. As an RTS, construction is a major part of the game. So is camera control. And firing siege weapons. You can't do them all with the mouse. That's why I've chosen to do the building fully by mouse, and camera partially by mouse and partially by keyboard. With the mouse in "mouse mode", you can translate the camera by moving the mouse to the edge of the screen. Rotation as well as some alternative translation modes are done with the keyboard. This way, during construction you can concentrate the placement of objects on the mouse, and the camera on the keyboard.

Controlling siege weapons has yet to be developed, so I'm not sure yet whether it will be mouse or keyboard...
Logged
nicolas
Community Member
*
Posts: 172


« Reply #5 on: February 23, 2010, 08:21:39 AM »

Problem: the game was getting a bit too grey and low-contrast, even for representing a foggy forest. Especially when zoomed out.

I've played around with lighting and the fog settings, to arrive at the following solution:

-materials with more light/shadow contrast through their material settings.
-the fog starts further, so even zoomed out you get a "no fog" center.
-the fog stops sooner, to create a thick fog "deep inside the forest".





The result is more clearly when seeing the game in full screen and in motion than from a small screenshot, but anyway... At least you can see more colour in the zoomed out view and more depth perception, for example in the wooden walls surrounding the tower.
Logged
nicolas
Community Member
*
Posts: 172


« Reply #6 on: February 24, 2010, 03:33:40 AM »

The test with shaders didn't really work out:

-I can't get FX Composer to run on my PC, so I can't see which parameters to send.
-Trying ShadowSpot.fx on my towers only caused them to disappear...

On another note, I'm also struggling a bit with camera translation.

*sigh*
Logged
nicolas
Community Member
*
Posts: 172


« Reply #7 on: February 24, 2010, 03:46:55 PM »

Sorted out the camera issue. Apparently, the axis definition doesn't follow my logic as far as angles are concerned. Smiley

Still no shaders up and running.

Anyway, I thought I'd share a real size screenshot cutout of the human character and a real size (well, 1024 cutout of a 1280 render) screenshot.


1024 size link:
http://i46.tinypic.com/31317df.jpg

Here you can see how the new lighting improved the scene and how the new fog improved the colours.



OK, it looks a bit simplistic and maybe cartoonesque. But I'm happy with it, because:

-it had to be low poly
-it is the first human I've ever modelled
-it is the first human I've ever skinned
-it is the first humand I've ever animated

Like everything except for Mount St Helens, it looks better when in motion. The guy walks around the terrain in a decent way. Not 100% lifelike, but realistic enough for the game.
Logged
asia
Customers
Community Member
*****
Posts: 183


« Reply #8 on: February 26, 2010, 02:42:45 AM »

every child is beautiful to its mother (father)
 Wink
Ciao
Fabio
Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
nicolas
Community Member
*
Posts: 172


« Reply #9 on: March 01, 2010, 03:07:13 PM »

erm..."thanks".  Grin

Anyway, I've worked on the framerate and visuals of the game. Increase the former while improving the latter, that sort of thing. For this, I resorted to minimeshes for the non-phyisical terrain elements (ferns, grasses). Two things I noticed:
-minimeshes improve the FPS a lot over regular meshes
-however, when changing the scale of each minimesh (at initialisation), the FPS takes a serious hit

Anyway, I found an optimum which gives me improved graphics running at 20FPS minimum on this old PC, where I'd get 15FPS in earlier, uglier versions. Nice! And often, the FPS is at 30 or more. OK, that's not what some of you are used to, but this is an old laptop. Single core 3GHz cheapo. Also take into account that this scene contains 1000 physical object trees.

I've also made another visual improvement. I couldn't get shaders to work, so I've programmed minimesh shadows. They have some glitches, but overall they give a nice shadow effect underneath trees and rocks.





*click pics for large versions*
« Last Edit: March 02, 2010, 03:57:34 AM by nicolas » Logged
nicolas
Community Member
*
Posts: 172


« Reply #10 on: March 01, 2010, 03:19:38 PM »

Would I get an FPS improvement if I'd (somehow) make minimeshes out of the trees and couple their position to that of the physics object trees? All trees are randomly scaled, so I'm not sure I'd get an FPS increase...
Logged
nicolas
Community Member
*
Posts: 172


« Reply #11 on: March 02, 2010, 03:55:32 AM »

tinypic deleted my screenshot  Huh

edit: uploaded it again.
« Last Edit: March 02, 2010, 03:58:06 AM by nicolas » Logged
Aki
Customers
Community Member
*****
Posts: 84


« Reply #12 on: March 02, 2010, 05:46:18 AM »

Would I get an FPS improvement if I'd (somehow) make minimeshes out of the trees and couple their position to that of the physics object trees? All trees are randomly scaled, so I'm not sure I'd get an FPS increase...

If you've got a significant amount of vertices (num meshes x vertices in mesh > 10000), most definitely. Here's a snippet from my tree class:

Code:
public static int MinimeshTreeMax;
public static int TextureTree;
public static TVMiniMesh MinimeshTree;

Code:
MinimeshTreeMax = 52;
MinimeshTree = TVScene.CreateMiniMesh(MinimeshTreeMax);

Code:
public static int AddTree(TV_2DVECTOR Position)
        {
            int NewID = MinimeshTree.GetFirstDisabledMinimesh();

            if (NewID >= MinimeshTreeMax)
            {
                MinimeshTreeMax += 52;
                MinimeshTree.SetMaxMeshCount(MinimeshTreeMax);
            }
            else
            {
                if (NewID < MinimeshTreeMax - 52)
                {
                    MinimeshTreeMax -= 52;
                    MinimeshTree.SetMaxMeshCount(MinimeshTreeMax);
                }
            }

            MinimeshTree.EnableMiniMesh(NewID, true);
            MinimeshTree.SetPosition(Position.x, World.LandscapeTerrain.GetHeight(Position.x, Position.y), Position.y, NewID);

            return NewID;
        }

public static void DestroyTree(int ID)
        {
            MinimeshTree.EnableMiniMesh(ID, false);
        }

Obviously, you'll need to change it around a bit, but it works very well. I actually have a setup like this for all of my meshes.

Looking good!
Logged

nicolas
Community Member
*
Posts: 172


« Reply #13 on: March 02, 2010, 05:48:57 AM »

The amount of polygons per tree is low (less than 100). The problems is not making them minimeshes. The problem is that they have a physics object linked to them. You can link physics objects to meshes, not to minimeshes. So I'd have to find a workaround that does improve the FPS.
Logged
Aki
Customers
Community Member
*****
Posts: 84


« Reply #14 on: March 02, 2010, 06:08:47 AM »

The amount of polygons per tree is low (less than 100). The problems is not making them minimeshes. The problem is that they have a physics object linked to them. You can link physics objects to meshes, not to minimeshes. So I'd have to find a workaround that does improve the FPS.
That's quite easy... using TV physics, anyways. You shouldn't be implementing each tree as a full-fledged 100 polygon object if you're trying to optimize. Instead, implement each tree as a pyramid (or cone or box or cylinder) physics body, especially for an RTS: you don't need precise collision on such a vast scale.

For TV physics (Newton), you return an integer value when you create a physics body. For each tree, create a physics body (preferably static) and store the body ID integer.

I wrote an example of a dynamic planet somewhere around here, which did this technique using TV physics in C++ but is horribly organized. But if you're lost, it could help.

PS: Using photoshop, turn the contrast on your grass texture down slightly, as well as the saturation. Perhaps apply a weak green colored filter as well - this will really help smooth out your "look".

PPS: The tip I mentioned earlier, for lowering the amount of vertices in the physics world, should be used for EVERYTHING! Straight walls should NEVER be more than a simple box. Actors should be elongated spheres, etc.
« Last Edit: March 02, 2010, 06:13:16 AM by Aki » Logged

nicolas
Community Member
*
Posts: 172


« Reply #15 on: March 02, 2010, 07:46:13 AM »

Thanks for the input!

As for the grass texture (you mean the terrain grass, not the minimeshes right?): I *love* it this way (last two screenshots). Then again, I'm colour blind. But anyway. Grin I like the autumn colours and the rough look. This is supposed to be grassy soil in the woods, not a British garden pelouseTongue When fully zoomed in, some parts look a bit high-contrast, but overall it looks fine for me, on all zoom levels. I'm afraid that, if I'd smooth it out too much for the fully zoomed in view, it'd look like a golf court when zoomed farther out.

If you meant the minimeshes: for my eyes, they blend with the terrain texture really well. But as I said, I'm colour blind. So it's hard for me to improve if they aren't ok.  Undecided

This laptop doesn't support anti-aliasing and I doubt it does anisotropic filtering. So a proper 3D accelerator may also smoothen the look a bit.

As for the physics objects: doesn't the boundingtype parameter set the geometry to be used for the physics (box, convex_hull, sphere, cylinder...)? Or do I really have to refer to a geometry I made myself?

I now make them like this:

Code:
phymTree3(1) = Physics.CreateMeshBody(3000, mTree3(1), TV_BODY_CONVEXHULL, True)

I'd still have to find a command to create a physics objects that does not require a reference to a specific TVMesh. Mind that all my trees have a different scale, so the physics objects should have the same scale as the tree they represent. I'll do some tests when I have time.
« Last Edit: March 02, 2010, 08:06:57 AM by nicolas » Logged
asia
Customers
Community Member
*****
Posts: 183


« Reply #16 on: March 02, 2010, 10:22:18 AM »

For my trees/Minimeshes I use physics with cylinders. I do not know if it can be done better but what is following works:
Code:

' tree at xx,zz

         pb = Physics.CreateBody(50000)
         Physics.AddCylinder pb, 2, 3
         Physics.SetBodyPosition pb, xx, Land.GetHeight(xx,zz), zz
         Physics.SetBodyMovable pb, False
Also using minimeshes, I think,  you are using shaders (even if you do not know).
I am writing this because shaders capability are strongly dependent from your graphic card. So you should mention your CPU speed AND (maybe more important) your graphic card (GPU).
And, because you are using shader, why you do not use also splatting? If you use splatting layers you can also use a light map for your land. This light map can be build with a renderurface where you can draw shadows (maybe just circular) at the tree positions.
For short, you do not need to know HLGL or stuff like this in order to use shaders. Many of the TV effects are shader based and (nevertheless) easy to use.
Hope this will help you a bit..
Ciao
« Last Edit: March 02, 2010, 10:39:03 AM by asia » Logged

Fabio Musmeci
ENEA
CR Casaccia
Via Anguillarese 301
00060 Rome
Italy
musmeci@enea.it
+39 3333934898
Learning to live better on a smaller footprint..
nicolas
Community Member
*
Posts: 172


« Reply #17 on: March 02, 2010, 01:37:43 PM »

Thanks for the input. That's a lot to think about (I'm not a pro Wink). I'll try one thing at a time and see what I can get working & what helps.

As for the GPU: I'm developing on the laptop now, but I also have a slightly (SLIGHTLY) more modern PC at home with a decent graphics card for its age, which supports SM3. But anyway, I'll stick to TV included functions for the moment, no external shaders.

Your idea of using a rendersurface to render the shadows sounds interesting. I'll have to discover how to do that though. I once got the glow effect working, so it shouldn't be *that* much harder I think...

As for an alternative way to make the physics trees using minimeshes: a bit complicated for me atm, so I'll leave that aside for the time being.

But I do think that using the boundingtype parameter in my calls results in simple physics objects rather than the full poly tvmeshes, so that part is already optimised. It's just that 1000 meshes versus 1000 minimesh instances is quite the difference, so there's some gain to be found there.
Logged
Aki
Customers
Community Member
*****
Posts: 84


« Reply #18 on: March 02, 2010, 05:22:36 PM »

I
As for the grass texture (you mean the terrain grass, not the minimeshes right?): I *love* it this way (last two screenshots). Then again, I'm colour blind. But anyway. Grin I like the autumn colours and the rough look. This is supposed to be grassy soil in the woods, not a British garden pelouseTongue When fully zoomed in, some parts look a bit high-contrast, but overall it looks fine for me, on all zoom levels. I'm afraid that, if I'd smooth it out too much for the fully zoomed in view, it'd look like a golf court when zoomed farther out.

I rather like the golf course look Grin. I was talking about the ground texture, The trees and grass meshes look fantastic! But to each their own Smiley

As for using convexhull, I think it actually doesn't optimize much, instead creating a group of polygons around your object (look up convex hull in wikipedia). Try using cylinder instead, you might get some CPU performance out of it. There's always the EnableDebugInfo (I think) function, which lets you use the physics Render option and draws all your physics objects.

If using the FX class, you're definitely using shaders. But the render surface idea works too (and is much simpler than using a terrain shader)! Here's a quick how-to:

Create TVCamera and TVRenderSurface
Set TVCamera to isometric projection covering exactly the extents of the terrain
Set TVRenderSurface's camera to TVCamera and background to white
Render everything to be shadowed as black onto the TVRenderSurface
Set terrain lightmap to the TVRenderSurface

DON'T DO IT EVERY FRAME. Once a second maybe, but preferably only after a map loads.

Obviously this won't let you do unit shadows with this method (at least without a shader), but it should look neat!
Logged

nicolas
Community Member
*
Posts: 172


« Reply #19 on: March 03, 2010, 03:30:30 AM »

I need convexhull for the trees and towers because if they fall over (by a catapult shot) I want them to settle realistically, that is with the trunk low and not up in the air.

For other objects such as the walls and rocks, I use box. For the men, I use cylinders.

I'll think about the shadows method. Thanks for leading me the way. Updating once every second is good for the FPS, however it will cause shadows lag when a tree is falling or something like that. But I'll give it a try and see if it's useful/good looking and whether the lag is a problem or not. Well, first I'll try to get it to work.

So the current planning is:
-first take a closer look at the shadow thing
-next, try to link the physics trees to minimeshes rather than meshes

Oh, and no golf course.  Grin Seriously though, I'll give it a try just to see for myself which one I prefer.
« Last Edit: March 03, 2010, 03:34:52 AM by nicolas » Logged
Pages: [1] 2 3 4
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks