About Store Forum Documentation Contact



Post Reply 
RakNet Tutorial
Author Message
Chris Offline
Member

Post: #1
RakNet Tutorial
About RakNet Tutorial:
It's about time I updated this smile Screenshots.

This tutorial is now nearly pretty much finished.

New users: Please consider buying a license and trying the EE MMO out over RakNet, it is officially supported whereas this is not! I recommend if you insist on using RakNet, to follow the strategy I mentioned later in this post about starting from the ground up.


Features:
  • Simple Client-Server architecture which can easily be extended to Peer-to-Peer or hybrid architectures using the RakNet peer interface.
  • Server is cross-platform, using only RakNet technology.
  • Create, Register and Login to accounts.
  • Server disconnects peers who don't ping frequently.
  • Smooth Movement.
  • Chat messages.
  • Server announce messages.
  • Shared header for packet enums and structs between Client and Server "Bridge.h"
  • Lag compensation.
  • SQL & Replica additions in Zervox's release.

Download + Pre-Compiled Binaries:
Requires EsenthelEngineSDK extracted to the same directory, to share ressources (in Zervox version, extract it inside the EsenthelEngineSDK folder): Get SDK Here!

Full Client and Server Pack - Most recent Zervox Updated Version
Older Client Only - Yurcis Updated Version
Original Client + Server - Provides a basic set of features but doesn't compile with latest version.

To try it, extract the zip archive in the SAME directory as EsenthelEngineSDK (not in the SDK directory itself). You may need to build the RakNet lib yourself, if the one I compiled recently doesn't work.

Thanks to Zervox - maintaining it, adding SQL and chat GUI! smile
Thanks to Dynad - lots of long skype discussions and contribution.
Thanks to Esenthel - great engine!
Thanks to Yurci - thanks for updating
(This post was last modified: 02-22-2012 02:40 PM by Chris.)
02-05-2010 03:21 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
I'm very eager to check this out (it looks very interesting), but I'm also going away for the weekend smile
02-05-2010 03:48 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #3
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
(02-05-2010 03:48 PM)Esenthel Wrote:  I'm very eager to check this out (it looks very interesting), but I'm also going away for the weekend smile

Don't get your hopes up, it's just a start smile
02-05-2010 03:50 PM
Find all posts by this user Quote this message in a reply
Myx Offline
Member

Post: #4
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Well this most certinaly looks like an interesting idea.

I've downloaded your project and I'm currently translating it to the code standard I'm used to (I don't understand how people can use any other standard pfft). Since my style is a bit diffrent from yours I'm not sure how much help I'll be, but I'll see what I can do.
02-06-2010 05:17 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Looks good, but what i don't understand is that your server is using engine recourses. Well i made the server standalone so it stays very small in size and the most people don't care about the fancy chat boxes in the server window smile

Its just a tip!

~Dynad

There is always evil somewhere, you just have to look for it properly.
02-06-2010 06:52 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Myx Offline
Member

Post: #6
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
(02-06-2010 06:52 PM)Dynad Wrote:  Looks good, but what i don't understand is that your server is using engine recourses. Well i made the server standalone so it stays very small in size and the most people don't care about the fancy chat boxes in the server window smile

That'd do good if it was only chatting that was the matter.
However when designing a server-client game you'll want to do alot more than that on the server.
The server should probably handle things like updating projectiles, syncing animations, add/remove items etc.

Basicly the server is just a regular game, but instead of drawing functions it has networking functions that sends out all required data.
02-06-2010 07:35 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #7
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Yes, u don't have to explain to me how a client/server works. What i was trying to say is if u ever have worked with Linux hosting servers they don't have a GUI just an console and thats all what i need for a server.

~Dynad

There is always evil somewhere, you just have to look for it properly.
02-07-2010 12:36 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #8
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Just got back from a lovely weekend away smile

Thank you both for your comments. I agree with both of you; in a real game you want a light-weight server which can run on Linux for the general reduced hosting packages (or both platforms even better if extended to multi-server). But also you need maths classes for calculating physics, trajectories, and such.

I think the style in which you write the server, and the libraries you use, largely reflects upon the type of game.

A quake-like peer-to-peer game will probably want the server to be part of the client, which will include EE. Another, more large-scale case of this scenario, is with peer-to-peer economyless virtual environments, for example a node partitioning framework like VAST or http://www.solipsis.org

A client-> multi-server MMO will want an extremely light-weight cross-platform cluster of servers, which probably will want only RakNet, and perhaps a couple of math headers, and some very sophisticated load-balancing tools.

In the case of a tutorial, I thought it best just to provide a demo which is "what you see is what you get" which doesn't require additional libraries or more vector maths headers. This is the very reason I chose to integrate the server directly with EE; to keep it easy to understand for the beginner, reusing the EE style on later physics classes, and having made that decision I figured I may as well make a fancy GUI (although it's not very fancy pfft), which is part of EE anyway.

I completely agree Dynad, you almost never need fancy gui's on servers - especially if their mmo's.

From a design perspective, is there anything people can help me improve? Else I'll just try and tidy it more this week (it's only had about a nights work so far), perhaps mentioning more on different game architectures in the comments.
(This post was last modified: 02-07-2010 04:11 PM by Chris.)
02-07-2010 04:07 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #9
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
But a few points about design.

- I just looked over the server files, chat and server related stuff in 1 file? perhaps its just a begin.

- Custom Message identifiers.
- #ifdef _WIN32 is not really needed cause the engine is only working on Windows(without d3d9 maybe possible on other OS)
- Backup and restore?? what are u saving? For account purpose with lvling i can understand.
- Physics whats your plan how to implement those?
- Please use a map for the players, its kinda slow if u use the single normal containers. e.g std::map<SystemAddress, Player*> players; (there is a map tut)
- Lag compensation (In player demo Ogre3d has something like that already with the movement)

Thats all for now atm,

~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 02-10-2010 05:07 PM by Dynad.)
02-10-2010 05:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #10
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Thanks Dynad, that's helpful, it's just a start - i'm hoping others can help improve it with me. With Physics I was thinking of doing something similar to this: http://gafferongames.com/game-physics/ne...d-physics/
I wanted a registration and login system, mainly because player demo doesn't seem to cover secure logins very well - doesn't it just check if they all have the same master server password? Backup was just quickly stolen from an EE tut, I was going to backup the accounts (their login strings and passwords), just as a proof of concept, as it wasn't much code. Hehe, I stuck the "need a map" in my code comments pfft - I literally just whacked this together so that it'd compile.

I really appreciate your current help.
02-10-2010 05:39 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #11
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Yea the player demo is only checking on main server password and user name size.
Register can maybe done in XML? its fast and easy to implement. For huge servers SQL db would be the best choice but more work to implement.

If i am remember correctly there is an Raknet encryption example, could be handy against hackers, memory reading etc.

ps: the site with physics would be a nice start

~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 02-10-2010 06:07 PM by Dynad.)
02-10-2010 05:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #12
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
XML sounds like a pretty cool idea, yeah with SQL I want to avoid throwing too much at people who may not use it in their projects, e.g. with a simple peer-to-peer LAN game.
02-10-2010 06:10 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #13
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Ok well you can use tinyXML its free of charge as well for commercial. Its faster then writing your own XML builder smile

SQL is perhaps little too far for a tutorial indeed maybe in the future for advanced tutorials.

For this tutorial is a 8 vs 8 game with a simple scoreboard a great beginning.

With simple actions e.g sword/club attack is not too complicated. (u can use the human warrior for that)

~Dynad

There is always evil somewhere, you just have to look for it properly.
02-10-2010 06:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #14
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
I like the idea of adding some simple actions like a scoreboard and an attack. Especially if we can keep everything simple and small.
02-10-2010 06:35 PM
Find all posts by this user Quote this message in a reply
blackmoridin Offline
Member

Post: #15
RE: RakNet Tutorial (Work In Progress, Help Appreciated)
Hi uhmmm
i looked at the demo, and i can't seem to get 2 pc's to connect on the same server and login on 2 pc's on the same network, anything i might be doing wrong ???
03-04-2010 12:48 PM
Find all posts by this user Quote this message in a reply
Post Reply