SunBurn Multiplayer and T2D Networking TDN Article
by Tom Bampton · 03/07/2006 (1:07 am) · 5 comments
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.

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.
About the author
Recent Blogs
• A Game in 2750 Days• GID23 and NPC Editor
• Fun with Lua
• How NOT to make a game
• Thinking Outside the Box
#2
Here's your cookie:
winWindow.cc, ~line 978 in CreateOpenGLWindow(), change the windowStyle for a non-maximized window to:
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:
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.
03/07/2006 (2:19 am)
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.
#3
03/07/2006 (7:31 am)
Another check on the TODO list done. Something so simple, but never even thought about fixing it. Great article on TDN btw.
#4
T.
03/07/2006 (7:53 am)
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.
#5
03/07/2006 (8:30 am)
Cool as always Tom. :)
Torque Owner Jason Cahill
Default Studio Name