Sign in to follow this  
suliman

Travian-like setup?

Recommended Posts

Hi Any ideas on how to build a network game like travian (but max 10 players)? What i need is: max 10 players Server hold all gamedata and does all computing Clients can only view server gamedata and send commands (orders for example) Management gameplay only so latency not very important. I heard people speak of rakNet but i know nothing of networking and it seems all very disencouraging to me. How is games like travian made? I only know c++ but have made several games (action, turnbased-strategy, rts). Thanks for your input. Erik

Share this post


Link to post
Share on other sites
Travian is a browser based game. It is made in a web language like PHP. If you are interested in a free opensource travian like script then check out Devana - devana.eu/

With C++ you would need a stand alone client not a browser based client.

Share this post


Link to post
Share on other sites
I would build the server using some web technology, and use HTTP for transport of commands. Using RakNet is the wrong choice for that, if the gameplay is "commands only" (like Travian).

Then I'd probably write the client (2D graphics) in javascript and HTML, which let it run in any browser. Even low-end computers can now run javascript/2D fast enough for games (including platformers, space invaders, etc). Only if you need a 3D client would I use some other technology (Panda3D, C4 Engine, Unity, whatever). I'd still use HTTP for transport.

Also, remember the HTTP rules: GET for reading data, POST for writing. If your request has side effects on the server, use POST.

Every technology has HTTP request wrappers. C/C++ has libcurl, javascript has XMLHttpRequest, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by suliman
but to keep it up at all times (and players can play (send commands) 24h) i need some special host or how does that work?
I cannot just use a normal homepage i have up and running as "server" right?

E


Of course, you can use a standard webhost. Even most free webhosters offer dynamicly created websites (and "normal homepages"), most likely a PHP environment.

Share this post


Link to post
Share on other sites
All you need is a database of some sort that stores the current state of the world.

The role of the HTTP interface is to:

1) Authenticate the request (who did it come from?)
2) Enforce rules (is this request allowed?)
3) Update the world state in the database based on the request. You probably want to do this in a transaction to make sure that there are no races between multiple people trying to update the same thing at the same time.
4) Let the requester know the outcome of the command.

For small-scale games, a low-cost web host with PHP + MySQL support can totally support this. For larger scale, you want to first move to your own hosted server, and at high volumes, probably re-code the rules storage to be in-core (RAM) and store back out to a database at regular checkpoint intervals. However, to do that, it requires a persistent process, which is something you don't get from low-cost web hosts.

See the Forum FAQ for more information about hosting game servers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this