Travian-like setup?
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
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.
With C++ you would need a stand alone client not a browser based client.
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.<br><br>Also, remember the HTTP rules: GET for reading data, POST for writing. If your request has side effects on the server, use POST.<br><br>Every technology has HTTP request wrappers. C/C++ has libcurl, javascript has XMLHttpRequest, etc.<br>
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.<br><br>Also, remember the HTTP rules: GET for reading data, POST for writing. If your request has side effects on the server, use POST.<br><br>Every technology has HTTP request wrappers. C/C++ has libcurl, javascript has XMLHttpRequest, etc.<br>
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
I cannot just use a normal homepage i have up and running as "server" right?
E
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement