What API for network in games ?
I work on a 3D engine designed for local play only, and I have to make it able to gear multiplayer game through network. I don't know what API to use : DirectPlay, SDL_net, OpenPlay, DCOM, etc... or must I use lower-level functions such as sockets ?
If anyone could guide me...
[edited by - Bronsky on April 1, 2003 3:34:51 AM]
[Sorry for my english, I''m french...]
I personally use Winsock, it''s very easy to work with
Darkhaven Beta-test stage coming soon.
Is Winsock able to transmit entire class instances (without pointed or referenced attributes, of course) ?
I know it can transmit structs, but not class instances...
I know it can transmit structs, but not class instances...
[Sorry for my english, I''m french...]
Yup, you *can* essentially transmit a class (not that it usually the best way to do things).. The dirty quick way would be to just call send and pass in the pointer to the object and sizeof(objectType) .. and then on the other end you would call a recv with a pointerTo the recieving object and again specifying the size of the object type... if your going to pass anything but the same object then you will need a small header before the object data specifying the object type being transmitted and possibly the object size. of course.. the definition of the class must be identical (and compiled on the same compiler probably) and even then its has potential problems. Why would you want to send an entire object anyway ?? just send a structure and instantiate a new object with the data in the structure ![](smile.gif)
good luck
![](smile.gif)
good luck
~ Tim
Actually, I do not really need to pass objects. But I was used to work in java with RMI (Remote Methode Invocation), and I can''t find the same sort of API for C or C++...
[Sorry for my english, I''m french...]
quote:
Original post by wrathgame
and even then its has potential problems.
I think he means that some OS''s or compilers DWORD aligns the structs and classes so that the sizeof() does not match the actual size used.
Using the compiler directive #PRAGMA PACK (1) (in VC) before the class definition will turn this alignment off.
-------------Ban KalvinB !
I use SDL_net for my mmorpg (both on the server and on the client), and I am very pleased with it, especially because I can test the server on my machine (Win98), before putting it on the Linux server.
Height Map Editor | Eternal Lands | Fast User Directory
Height Map Editor | Eternal Lands | Fast User Directory
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement