Online Gaming, Basic Theory

Started by
9 comments, last by Kylotan 10 years, 11 months ago

Hi

I recently decide, with some friends, to make an online game. The questions I have may sound pretty basic to some of you but please don't sent me back to google. I have limited time and I was there the last 2 days. The bad thing with google is that you cannot converse with it. So here I am, looking someone to verify my understanding and cover some holes I have.( don't think like that you dirty people! )

When you rent some space on some server for some webpage, all you got is some space and nothing else and what you can do with that space is what you can do with the space of your PC. Save things, and possibly run some script with php to manipulate some database, which is also in that space, and/or cover some basic logic stuff. Now, I can imagine that for some very simple game I may cover my needs with php. I haven't heard this from anyone, I just figured it can be done. But, for a more complex game I may find php too weak, so I may need some real program. And then I will need to rent a whole PC?(or some "portion" of its CPU?? - you know what I mean portion ). Can I do anything I want with that PC?? And, I know there are some universally accepted architectures for servers, but with that thought, that is having in my dispossal a whole PC, I can build my server as I see fit and do whatever crazy stuff got in my head and actually work, right?? And I can use whatever language I want??

And, last, something more specific, for a game with money involved( you know, like poker or silly games on facebook) and in need for accuracy I will have to deal with 2 problems. First, I won't be able to be that accurate(I need accuracy below one second) and I will have to defend the players from cheaters.

Now, sorry for my english, I don't know exactly where the actual questions are, I just need you to say if I got all correct and where I have mistakes please correct me.

Thank you.

Advertisement
The FAQ does mention this.

In general, for full-on action games, you need to rent a whole computer (or multiple computers) to provide low-latency simulation. You either rent "self-managed" hardware that someone else puts together, or you rent space and power in a co-location facility and put in your own machine and network connectivity.

For slightly less twitch-intensive games (like RPGs or whatever) you can usually get away with renting virtual computers from places like Amazon EC2 or Linode or Rackspace or whatever.

The web-style services (PHP, Rails, whatever) typically only work for very slow turn-based games, like fantasy sports or crime syndicate simulations or whatever.
enum Bool { True, False, FileNotFound };

Thank you for your answer. Apparently I didn't search enough :)

The FAQ is pretty complete as well as your answer.

But, I would like an answer to my last question, which is more specific and the FAQ doesn't( and I didn't expect to) covers it.

So, for a game that the winner will be the one with the quickest response, in a poker-like game, I have to expect a lot of cheaters, am I?

Is there any solution to that problem? Because I can't find or think anything. Seems to me it's a online-gaming-architecture problem.

So, for a game that the winner will be the one with the quickest response, in a poker-like game, I have to expect a lot of cheaters, am I?

Is there any solution to that problem? Because I can't find or think anything. Seems to me it's a online-gaming-architecture problem.

There are ways around it, but you are always going to have a problem, Say you have 3 people playing "snap".

- Player 1 (32ms Latency)

- Player 2 (52ms Latency)

- Player 3 (23ms Latency)

In this case Player 3 will most probably receive/send his data way before Player 2, and player 2 will be in an "unwinable condition".

I would go with something like this:


Have the server send a message, timestamped (So 13:20:45) and tell the client: "Ok, at 13:21. Show the card!"

This will alleviate One side of the latency issue (Server --> Client), the other side (Client --> Server)


Client sends a message to the server "I Solved the problem in 10mx"

The server then looks at all the responses and determines the winner from the quickest solver.

This will effectively eliminate latency from the game. Of course there are ways to cheat the system, but you have to think like a cheater to beat this, and if someone used a packet sniffer, there isn't a lot you can do about it, without expensive software server side.

Seems to me it's a online-gaming-architecture problem.

Not really, more a game Design thing. If you think about the failing of the system, you can design a way to get around the problems smile.png but there are alywas going to be cheaters, just ask Blizzard, Bioware, Turbine .... RIOT, basically anyone who does Online games.

(Im not saying this is THE way to-do or the best, just a potential way around a problem)

Maybe my choice of words (online-gaming-architechture) was a poor choice, but that's what I had in mind too. I perfectly understand now. If the winner is the quickest, and the clues to that are generated in the client, there always gonna be cheaters. And if you do this on server will be unfair for the slow connections. Besides, you always know what is the best for you, unlike LOL and WOW where you have to know and the other players' choice to know what is the best for you to send. Anyway, I completly get this now.

Thank you for your time.

And if you do this on server will be unfair for the slow connections.

If you have a game where the differences in connection speeds matter, then you basically have a car race situation. In a car race, the combination of the best driver and the fastest car will win. Someone with more money will inherently have a better chance to have a faster car and thus have a chance to compensate for any small imperfections in driving skill (not to mention break down less often.)
That's the way of the world.
enum Bool { True, False, FileNotFound };

We may all be focusing more on the idea that kalkas is trying to make an MMO. Although I also assume this is what we are talking about we should also mention that you can have one of the players "host a match" on their own PC's and use your web space / PHP scripts to create a simple match making lobby that will get players together. In this case the internet server isn't very important at all, you can go with the least expensive PHP / MySQL web host you can find. You will simply be using http web requests to get a list of matches, join one, get an IP to connect to and then connecting and communicating with the host of the game (and or the other players directly).

If on the other hand your idea is an MMO type design I would have to highly recommend you save your self the heart break and ditch the idea now. This is a stance that many people will argue about but I for one believe MMO game designs should NOT be attempted by less than a small army of professional and experienced developers. Please see one of my journal entries for more information on the dirty little secrets of MMO's that many people overlook before throwing away years of their lives working on an essentially doomed from the start project.

http://www.gamedev.net/blog/1003/entry-2250963-the-truth-about-mmos/

Beyond the above hint and warning, the language and libraries you use to make the game server are highly dependant on the host machine itself. Most if not all MMO / Online Game Servers are written in C++ and hosted on Linux machines. You will need to implement many complex features yourself and there are very few packages, frameworks or engines that are built in the idea of being a strong linux based server side host for massively multiplayer games. I say this as a final warning that if you intend to make a very large game and support many players you will need to do so using one of the worlds most complex programming languages and arguably the worlds most complicated programming theories and techniques. You will need a college level understanding of networking communications, 3D mathematics, scripting executions, timing and many other things that quite simply are above many of us in the independent game development community. Yes most if not all of these points can and probably will be argued but they are still valid to the greater majority of people who attempt such a project. I ask that you don't take my or anyone elses word on this, rather spend a couple weeks doing some research yourself (and not to be rude but if you don't have the time or drive to do your research you don't have the time or drive to complete this kind of project either). After all, whats a couple weeks of research to better understand what you're getting into when beginning a 5+ year project?

Dan Mayor

Professional Programmer & Hobbyist Game Developer

Seeking team for indie development opportunities, see my classifieds post

We may all be focusing more on the idea that kalkas is trying to make an MMO. Although I also assume this is what we are talking about we should also mention that you can have one of the players "host a match" on their own PC's and use your web space / PHP scripts to create a simple match making lobby that will get players together. In this case the internet server isn't very important at all, you can go with the least expensive PHP / MySQL web host you can find. You will simply be using http web requests to get a list of matches, join one, get an IP to connect to and then connecting and communicating with the host of the game (and or the other players directly).

I believe poker is considered MMO right? Then I am trying to make an MMO. But you can't have a game with money involved be hosted by one of the players. He will be cheat his ass of!! ( I don't know if this phrase is correct :) )

Anyway, I do understand how serious is an MMO, even a simple one like poker. I wasn't "afraid" by this. I think the cost is one problem for me. And I think that you underestimate the independents community, but you're right, all this are very arguable.

I say this as a final warning that if you intend to make a very large game and support many players you will need to do so using one of the worlds most complex programming languages and arguably the worlds most complicated programming theories and techniques.

Come on, I think you are overeacting now, are you? Or should I be scared now? Seriously, I'm not being sarcastic. After I say to you that I expect a poker-order size community but it's still gonne be a card game, are you gonna respond the same?

you can't have a game with money involved be hosted by one of the players

In fact, you can't even host it yourself. Many jurisdictions require that, if you do "gambling" for real money, you host your computers in dedicated data centers that regulators have access to.
I heard second-hand that those data centers are not always up to best practices in neither things like infrastructure nor access control (!) so you may have to compromise your technical requirements to fit in there.

In general, the wisdom is that if you go into the "real money" sector, there are significant regulatory hurdles, and significant costs, like a third-party company auditing all of your gambling related code. Neither the regulators nor the auditing companies have any understanding of your own particular schedule. If you think Apple App Store approval takes a long time, waiting four months for a review of a code change is taking it to a whole new level...

most MMOs are written in C++

I would agree that many are. However, it's not a rule that you have to. Eve Online was well known for its use of Python, for example, and it did OK. You might as well say that "most AAA games are written in C++" and then not count Minecraft or Naughty Dog Lisp or UnrealScript or whatever.

Quoting the linked-at MMO skepticism article:

Graphics are one of the largest things to note about an MMO.

Tell that to the creators of Realm of the Mad God! (Or, for that matter, Maple Story.)

The truth is that if you are *truly* unique, and your idea holds water when all you do is double down on the one thing you do uniquely, and everything else is scaled down to a level you can actually manage, then you have a shot. Most newbies actually fail in the estimation of what they can reasonably manage, rather than in any particular technical area.
enum Bool { True, False, FileNotFound };

A conversation about MMO's is on par with a conversation about religion or politics. All the same let me try to address some of the follow up comments.

I believe poker is considered MMO right? Then I am trying to make an MMO. But you can't have a game with money involved be hosted by one of the players. He will be cheat his ass of!! ( I don't know if this phrase is correct smile.png )

A poker game would not be considered MMO. MMO Meaning Massively Multiplayer Online game, while a game of poker is played by what 5 - 8 people at a time? Granted there may be a million games going on at once, however each game itself is very small, slow time and easy to accomplish. This is something you could easily power from PHP scripts and HTTP web requests. Legality of running online casino's or betting games will probably fall under state and federal laws based on both the physical location of the registered company (or the individual who creates the game) as well as regulations of the state where the actual host machine resides. I would highly doubt that any federal gaming agency or financial institution would require access to the server however I am positive you will need to keep exact records of earnings and pay outs. Consult a lawyer before you even think of doing something like this as US law on gambling is different in every state. Make sure you are adhering to any and all applicable law that you are required to.

Come on, I think you are overeacting now, are you? Or should I be scared now? Seriously, I'm not being sarcastic. After I say to you that I expect a poker-order size community but it's still gonne be a card game, are you gonna respond the same?

Yes you should be scared and no I am not over reacting (in regards to an MMO). C++ is the second most complicated programming language and compilation process in the world. The first most complicated being raw assembly. I am unaware of any server side software for massive games that has ever been created in anything except C++. I believe EVE Online used python in it's client side, not the server side. Additionally you have to realize that you are undergoing two gigantic projects at the same time. A massive client game and a massive complex server that can tick control commands to potentially thousands of simultaneous players. Windows networking layer imposes an additional 10% overhead to transmissions causing it to fall on it's face when you attempt to interact with large numbers of users transmitting massive amounts of data. However to stay on topic, yes you should be scared, an MMO is virtually impossible for indie's and small teams. However this is not directly aimed at you, you are speaking of a poker game which is a small multiplayer card game. No this is not something to be afraid of.

Tell that to the creators of Realm of the Mad God! (Or, for that matter, Maple Story.)

The truth is that if you are *truly* unique, and your idea holds water when all you do is double down on the one thing you do uniquely, and everything else is scaled down to a level you can actually manage, then you have a shot. Most newbies actually fail in the estimation of what they can reasonably manage, rather than in any particular technical area.

I believe that you are focusing a bit too much on one thing but that we actually agree on the point I meant to portray. The idea I was going for is that an indie developer might make a better story line, they might make better mechanics, they might make better graphics and in most if not all cases this will be at the cost of poor quality in all other aspects. The bigger problem here is not that you are making the trade off to offer something great at the cost of poor quality in other areas but that you are doing such in a community of gaming that has been greatly spoiled with the best. We've got WoW, Rift, Terra, Battlestar Online, Star Trek Online, Star Wars (a couple of them) and many many others. These are projects that have not sacrificed one are of design for another and this is your competition. It's not like the stand alone or web based gaming markets where players have seen great and amazing and have also seen thousands of low to moderate quality games. Overall my message was intended to be that you have to bring your A game in every aspect of the design and compete with small armies of highly experienced developers to even get noticed in this market.

I'll try to end this more to the point and less of a discussion on the plausibility of creating an MMO. The OP has now made mention that the idea is a poker game. A poker game being a small game of a few players acting in turn based fashion where latency is not an issue and there really is no need for constant connections. In this instance a well scripted PHP script optionally hosted over SSL connections if security is important can easily power the game and it's something you can run very cheaply on cheap to moderate web hosts. I would suggest Host Gator or Blue Host. Both of them offer unlimited storage, bandwidth and databases with 60 seconed consecutive script run times. The idea is that you would write a few scripts, one that would act as a lobby where it would match players together to create tables (games). Once a match has started all of the players at the table would check in to the game script and the game script would then "deal" out the cards. This could be a simple process done over http web requests timed 3 seconds or so apart (or whatever value you wish).

Once the deal has gone by everyone waits for the first player to make their play. The PHP scripts would simply use a database to monitor each "table", the player machines would never have any control over the cards themselves, they would simply send bet requests (again money is held and controled on server) and discard / hit commands. The idea here is that everything would be controlled by your PHP using a Database to store game and player data. Card games are always turn based, you simply setup a ping command to perform an HTTP web request every few seconds or so that would tell the player what is going on. "Still waiting on Player 1", "Player 1 did this, Waiting on Player 2" and so on. When it is the current players turn, send their actions, get the server response and wait for everyone else. Additionally you can also have the clients connect to each other for instant chat or to expedite updates (clients tell each other "I'm done") and then query the server for card / bet status.

It would be important to note that this conversation flew way off track from what would actually apply to you kalkas. Your idea seems to be card and possibly other assorted betting games with online multiplayer options which would be completely plausible for a single person or small indie team to accomplish. With these kinds of slow turn based games PHP web hosts will be adequate to host the entire game for you upwards of thousands of players at a time. Realistically it just does not take much performance or bandwidth to calculate the outcomes of card games. My better suggestion that should apply to you is to look into building the PHP server to power the entire game, you will be most interested in "Web Services", I would recomend JSON or XML. I do quite a bit of this kind of stuff for my day job, feel free to get in contact with me if you need any further assistance, be is with hosting space, programming or just reference. Contact details are on my profile.

Dan Mayor

Professional Programmer & Hobbyist Game Developer

Seeking team for indie development opportunities, see my classifieds post

This topic is closed to new replies.

Advertisement