Game Development Community

What is best to work with (Torque engine).....

by Henning Martinsen · in General Discussion · 07/30/2005 (8:07 am) · 7 replies

What is best to work with (Torque engine) as a client or server. Ok let say I begin in a client; C:\Torque\SDK\example\starter.fps\client\ or C:\Torque\SDK\example\starter.fps\client\ui\, in this to am going to create my game, am not sure wich one. And later am just copy that over to server place and for all times, or what are am going to do????

#1
07/30/2005 (8:18 am)
Here is the best explanation I can come up with:
Fist off, client and server are two different things. The server portion is where much of the action (script wise) will occur, be it AI, physics, and communication with all the clients connected to the server.

The client on the other hand, will hold all the information necessary for a player to play on a server. So the client will have all the UI stuff, and send it's information to the server, so it can send it to other players.

I hope my explanation helps. If someone has a better one, please feel free to show me up.
#2
07/30/2005 (9:01 am)
Sounds about right, Matthew, from what I know anyways :)

@Henning : You need both \client\ and \server\ for your game to work. Of course, this is assuming you work with the basic TGE demos and how they handle client/server.

You couldn't just use the server code or the client code. To play the game, you need to have a client (even if it is on the same machine) connect to a server. When you load a mission and start the mission, the code actually connects your client code to a local server.

Try having two directories containing the torque code, fire one up as a dedicated server (torque.exe - dedicated -mapname ... I think, just check the docs to be sure). Then start the other copy, click multiplayer and look for LAN servers, it should see your dedicated server. Play a bit with it and compare the console logs of the client and dedicated server, it might shed some light on the whole process.

Matthew got it right for the client and server description. Client contains all data that are relevant to the PLAYER, and the server contains the 'official' version of the game world which players connect to. The version of the game world on the client is streamed from the server. In return, the client will send important information back to the server, such as the local player's position.

The code that handles the keypress and the calculations to move the player to his new location are calculated on the client. Sending the data across the network and asking the server to perform the calculations would clog up the bandwidth and basically slow the game down to a crawl. So it calculates all the heavy math stuff on the client, sending the results of these calculations to the server, which in turn will tell all the other clients where the player has moved to, updating the game world with that information.

I know it sounds terribly confusing, and it is, believe me. But when you finally get it, it will strike you as a really smart way to code things. Anyways, took me about a year of looking through all the source code, checking out tutorials, examples, and spending the better part of my adult life reading console logs.

If anybody wants to add to the explanation, make it easier to understand or declare me a heretic, please do so.
#3
07/30/2005 (10:16 am)
In my interpretation of the question it seems you are asking in what folders you should put the files for your game. Technically, it doesn't really matter where each file goes, but, from an organizational standpoint, you will want to seperate stuff.

Basically, you will want to put any gui files, gui code, client side audio profiles (background music, gui sounds), keybindings, and client commands (functions called by 'commandToClient') in the client folder. All of these things are handled by the client in the engine.

In the server folder, you will want to put most of the important gameplay stuff, which would mainly be datablock definitions.
#4
07/30/2005 (10:55 am)
Thanks, yup you got it, Adam Larson.

This I got for now. And this I don't working on yet.
C:\Torque\SDK\example\starter.fps\server\=server stuff.
C:\Torque\SDK\example\starter.fps\client\=client stuff.

This I have done some, of course I have only got to main menu for the player.
C:\Torque\SDK\example\starter.fps\client\ui\=clients templates stuff.

This is pending on "if this right to do". Am not sure, yet.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\=my game world stuff.

This is not yet beginning on.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\sound\=my game world sound + music stuff.

This is not yet beginning on.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\voices\=my game world voices stuff.

This is not yet beginning on.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\AI\=my game world coputers npc stuff.

This is not yet beginning on.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\Characters\=my game world characters templates stuff, and skins, models, buttons, and so on.

This is not yet beginning on.
C:\Imperia\SDK\example\starter.fps\ImperiaWorld\gui\=my game world user interace stuff.

This is my folders, so do I got it or........????
I know this is only a few example to show you.

Am not sure how else I can tell you?
#5
07/30/2005 (11:19 am)
What I would do, is make a copy of the whole starter.fps folder and name it ImperiaWorld. Then, in C:\Imperia\SDK\example\main.cs, change "$defaultGame = "starter.fps";" to "$defaultGame = "ImperiaWorld";". It's right at the top of the file.

Then, in ImperiaWorld/data/ you can add your sound, voices, ai, and character folders. The gui stuff is technically client side, but if it makes more sense for you to have it in the data folder, that's no problem.

Keep in mind, this is just a suggestion. You can organize the folders however you see fit. The structure you demonstrated would work just fine.
#6
07/30/2005 (8:22 pm)
Im glad someone brought this up because this whole client server thing is pretty confusing to me. at this point, I still don't understand the difference between coding something "on the client" vs coding "on the server". the only thing codewise Ive seen which resembles any kind of real separation is using client commands and server commands. the reason it still confuses me is because theres no apparent difference between these kinds of commands. other than the understood "client" argument for a server command, i dont understand 1. whats the difference between the two, and 2. whats their purpose in a single player game? is the difference between client and server coding simply the difference between calling a function explicitly vs using call()?
#7
07/31/2005 (4:20 am)
Thanks to all guys, and for you Sean H. I can say this, I hope you can get help like I have, for am not the right person to tell you, other then look what Simon "Capn Love" Lamoureux have written about that. Am sry am not more helpful for you, good luck.