Game Development Community

Client/Server C++/Scripts variable scope etc Q.

by David Schwanke · in Torque Game Engine · 06/07/2004 (4:59 pm) · 1 replies

Trying to get my feet under me.

Ive looked at the different Inventory systems offered as tutorials and didnt really find much that I liked. I'm sure they are good and I even implemented one, but it didnt feel close enough to what I had in mind.

I know a little bit about the general concepts of client server systems. Mainly as it pertains to an inventory system in a game you have to worry about the client being able to manipulate the inventory (dupeing, cheating, etc).

I figured that for my first system I would make it something very basic:

Have the server manage the master inventory list and have it update the client 'slave' list as things changed. The client would use the updated slave list to do most of its commands such as listing and using items, but it would send anything that changed the world back to the server to be checked against the master list.

Idea being that the worst that could happen is the client looks like it has a dupe but when you try to use the dupe for anything the server responds with a no such item response of some kind.

Thing is, I cant seem to get my head around how Torque, either in its C++ Source or in its Scripting language handles client server variables and scopes and so forth. (Not even sure if scope is still the right word when you cross client/server boundaries.)

A list even short of places to look for how secure client server stuff is done in torque would be great. Some definitions would be great too or search terms, anything really. I'm kind of starting from scratch.

I read the source documentation and it tended to get too detailed down to the network level for me. I cant seem to find any high level documentation that talks about something as simple as whether or not the Player object is a server side objet, a client side object or some hybrid of the two.

In fact I cant seem to find any server client discussion except in the the low level network layer discussion in the afore mentioned source docs and the discussion of 'ghost' objects. But even then ghost objects seem to be world objects, not coding objects like classes or structs.

Thanks in advance for some guidance.

#1
06/07/2004 (7:35 pm)
Ok, so my first chunk of knowledge seems to indicate that all of the client server communication is done via commandToServer/serverCmd.. and commandToClient/clientCmd.. protocol pairs atleast in the scripts.

Ive actuall worked with these before but it didnt click on me how clear this was until I found a simple GG resource/tutorial that was just how to transfer data between the client and server. (I had to use an outside search engine to find it though, not sure why it didnt show up in my searches here.)

Sharing Player Data between Server and Client in Torque

I still have to study how you know which scripts global variables are in on the server and which are on the client.

I'm guessing something as simple as if its in a server or client directory could answer most of that, but I'd still like to know about the rest for completeness. Like is it as 'logical' as all the (g)ui stuff is client side? I havnt studied the ui code enough to know if there is some server only issues in there like not being able to manipulate objects you shouldnt be able to, or if thats all contained in the server scripts?

Just trying to work this out and maybe leave a trail for someone else. :D