Multiplayer Demo using ANet

Posted By: Germanunkol

Multiplayer Demo using ANet - 07/28/09 15:19

Hi. Upon request I set up a demo that shows what dark_samurai's ANet plugin can do. Since multiple people asked to see the demo, here it is in a slightly updated version.

ANet's not mine:
Note that I do not include the ANet files in the demo, as they're not mine. You can download the ANet demo to use with my code. I included a readme file in my download which explains where to get Anet and how to set up a connection.

Link:
www.caffier.net/download/MultiplayerDemo.rar
Edit: Please not that ANet.h needs to go into the includes folder as well, not the demo folder. It's wrong in the readme, my bad.

Features:
-This demo was not meant to showcase any game, please ignore the default texture and models and boring code. :P
-The demo features basic movement prediction and movement interpolation to smooth out the movement and rotation of players.
-It also shows a connection and disconnection process, a simple scoring system and shooting.
-I should say that I am not an expert in ANet-coding, I am simply a user and cannot guarantee that any of the code is 100% correct, I'm sure there are simpler ways to setup some parts of the connection. However, I did comment the functions in the code, feel free to change things.

Feedback
Would be glad about any feedback on how this works out.
I'm also available for further help, so PM me, post here, or add me to your icq, msn or yahoo account. I can try the demo with you, but I cannot start an internet-server, because my router does not allow me to, for some reason (we could never get my port-forwarding to work).
Many questions should be answered in the readme file though, so make sure to read that.
Posted By: Gumby22don

Re: Multiplayer Demo using ANet - 07/29/09 05:51

This is an excellent base to work from. Thankyou so much for contributing. I'm sure I'll refer to this as I play with trying to get multiplayer working for myself.

Don
have a great day
Posted By: Germanunkol

Re: Multiplayer Demo using ANet - 07/29/09 07:49

Glad I could help you smile

If you want to get to know multiplayer, I found it good to start with a chat application. You could use this demo as a base and put a chat function and a EVENT_RECEIVE_CHAT in.
Posted By: Germanunkol

Re: Multiplayer Demo using ANet - 07/29/09 16:15

Broozar was kind enough to host the .rar file. Updated link above.
Posted By: alpha12

Re: Multiplayer Demo using ANet - 07/30/09 01:39

hmm error...
Code:
Error in  'C:\Program Files (x86)\GStudio7\include\default.c' line 176: 'enet_get_connection' undeclared identifier
< 				anet_connection = enet_get_connection();
 >


any idea?
Posted By: darkinferno

Re: Multiplayer Demo using ANet - 07/30/09 02:57

u maye have to download default.c from the Anet website n replace the one in the GS include folder, AFTER A BACKUP OF THE ORIGINAL THAT IS!!!!!!!!!!!!!!!!!!!!!
Posted By: Germanunkol

Re: Multiplayer Demo using ANet - 07/30/09 07:39

I think you may be missing the Anet.h file, you need to copy that from the ANet demo (where the dll was) into either your 'include' folder or the folder that contains my files. Both should work.
Sorry if I didn't mention this in the readme.
Posted By: Cowabanga

Re: Multiplayer Demo using ANet - 07/30/09 13:58

Originally Posted By: darkangry
AFTER A BACKUP OF THE ORIGINAL THAT IS!!!!!!!!!!!!!!!!!!!!!
Why are you mad?? From alpha12's question??
Posted By: darkinferno

Re: Multiplayer Demo using ANet - 07/30/09 14:10

Originally Posted By: Cowabanga
Originally Posted By: darkangry
AFTER A BACKUP OF THE ORIGINAL THAT IS!!!!!!!!!!!!!!!!!!!!!
Why are you mad?? From alpha12's question??
i wasnt angry, i'm stressing that the file should be backed up
Posted By: alpha12

Re: Multiplayer Demo using ANet - 07/30/09 22:17

Originally Posted By: darkinferno
u maye have to download default.c from the Anet website n replace the one in the GS include folder, AFTER A BACKUP OF THE ORIGINAL THAT IS!!!!!!!!!!!!!!!!!!!!!
i was already did that,next time please watch your word.

Originally Posted By: Germanunkol
I think you may be missing the Anet.h file, you need to copy that from the ANet demo (where the dll was) into either your 'include' folder or the folder that contains my files. Both should work.
Sorry if I didn't mention this in the readme.

i was already copy that to your folder but error,fixed when copy to include,the ping quite high tough for local, 7ms o_0,yeah it's really good base to start on,thx again..
Posted By: Germanunkol

Re: Multiplayer Demo using ANet - 07/30/09 23:20

no problem.

darkinferno only used caps to stress that point, it wasn't meant as "screaming at you", and it's actually quite kind of him to stress the fact that a backup should be made.

Okay, thanks, I forgot that I used <> for the ANet.h instead of "", which means it has to be in the includes folder as well, sorry about that.
Posted By: Dark_samurai

Re: Multiplayer Demo using ANet - 07/31/09 08:40

Quote:
the ping quite high tough for local, 7ms o_0,yeah it's really good base to start on,thx again..


ANet uses the the ping counter of ENet and somehow it always shows 7ms. So this value isn't really correct. I think it's a avarage value of the correct ping or something like this. Sadly I still had no luck programming my own ping counter.

@Germanunkol: This is a very cool contribution. If you want, I can also host it for you and I could add a link on my site (of course I would add your name to the link wink ).
Posted By: Germanunkol

Re: Multiplayer Demo using ANet - 08/01/09 06:53

one ms is 1/1000 of a second, right?
So that's 7/1000 seconds. A game running at 60 fps has frames that "last" for 1/60 of a second.
I was surprised at the 7 ms at first, cause it never got lower than that. But if my math is correct, it can pass things many times back and forth within one frame (not that you'd ever want to). And that's only if the 7 ms is correct and it's not just the timer function that doesn't get any more exact.

dark_samurai: I'd be honored if you did! Maybe you should mention that it's a "third party" demo though, cause I still cannot quarantee for any correctness. And if you want to, change the sentence in the readme saying that Anet.h should go in the work folder to a sentencce saying it should go into includes folder, cause I wrote that wrong and I'll have a hard time changing it (it's not my server that it's hosted on atm).
Posted By: Dark_samurai

Re: Multiplayer Demo using ANet - 08/11/09 14:41

Thanks for your cooperation!

I will upload it, when I release the new version of ANet (~1 week, it's in internal beta now).

Yes I think I will create a section in the downloads called "User Contributions".
© 2024 lite-C Forums