Previous Blog Next Blog
Prev/Next Blog
by date

SunBurn Multiplayer and T2D Networking TDN Article

SunBurn Multiplayer and T2D Networking TDN Article
Name:Tom Bampton
Date Posted:Mar 07, 2006
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Tom Bampton

Blog post
Here we have a multiplayer game of SunBurn. First, the host:



And now, the client:



There are a number of things to note here.

On the map

* Networked Randomly Generated Map and Fog of War, with MakeItLookShit(TM) technology (patent pending).
* Server based (e.g. it gets the valid moves from the server) silly move indicator to indicate valid moves
* Nifty unit active tiles. Everything either comes from datablocks or the unit and map data. The flag comes from the player's nation info, the number is the number of units on the tile and the left health bar is for health. The other bar is currently unused, but will be used for food once that code is implemented. The unit image is just a frame from an image map.

On the HUD

From the left:

* Currently selected unit, with health bar. This is a custom GuiControl that renders any given sbUnit. It's basically a Torque GUI version of the old unit rendering code.
* The crappy move rate, attack rate, view radius and defend rate placeholder stats.
* The units in the currently selected unit stack. Yes, I finally got around to implementing unit stacking. This is a single custom GuiControl that renders all the units on a specified map tile. It also provides simple UI to select units. Yellow highlight is the currently selected unit, red is the mouse over. When clicking on the unit, the C++ code just calls a script callback to do the grunt work of selection.

The nice thing about the extra GUI controls is all the data comes from the same, single place. That means I only have to have one copy of each unit image in an image map, rather then having the image map for within T2D and a separate image for the GUI.

There is one quite obvious thing in the above screenshots that is different from stock Torque. I don't think anybody will notice it, though. A cookie to the first person that spots it.

TDN Article

I finally got around to putting up an early version of a write up on getting TGE style networking into T2D. You can read it here if you're interested.

Recent Blog Posts
List:08/20/07 - GID23 and NPC Editor
07/25/07 - Fun with Lua
06/11/07 - How NOT to make a game
11/18/06 - Thinking Outside the Box
11/03/06 - Alive and Ticking: Now with exploding ants
10/28/06 - Fun with zips
10/02/06 - Alive and Ticking gets to Beta .... err, almost. (Warning: Screenshot Heavy)
09/08/06 - Internal Name Operator

Submit ResourceSubmit your own resources!

Jason "TGB BOY" Cahill   (Mar 07, 2006 at 09:28 GMT)
You added a close button to the T2D main window. How... please share. I hate not having that!

Tom Bampton   (Mar 07, 2006 at 10:19 GMT)
Bah, ok, maybe it was more obvious then I thought ;-)

Here's your cookie:

winWindow.cc, ~line 978 in CreateOpenGLWindow(), change the windowStyle for a non-maximized window to:


windowStyle |= ( WS_SYSMENU | WS_OVERLAPPED | WS_CAPTION );


Since this is public I wont post the whole function. It should be pretty obvious once you see the code, though.

If you want the icon too, in InitWindowClasses() (same file) ~line 935, change the icon resource ID:


wc.hIcon         = LoadIcon(winState.appInstance, MAKEINTRESOURCE(IDI_ICON1));


In stock it was set to IDI_ICON2 which wasnt defined in the .rc.

BTW, this is all standard Windows stuff, so you can read about it in the Platform SDK if you want to tweak it some more.

T.

Dave D   (Mar 07, 2006 at 15:31 GMT)
Another check on the TODO list done. Something so simple, but never even thought about fixing it. Great article on TDN btw.

Tom Bampton   (Mar 07, 2006 at 15:53 GMT)
Dave, yeh, there's quite a few niggly little things that are so minor they're not worth thinking about most of the time. I've taken to fixing them in SunBurn (almost) as soon as I notice them. When I have some time I'll diff the codebases and make an effort to get whatever's relevant into stock TGE and the rest on TDN. That is, assuming I dont forget ;)

T.

Adam deGrandis   (Mar 07, 2006 at 16:30 GMT)
Cool as always Tom. :)

You must be a member and be logged in to either append comments or rate this resource.