Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Perfect multiplayer system

Author
Message
DK_
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 3rd Aug 2005 05:18 Edited at: 10th Aug 2005 04:50
[SORRY TO ANYONE WHO MAY HAVE TRIED THIS OVER THE PAST FEW DAYS TO FIND THAT IT DIDN'T WORK. BUT, ALL IS FIXED NOW AND I HAVE TESTED THE CODE POSTED HERE WITH THE HELP OF SHADOW AND IT WORKS NOW]

I have made many improvements to my code, and I think I can now say that I have created my perfect multiplayer system. This example can take you as far as it can without requiring any downloads of media or any DLL's. All you need to run this is DBPro.

This example consists of:

(1)Multiple servers on one connection.
(2)Non-Dedicated and True Dedicated hosting.
(3)Player id, coordinates, and orientation, sent via memblocks.
(4)Chat messages sent via net strings. Remote dedicated hosts can
also send and receive chat messages. Dedicated hosts, are
not counted as a player and all information is routed through
that host to increase speed of game. Note: host has option of
not being dedicated, and can therefore participate in the game.
(5)Map data stored in memblocks for loading and creating new maps
with ease. I even include a simple map maker to create maps
for use with my example multiplayer system.
(6)All maps are "SERVER SIDE". This means that only the host is
required to have a copy of the map. All clients, do not need
to have the map to play it.



Here is the multiplayer code:



It is severely commented. If you start reading it, and it seems like your not understanding it, don't get frustrated because that's how it is supposed to be. Because you may understand why a certain type of message was sent, until you get to the part where the other players use it. If you read it carefully, and read all the comments, no one should have any problem with it.

I have tested this program connecting with other comps and it works fine. But you may also, for now, test this program, by first running it and hosting, run app again and connect to yourself. If you connect to yourself, I would reccomend not making it dedicated.

Here is the map maker for you to create a simple map to test:



This is just a simple program for you to make cheap maps, for testing, it's capabilities. In my map maker, the only objects you can make are plain, cube, box, sphere, cylinder respectively. If you want more objects then that I'm sure you can figure out how to add them, but if you do use custom objects all players must own the objects, not just host.

To get started I would just first run the map maker, when it starts
press "1" then enter then following:
100
100
0
0
0
90
0
0

This will create a plain width=100 height=100 at coordinates (0,0,0)
and rotated 90 degrees on the x axis. then hit the space bar to save the map, as "test" for example.

then run the multiplayer program, host the first time and load the "test" map, then run program again and connect to yourself. You can see that when you join the server, the program never loads a map. It gets the information directly from the host.

magneto
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: who\'s asking
Posted: 3rd Aug 2005 13:08
very nice code there i might use it in my game
thx for sharing it with us.
Blazer
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: United States
Posted: 3rd Aug 2005 19:52
Thanks DK_. It worked when I connected to myself, I hope it works to other computers.

I discriminate against discriminating people....
Murdock 743
20
Years of Service
User Offline
Joined: 16th Jun 2004
Location:
Posted: 3rd Aug 2005 20:36
This is really cool. If you don't mind I would like to study this and prehaps use it...
Cheers,
Christian
DK_
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 3rd Aug 2005 21:10 Edited at: 3rd Aug 2005 21:12
Go ahead and use it all you want. That's why I posted it, to share with all. Feel free to make any changes you want to my code too, I just posted it to give people a push in the right direction.

I'm still working on it to make it better, and if I make any changes I will edit my first post, and all changes will happen there.

DK_
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 4th Aug 2005 04:01 Edited at: 7th Aug 2005 03:14
[POST DELETED] containde update to origional code. moved to first post.

Blazer
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: United States
Posted: 13th Aug 2005 00:07
have you put this in code base? if not you should

I discriminate against discriminating people....
sizer
20
Years of Service
User Offline
Joined: 11th Mar 2004
Location: texas
Posted: 31st Aug 2005 05:26
pretty sweet stuff. keep up the good work DK_.

MONKEYONAHOTTINSTATIONWAGON

Login to post a reply

Server time is: 2024-11-23 11:28:29
Your offset time is: 2024-11-23 11:28:29