Multiplayer Extensive Tutorial

Posted By: EpsiloN

Multiplayer Extensive Tutorial - 05/01/15 21:06

Here's a multiplayer tutorial:

Multiplayer - Extensive Tutorial

This tutorial explains more in-depth how the native Multiplayer of 3DGS works and some tips and tricks for traffic optimization.

I'm writing this as I develop this MP system for my next project. It is meant to serve as a core for MP projects and be flexible to extend further for any kind of project.
I intend to continue adding to it, to modify it for FPS and Isometric point and click (Diablo-style) and probably MMO systems.

I just finished a round-based respawning system (Counter-Strike-like) (request by a forum user) and I'll add it soon.
My next planned feature is servers list.

I hope I'll have more time to develop this. Its crazy around me.


And I hope it will help at least one person to make a MP game with 3DGS. We need more of those! laugh

Happy reading! wink

PS.: If you have any suggestions of feature requests, post them here or under the tutorial text on my page. I'd be happy to help if I have the time to implement them.

EDIT* Should I also post this in the Multiplayer section? Or anywhere else?
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 05/17/15 21:42

160 views = not a single comment.

Why the hell do I bother? This tutorial shows you THE CORRECT way to make an interpolation (something that NO BODY has ever done on these forums!!!). It also shows you a better way to pack data into a var (not binary, but decimal = 200 times more data in a single variable)...

So, this is the end of the tutorial. I will continue my game and stop updating the tutorial...Its all you get folks laugh cya...
Posted By: Reconnoiter

Re: Multiplayer Extensive Tutorial - 05/17/15 22:48

Hi, I just wanted to let you know that the only reason while I have not yet read it so far is cause I personally am not working on multiplayer at the moment (my crappy coop fps game does not count tongue ), cause it does look interesting and it is an important subject for multiplayer. So most probably good job on it. Its definitely something I will read lateron.

hf with your game laugh
Posted By: Anonymous

Re: Multiplayer Extensive Tutorial - 05/17/15 23:43

I struggled the last week or so trying to learn the multiplayer from all over the internet. I have not commented because I hope to understand what to comment about. I viewed you tutorial at least 20 times. I have not been able to modify it, Simply because I do not understand the topic at large. I did not want to comment or ask questions about your advanced tutorial when I can not seem to learn the simple stuff.

It remains in my references and hopeful one day I will have learn enough to use it correctly.

Thanks for the hard work..
Mal
Posted By: DLively

Re: Multiplayer Extensive Tutorial - 05/18/15 02:30

I'd also like to mention that I did read your tutorial once or twice to see if I could advance myself forward with multiplayer, and it seems that with some serious dedication I could learn quite a bit from this. I'm sorry I didn't take the time to thank you for your awesome contribution, I've been very busy with my website and haven't had much time for anything else.. TBH, I was actually hoping you'd make a second one to it (Or more), so when I finally understand the pre-steps, the more advanced ones will be available too.

Thank you so much for this tutorial!!!
Posted By: DLively

Re: Multiplayer Extensive Tutorial - 06/01/15 17:07

Second Tut? laugh
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/02/15 12:46

thanks for the contribution , I wil be looking it over soon , I have not used multiplayer features yet ,but I wil need to learn soon because I am busy with a new game prototype which is multiplayer based.

is there also others to start off with ,simpler to advanced ,before I get to this ?
Posted By: 3run

Re: Multiplayer Extensive Tutorial - 06/02/15 16:48

Originally Posted By: Wjbender
is there also others to start off with ,simpler to advanced ,before I get to this ?
maybe you should take a look at those AUM workshops, they are very simple. To understand the basics of the multiplayer functions.
Posted By: Superku

Re: Multiplayer Extensive Tutorial - 06/02/15 17:12

The next AUM will include a functional multiplayer code, too. It is the second and highly improved version of the first iteration from last AUM, which in turn was based on the Multiplayer tip on the GStudio wiki (the tutorial presented here by EpsiloN seems to be based on either the wiki post or the version from the last AUM, so you may want to start reading there first).
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/02/15 17:20

thanks I appreciate the advice
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/02/15 20:58

Thanks for your replies. I'm sorry if I sounded grumpy the last time.

I will continue to develop the tutorial, but its on pause for now. I have plans for great big projects (which will be added to the tut) , but it'll all have to wait until...

I'm looking for a new job, as I'm barely making a living here...

My tutorial is based on my personal experience while developing a MMO base a few years ago. Back then, the functionality of the engine was more limited, so its a little easier now. If you search the MP section, you might find our old discussions related to MMO games...

Malice, or everyone in that matter, don't be afraid to ask in a PM or email (you can find my Facebook contact info in the unofficial group) I'm always happy to help (it makes me feel a little better person in the dark days...) even with the baby-steps.

PS.: And a tip for everyone. I've sold, for 3 months, 1 copy of my game, for $4. It appears, MP is everything, when it comes to PC games. The market is flooded with SP and FREE MP games, so its very hard to make anything for a living.
I will try the Free-to-Play (in app payments) business model next...
Posted By: Reconnoiter

Re: Multiplayer Extensive Tutorial - 06/02/15 21:45

Originally Posted By: EpsiloN
PS.: And a tip for everyone. I've sold, for 3 months, 1 copy of my game, for $4. It appears, MP is everything, when it comes to PC games. The market is flooded with SP and FREE MP games, so its very hard to make anything for a living.
I will try the Free-to-Play (in app payments) business model next...
, you mean its really hard to sell multiplayer-foccused (mp heavily focussed like mmo's) or sp+multiplayer games in partical?

Do you have a link to your game? I am interested to see what it is.
Posted By: sivan

Re: Multiplayer Extensive Tutorial - 06/03/15 06:59

Originally Posted By: EpsiloN
PS.: And a tip for everyone. I've sold, for 3 months, 1 copy of my game, for $4. It appears, MP is everything, when it comes to PC games. The market is flooded with SP and FREE MP games, so its very hard to make anything for a living.
I will try the Free-to-Play (in app payments) business model next...

probably this is the reason why other engines have a facebook and paypal integration...
Posted By: DLively

Re: Multiplayer Extensive Tutorial - 06/03/15 23:58

Quote:
I will continue to develop the tutorial, but its on pause for now.
Thats fine, I'm happy to hear it will be continued laugh
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/05/15 21:27

I mean its really hard to sell Single Player Only games these days.
Unless your game is called "Grass Simulator" or "Goat Simulator" you dont stand a chance...
And, I dont think Facebook integration will help, although, there's Farmville and Stormfall... grin

I'm currently looking for a new (better paid) job, so thats why I'll delay everything.

And another tip:
Google has developed WEBP, a new image format up to 66% smaller than JPEG. It helps in Multiplayer too. The old delta sending, but for bigger things and using prediction. Look it up on Google.

PS.: My game is called The Dreamlord. I've posted it in the Showcase section. Its not much, but its what I could do with $0 budget laugh
Posted By: Anonymous

Re: Multiplayer Extensive Tutorial - 06/05/15 21:56

#EpsiloN many people are lost in MP . Perhaps you can work on other's projects by "adding MP" ( lol yes I know that's insane).
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/06/15 11:15

multiplayer can provide endless fun , I remember saying minecraft sucks ,well it does but one day I gave in playing a small multiplayer game against my sister's son ,long story short I was quickly reminded of what made games fun for me , no single player experience can live up to how real players forms the backbone of fun gaming , the prototype I am working on wil focus heavily on multi player good old funny fun'ness
Posted By: Reconnoiter

Re: Multiplayer Extensive Tutorial - 06/06/15 13:08

Originally Posted By: EpsiloN
I mean its really hard to sell Single Player Only games these days.
, this something I hear contradicting things about. E.g. on steam or review sites I see quite alot of posts of people saying they prefer if a game focuses on sp cause more work could than be put into the sp part. Though this is probably more like a niche market or only for some genres.

Originally Posted By: EpsiloN
PS.: My game is called The Dreamlord. I've posted it in the Showcase section. Its not much, but its what I could do with $0 budget laugh
, my bad, I got the impression you had published a mp game. Since you have lots of mp experience, I was interested in what you could achieve.

Originally Posted By: Wjbender
multiplayer can provide endless fun , I remember saying minecraft sucks ,well it does but one day I gave in playing a small multiplayer game against my sister's son ,long story short I was quickly reminded of what made games fun for me , no single player experience can live up to how real players forms the backbone of fun gaming , the prototype I am working on wil focus heavily on multi player good old funny fun'ness
, well ai can be really fun I think, just many games I think don't have fun ai (they tend to choose better ai over fun ai I think or are just lazy or is too hard). Anyway, for me the best mp experiences have to be oldskool coop fps games (Blood, Heretic, Unreal to a name a few). But those aren't really made anymore if you want good map design, fast run&gun gameplay, fun enemies, good music etc. etc. frown Left4Dead is the closest fun 'modern' adaption I can think off.
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/06/15 13:46

Originally Posted By: Reconnoiter
well ai can be really fun I think, just many games I think don't have fun ai (they tend to choose better ai over fun ai I think or are just lazy or is too hard). Anyway, for me the best mp experiences have to be oldskool coop fps games (Blood, Heretic, Unreal to a name a few). But those aren't really made anymore if you want good map design, fast run&gun gameplay, fun enemies, good music etc. etc. frown Left4Dead is the closest fun 'modern' adaption I can think off.


exactly , case in point , what happened to good old fun gameplay , today there's toooo much focus on art /eye candy , don't get my wrong I am definitely for eye candy , and I love many sp titles , but the those that all come to mind are mega companies wich invest so much in eye candy but totally neglect most of the replay ability aspects of sp ,when you enter mp the game completely takes off on a whole new level of unimaginable replay value , left4dead wil become a die hard classic ! , I cannot ever live up to coding an awesome sp title but I am sure I can have my players live up to providing awesome mp fun , not that drives a successful title but give them something to have fun with and they wil !
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/06/15 17:20

Perhaps the complains about the weak SP part is that most people focus on MP and implement a short and very dull SP experience.

I dont believe every game should be MP only.

I love the Half Life 2 episodes, and IMHO its the best SP experience I've had and probably will ever have!

But MP should be a part of every game (like it is a part in HL2 in my example).

And about the fun in games, I've seen a lot of indie titles that mimic old FPS like Unreal or Quake. They're fun to play, but they either cant keep you hooked for more than 2 weeks or they lack something integral in the gameplay.

I'll give you the most direct example. If you've played Killing Floor, you'll notice its extremely fun to play game and very addictive. But the addiction wears off as soon as you gain a few levels and notice you're not in charge of your character. You're there only to shoot...
If they had implemented a skill/attribute system like in Diablo 2 (which would be 2 to 3 months of additional dev time, but extreme increase in game-play) they wouldnt have lost me as a player, and neither my friends (4 players more).

This post is getting long, isnt it? laugh

As for my experience or capabilities, I can safely say I can write a MMO system. Its not very different than the small MP, you only need a few considerations on traffic and scalability before you begin.

But, last thing I promise, do you really think someone here would hire me to make the MP part? From my experience, most people here are alone, or dont have the budget, like I didnt...

If someone would hire me here, I'd offer my services all the time, because I love making games, but now, I'm forced to look for web dev job here, because my game is the first Bulgarian game in a decade! laugh I'm the only game dev here...Everyone is looking for IT specialists.
Posted By: Reconnoiter

Re: Multiplayer Extensive Tutorial - 06/06/15 18:58

Quote:
I love the Half Life 2 episodes, and IMHO its the best SP experience I've had and probably will ever have!

But MP should be a part of every game (like it is a part in HL2 in my example).
, but as you know mp takes alot time to code in a game. It's inevitable that you will sacrifice some other elements to make mp work (unless your name is Valve).

Quote:
And about the fun in games, I've seen a lot of indie titles that mimic old FPS like Unreal or Quake. They're fun to play, but they either cant keep you hooked for more than 2 weeks or they lack something integral in the gameplay.
, that's cause the old fps games had professional teams behind them, most nowadays oldskool fps indie games don't have that, so their quality is lower (except for graphics on a technical level and sometimes exceptions on other elements).

Quote:
'll give you the most direct example. If you've played Killing Floor, you'll notice its extremely fun to play game and very addictive. But the addiction wears off as soon as you gain a few levels and notice you're not in charge of your character. You're there only to shoot...
If they had implemented a skill/attribute system like in Diablo 2 (which would be 2 to 3 months of additional dev time, but extreme increase in game-play) they wouldnt have lost me as a player, and neither my friends (4 players more).
, I like Killing Floor and am on the same boat as you with the replaybility, though I don't see the connection with the rest of your post here tongue . Killing Floor is a bit shallow cause that's what people will expect to see (since it was a popular mod previously so it has alot of hardcore fans) and some people want to play something with a simple focus. If they wanted, they could have added skills and whatnot, Tripwire is fairly experienced I think and probably has the budget.

Quote:
But, last thing I promise, do you really think someone here would hire me to make the MP part? From my experience, most people here are alone, or dont have the budget, like I didnt...

If someone would hire me here, I'd offer my services all the time, because I love making games, but now, I'm forced to look for web dev job here, because my game is the first Bulgarian game in a decade! laugh I'm the only game dev here...Everyone is looking for IT specialists.
, no you got me wrong, I wanted to try a mp game of you. I did not expect people to hire you, though I wish you all the best and that they do wink .
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/06/15 20:55

Too much alcochol here, but I'll reply anyway laugh
Of course MP takes a lot, but it gives a lot in replayability. SP is the core...
I disagree about the old games, though. They werent much more professional than any of us. Its just the immersive factor playing you. Try running Quake 2 or Unreal, or Doom, and you'll notice you're used to good graphics now, and the old games just look horrible.
The imagination was a greater factor then, because of the graphics...

As for Killing Floor, I commented it to point out the weak design in MP gaming. It would have been one of the greatest in my list if I could choose my next attributes and skills...They just didnt think thats needed. Same with their next version, Killing Floor 2. Its currently in active dev, but still no choice. You get some perks to pickup, but thats it... No real game-play changing choice...
When we talk about fun in old games, this is what Killing Floor particularly lacks... choice... Havent you played Diablo 2?
And dont say they didnt had their second chance with Killing Floor 2 laugh Its (not a mod) stand alone, and they could have taken it a little further...

No, I currently dont have any MP projects published. The Dreamlord is my first finished (solely) project. It is extremely hard to build a full-scale 3D game alone. I can see the benefit of Android and 2D block-busters...

My next project (probably still solely developed) will be entirely MP concentrated with the SP integrated in the beginning as a tutorial and introduction, like in D&D Online. The core of this game is the MP Tutorial (actually the tutorial follows my development), so its a working example in some way...

If anyone has any questions/requests for features about the tutorial, feel free to ask or contact me in a PM. It is on pause, but it will definitely continue some day, refreshed!

I really want to thank you all for commenting. I feel like I've really made even a little difference in somebody's life.
I hope you master the MP part and I hope we bring this community back up, into the top 10 game engines...
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/06/15 21:27

you know what, you partly took the words out of my mouth , back then technology was not as developer's really needed it to be , so in my opinion a lot of other game factors had to be implemented more pronounced than graphics and large worlds and all the fancyness we enjoy today , but it's also a balancing act these days , developers still need to sacrifice a bit of one thing to improve another thing , I have noticed this a lot , as soon as something in a game is pushed up like graphics , the rest of the game suffers from some scaled down version of ai or whatever , it seems we can never have it all .

but at least they still sell titles , but sometimes I am amazed at what is sold .

then there's always those games that just cannot crack it as anything other than just being mp , this is what I think I want to focus on , something completely do-able as mp only , if I ever can manage good ai I would definitely go sp too , the thing is just what people expect from sp is pretty hard to really serve them , but back to point , in my opinion theres a lot of things multiplayer games can get away with , like no need for ai no need for pathfinding no need for complicated story line development no need for hordes of enemies no need for cutscenes , and well non linear gameplay comes as a bonus , basically sp and mp is apples and oranges
Posted By: Reconnoiter

Re: Multiplayer Extensive Tutorial - 06/06/15 22:11

Quote:
I disagree about the old games, though. They werent much more professional than any of us. Its just the immersive factor playing you. Try running Quake 2 or Unreal, or Doom, and you'll notice you're used to good graphics now, and the old games just look horrible.
, yes I said in my post that nowadays fps get the graphics better wink , but my point was that most of the other elements are worse. I sometimes still play an old game and sometimes I am still amazed, like the level design (e.g. the clever secrets of Jedi Knight 1 that give that "ah that's how you get to that place" feeling). Though I must say with graphics I find art direction more important than on technical level; e.g. I still like the graphics of Deus Ex.

Quote:
As for Killing Floor, I commented it to point out the weak design in MP gaming.
, and that's what I disagree with, even if I would want the same features as what you suggested for Killing Floor 2. I think its just a smart focus of them; lots of people don't want all those skills and rpg stuff, they just want blow away some zombies without to much thinking. So I can't really call it weak design, I think its more like shallow/repetive design which attracts some people.

Quote:
but it's also a balancing act these days , developers still need to sacrifice a bit of one thing to improve another thing , I have noticed this a lot , as soon as something in a game is pushed up like graphics , the rest of the game suffers from some scaled down version of ai or whatever , it seems we can never have it all .
, my quess is that's mostly a budget questions, atleast for big companies. Also to reach a larger audiance they don't want to make games to complicated and not-knowable/strange/new (== death to innovation).

Quote:
in my opinion theres a lot of things multiplayer games can get away with , like no need for ai no need for pathfinding no need for complicated story line development no need for hordes of enemies no need for cutscenes , and well non linear gameplay comes as a bonus , basically sp and mp is apples and oranges
, yeah, mp only has some big advantages if you can tackle the mp part.
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/13/15 22:46

Ok, thats where I am heading...

Drop the budget, drop the marketing, drop the design. Tackle the MP part.

Thats what this tutorial is all about, love of making things, and making things better.
If you have a dream about a MP game, start with this tut and make your way through...

The Old games were written by dreamers, they were created by people who believed in what they were creating. They were the innovators. The Apple, the Diablo, the Dungeon Siege.

It is sad, that people are aiming towards profit these days. I can understand them, I'm struggling for survival here. But its wrong. It made the market bland. Full of white noise. Just browse the Android marketplace...You'll see...

So, my stand is, read my tutorial, if you can: continue it, if you cant, wait for the next part in a few months... I desire a free MMO (without any false limitations by AI or invisible blocks, without a fixed currency and without everlasting resources, without invincible heroes). And I'm determined to make it. Even if it takes 20 years from now and 100's of projects... I believe in a Free to Play Endless MMO full of Freedom.

I hope you understand my point now.

And again, if anyone has any requests on features, feel free to drop them here or in a PM. I believe in my dream and I will work on it while I'm alive...

PS.: Alcohol is bad for your health! But it makes you believe in the impossible grin
Posted By: Anonymous

Re: Multiplayer Extensive Tutorial - 06/14/15 00:31

ok here is my first problem... The mp you are using sends keys and does dead moves..
What is a dead move - press a key it moves, unpress it stops.

May last mp attempt used drift - drift unpress a key and it slows to stop. And acceleration.

I was unable to hack your code to make this work. So my request is for real movement. Even fps shooters use a little acceleration and drift in the movement, which I assume can not be achieve by simple sending keys. Am I correct? Maybe the basics of movement and mp have not been covered well.

acceleration, drift and push(as in bumping and explosions ) are basic parts of single player code that has not been displayed in the multiplayer examples so far...
Quote:
PS.: Alcohol is bad for your health! But it makes you believe in the impossible grin
love this because I'm drunk...lol
Posted By: Ch40zzC0d3r

Re: Multiplayer Extensive Tutorial - 06/14/15 09:03

It is possible by sending only keys, but I noticed some annoying delay in the movement which lead, if abused right that the client entitiy got arround a cornor but the server entity didnt.
Also the gameplay felt kinda strange as client because hitboxes were managed by the server, so I changed the code to a simple UDP packet pos updating together with keypresses which works fantastic laugh
Posted By: Wjbender

Re: Multiplayer Extensive Tutorial - 06/14/15 10:28

as in the wise words of worms but in the form of a question ..."goodies" ??
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/14/15 10:39

I started with this movement, because my project is a top-down shooter, but I do plan a smooth movement for the next FPS addition...And a Z movement/jumping.

Until then, you can try to make it yourself, using simple key sending and modifying the movement function. The movement function just moves an entity. A simple idea is to add to it increase/decrease using a skill for every entity, saving current acceleration in it. It'll be the same (on theory) on client and server, so it shouldn't be a big change for the whole system...No need to send anything more than what is being send right now...

As for the delay and the bounding boxes, yes laugh The bb are wrong, but I was focused on the MP part, I'll fix it some day. The delay/difference is caused by latency and cannot be avoided, unless you send more often. The better solution is to include prediction. Again, some day... laugh
Posted By: WretchedSid

Re: Multiplayer Extensive Tutorial - 06/17/15 17:36

What comes to mind when reading the tutorial is that there is a big lack of the why and a lot of how. Tutorials should really try to tell users why things a the way they are and what exceptions apply and why. Throwing code at people rarely helps if you can't give them a good fundamental explanation for why the code is that way and what design you are trying to achieve.

There is an exceptionally good book about the FreeBSD kernel which explains the whole kernel from the boot process, scheduling decisions, access control, virtual filesystem, networking and so on, and the way they do it is by explaining why on earth they ended up with the design, what problems they had to face and how the implementation tries to mitigate problems that arise from a different design. And that is exactly what I'm looking for. Once I know what the challenges are and how to design an application around these challenges, I can just go through the API and get the rest together. But I can't work the other way around, have a ton of API and then try to figure out how to use it properly.
Posted By: EpsiloN

Re: Multiplayer Extensive Tutorial - 06/19/15 21:56

I see your point Sid.

Well, I'll always have the excuse, that its my first EVER tutorial grin , but...

I've been learning Java as intensive as I have the time to for the past 5 days, and from the OOP point-of-view I see I haven't explained the flow of my MP system.

I dont know if I'll have the time (going on a Java course and applying for a C++ at University) to revise the tutorial the way I want to, but if I get a chance, I will. There are some fundamentals that are missing, as you pointed out. Everything I did in the tutorial comes from personal trial and error, and I know what works and what not, with the built in methods.

Until then, if anyone is having a hard time understanding why I did something the way I did it, or why something IS working grin feel free to PM me or send me a mail at vmesechkov@gmail.com(the only frequently checked place...)

PS.: If you feel shy to PM me, a little tip. Try thinking how the whole thing works together. From start to mid-game, the processes involved in initializing the game, creating the players, and changing the whole world state... Its not difficult, its just 'extensive' laugh Its a lot of little steps taken one at a time.

PS2: Sid, I guess you deleted the topic, but I sent you my first game in a PM, as a thank you message for your help for the past years. People dont understand why you're nagging them to learn programming, but after learning the syntax of Java I understand. All I can say is, keep up the help and maybe change your method laugh
Posted By: WretchedSid

Re: Multiplayer Extensive Tutorial - 06/20/15 00:03

I have in fact not deleted the topic! I actually think I answered as well?
Anyway, thank you for the link, I would love to check it out but I'm primarily on Mac OS X and that makes it a tad tricky. But I will check it out when I'm on Windows again laugh

Edit: Wow, I just checked... Sorry! I distinctly remember writing a reply, but apparently never send it?! My bad!
© 2024 lite-C Forums