Previous Blog Next Blog
Prev/Next Blog
by date

Fun with networking and T2D

Fun with networking and T2D
Name:Tom Bampton
Date Posted:Feb 08, 2006
Rating:4.5 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Tom Bampton

Blog post
I've been wanting to post this for a few days now. First, a picture ...

The Lobby



No, I'm not yakkig on about TinyIRC again. That's just in there because I'm going to need it eventually. The interesting part is below. On the surface, it's fairly uninteresting. There's a drop down that changes between a bunch of predefined nations and fills in the relevant fields. It also changes the flag. Boring ? Yes, I guess it is when you look at it like that ...

However, if you look behind the scenes:

The flag comes from a t2dImageMapDatablock. There's actually no t2dSceneGraph at that point, that's actually a GuiControl. Why? Well, I have a number of imagemaps that need to be rendered both by the TGE GUI in some circumstances and T2D in others. It was the easiest solution.

Oh, and the t2dImageMapDatablock came across the network.

Now it gets interesting ...



Ignore for a moment the rather obvious bug and I'll explain what's going on ...

The map is the same map I mentioned in previous .plans. A quick recap for those that havnt seen it: Its generated at game start using a multithreaded version of the TGE terrain generator. It takes the output of that and creates a t2dTileMap.

What the hell is going on ?

The first set of datablocks define the nations. These are sent to the clients when they join the lobby in order to populate the nation selection GUI. This includes the t2dImageMapDatablocks for the flags.

When all the clients have clicked ready the game loads. It does this in a 3 stage process similar to TGE's mission load.

The first stage loads the rest of the game data and sends those datablocks. These datablocks include all the unit definitions and the datablocks used by the map generator (they contain data needed by the client, such as more image maps).

The second stage creates the map, which is a NetObject, and starts ghosting to cause the map to be downloaded.

The third stage just takes the downloaded map data and builds the tile map.

Well, actually, thats about it at the moment. If you're wondering about the strange but slightly funny bug, its a side effect of the way I quick hacked sbMap::packUpdate() to transfer the map. There was a hell of a lot of code needed to get T2D back to the stage where this was possible and i needed a way to test NetObjects.

But what does it all *mean* ?

Real time networking. In T2D.

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!

Anders Linder-Noren   (Feb 08, 2006 at 16:02 GMT)
Badass networking. Everybody, grab your 2D-MMORPG plans and bring them over to T2D.

This means a definite purchase for my sake. I can't believe how fast T2D is advancing.

Paul Dana   (Feb 08, 2006 at 16:11 GMT)
fresh picked juicey

Tom Bampton   (Feb 08, 2006 at 16:28 GMT)
Anders,

This is a fairly long way off being generally usable in a manner that the average T2D user would be able to actually use since this is all fairly low level C++ and requires an understanding of how TGE networking works to be able to use it. Integrating the code with the official T2D hasnt really been discussed at this point, and any integration with T2D would have to be fairly different to what exists now. I dont want to get anyone's hopes up :)

T.

Melv May   (Feb 08, 2006 at 18:52 GMT)
Nevertheless, this is still juicy and ripe. :)

Great work Tom as usual. You always seem to find something interesting to work on; how do you do that? ;)

- Melv.

Gary Preston   (Feb 08, 2006 at 19:05 GMT)   Resource Rating: 4
Nice, just goes to show where theres a will theres a way. Why wait for official support when you can do it yourself, even if its limited to only what you need :)

I'm dissapointed that you didn't have 5 clients connected in that photo to truly show off the multi monitor setup though ;)

Anders Linder-Noren   (Feb 08, 2006 at 20:01 GMT)
Still, seems like you have gotten a long way with it ;) And i don't plan a purchase until late summer anyway, so maybe it have advanced more by then :)

Jesse Hall   (Feb 09, 2006 at 05:37 GMT)
awesome stuff Tom!

Tom Bampton   (Feb 09, 2006 at 07:05 GMT)
Melv,

I think it helps to be a bit mental :)

Gary,

5 clients would make the map "bug" a lot worse ;-) Besides, I don't think I have enough computers:



T.

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