On Fri, May 21, 2010 at 2:07 PM, ravishi <[email protected]> wrote: > Hello everyone, > > I am getting started in android development and I really want to > create some form of online game. My goal is to start out with a turn- > based game and move onto advanced multiplayer games. I want to have > users associated with their google account, provide some sort of > matchmaking to pair people together, have their stats stored in a > database, and use the stats for various leaderboards and such. I have > read over an older discussion on this list at > http://www.mail-archive.com/[email protected]/msg75993.html > . There was a lot of good information that I gathered but I still > have some questions. What I have so far is an apache web server on a > laptop that I don't need right now (2.0Ghz Core 2, 3GB Ram). > > I have never really used Java (although I'm learning it for android), > but I know C/C++, Perl, and Python. I am in the process of learning > mysql databases, which will help with a lot of the stats features I > want to implement. I have built a HTTP/1.1 persistent server in C > before which did JSON parsing and used a threadpool so I am somewhat > familiar with the low-level network calls needed. However, I'm > thinking that a free server software must exist that would offer more > security and better load-balancing than the server I created. One > solution I am thinking is to just use the Apache web server, have > android make a request to a perl module I create on the server, and > then have the server look it up on a database and so forth. Then the > server will just keep sending back the player locations or whatever. > Will the Apache web server slow me down for what I am trying to do or > I am looking at everything the wrong way? Are there some settings in > Apache that I could tweak to give me better latency such as persistent > connections? >
Well, the first thing you'll want to figure out is, if your set up will be fast enough for your game. Since you're making a turn based game, you have some wiggle room. How are you tying the perl module to apache? Via mod_perl? How is your game communicating with the server? Via a RESTful interface, or via a persistent connection sending packets back and forth? How many players do you expect to be playing at once, is scalability important? Apache is typically a web server, I'm not sure how capable it is for handling persistent connections. I think it would be simple to make a barebones perl server using some well tested module, perhaps something that ties into libraries/mechanisms that allow for scaling. (i.e. hook into a database like mysql, or message queue service like beanstalk) A persistent server in C would be really fast and efficient, but how 'sharded' can your game be? There's only so much memory a single C program can hold, so there will be a limit on active players per server. Unless you find a way to communicate/share information between them. However, at this point your server will be bottlenecked in reading data from a database or file instead of directly from memory, so at this point the speed gained from the raw C is irrelevant. You might as well have scripted it. A server in perl will be fast and easy to code, but how fast will it be. You can also use something like Scala, I don't have any experience with it myself. But it apparently makes writing scalable applications easy. I personally use Erlang/Perl. Since you're worried about load balancing you can skip the apache load balancing mechanism. (which I haven't had good experience with) and use something that's fast like http://kb.linuxvirtualserver.org/wiki/IPVS. You can then have a load balancing machine that balances traffic between your intranet servers. Of course, the real question here is how will those server communicate with each other/share data. What kind of security are you looking for here? It depends at what level you're handling data, in my experience working with Perl is very safe, (i.e. automatic checks when writing to database, etc.) So, I think it mostly depends on your needs and what coding style you're aiming for. I'd say figure that out first. Then, set up your environment and run some basic metrics test. How long does it take for one packet to go from the client, to the server, and back to the client? How long does it take to read from the database? You don't really need to go all out and measure every thing, just rough metrics. Don't overtune it yet. > I assume I will be using android.net for a lot of the client side. > Are there some good client examples that anyone knows of? > android.net doesn't seem to be a valid site. Again, not sure what kind of client example you mean, but I haven't come across a full features multi-player open source android game yet. Anyway, just adding my 2 cents based on my experience, hope it helps in some way. Miguel. > I appreciate anyone that can give me advice or point me to more > information. > > Thanks, > Ravi > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- http://diastrofunk.com, http://developingthedream.blogspot.com/, http://www.youtube.com/user/revoltingx, ~Isaiah 55:8-9 -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

