Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Bronsky

What API for network in games ?

This topic is 5562 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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...

Share this post


Link to post
Share on other sites
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

good luck

Share this post


Link to post
Share on other sites
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++...

Share this post


Link to post
Share on other sites
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.


Share this post


Link to post
Share on other sites
enet looks pretty interesting. Sorry, don''t have a link for it offhand, but Google is very useful.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!