forums

TNT Basic Forums > Programming Q&A
Networking... on the internet?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

11-05-2006 05:43

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

The tutorial seems to imply that multiplayer games can only be played over LAN, but it doesn't quite say it.

Also, If I only got one player, do "Network Global Variables" still work as normal globals?

Also... Can I initialise a multiplayer game, and still have only 1 player?

11-05-2006 05:44

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

...
One more:

If both players in the same game have a Network global variable of the same name, both player still only use the host's one, right? (it better be...)

11-05-2006 22:52

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

OK, some answers.

Firstly, TNT network mode works over WAN as well as LAN. So yes, you can play network games over the net.

If you only have one player it makes no difference, the 'GLOBAL' variables and 'Network GLOBAL' variables are the same thing. Network variables are networked by the engine but standard ones aren't... That's the only difference.

quote:
Also... Can I initialise a multiplayer game, and still have only 1 player?
Why would you want to? If you want to play multiplayer and no-one else signs up then just bug out and play single player... To answer the question it's a NO, you can't play multiplayer on your own, but it really makes no sense for it to be a YES...

And Finally: Both players are playing the same game, by that I mean the same piece of software, so all global variables will be the same (it's the same code!). The host updates the content and the new values are broadcast. Hope that clears it up...

Danny (nods)

11-06-2006 10:40

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Have you ever played a game of age of empires?
You could host an IP game and still play by yourself if no one joins.

I was wondering if you could do that, sorry if I rephrased it incorrectly.

Also... is it more efficient to have an array[3,3]

or

array1[2]
array2[3]
array3[2] ?

The second option means only the minimal number of values are stored, but the first option has only one array.

So which is quicker? (in terms of processing them, reading them, writing them)?

11-06-2006 11:00

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I have got 200 of these global arrays... so I am trying to think of a way to squeeze out some memory they take (IMO, in a multiplayer game it wouldn't do to send 200 arrays to each player and each player to each other player every single frame).

11-06-2006 11:22

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

hmm... is there a TNTBasic Chat program example?

(it'll teach me how to do a text box where a player can enter text too...)

11-06-2006 13:07

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Some more answers...

You'll probably find that a network game with only one player just uses the single player engine, otherwise the main loop would be sitting there waiting for network messages that would never turn up. I may be wrong though... but that's how I'd do it.

Single dimension arrays are quicker than multiples. The calculation needed to get at a single dim array element is:

Address + array_index*4 (*4 as each element is a long word, or four bytes. The name of the array is a variable holding its address.

For Multi dimension arrays (array[a,b]) the calculation is:

Address + ((a*b)*4)+(b*4), A bit more complex...

Two hundred Global arrays being broadcast over a network would bring the thing to its knees. But it would depend on how many elements were in each. That's still a lot of Global data though.

There is also no TNTChat example, but it might be a good place to start... We could have TNT Instant Message support through the Forums ;)

Danny (nods)

11-07-2006 09:04

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I'll try to reduce those globals then...

11-10-2006 05:05

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I have now 9 Network Globals[a,b] with 15~(a)s, and the number of (b)s would depend on how many units/buildings the players use. Is this better or worse than 200 single dimensional arrays?

11-10-2006 08:45

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

I prefer 15 over 200 every time...

;)

Danny (nods)

11-15-2006 22:46

Posted by:
Wil Hostman

Find more posts by Wil Hostman

Why 1-player network?

The single player network game can be a "waiting for join" kind of thing, or the model for client-server.

So you could, in theory, write a client and a server with the same network globals, but different code.

I don't know if TNT can handle that locally, but it is a possibility.

11-17-2006 21:26

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Well, I don't want to have a "Multiplayer Engine" seperate to the "Single Player Engine"

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.