androidopengl-esclientmmo

2d android mmorpg game


I want to make an mmorpg game and i wanted to know some things before i start,
well, first of all, I know how to make games for android and i have been using canvas, opengl es 1.0/1.1 and some andengine(also opengl es 1.0/1.1). I wanted to know what i should use for a good reliable and fast mmorpg, is there any other option for a better performance?

the game is targeted only for android at the moment, i am using the android sdk and eclipse to program my game.

also, where can I learn how to make a proper client and server? because i have never had any experience with that. Untill now i had only made 2d and some 3d games, none of them were online or any kind of mmo.

if it is needed, i also have some sql and php experience from website developing. i had worked with PhpMyAdmin for my website.

Thanks!


Solution

  • I think you should use the NDK. Write your program in C as opposed to C++ for easier project management. You should consider using libevent for asynchronous request processing. Don't use PHP for web interfaces, Python is much better at this point. C is the best solution if you're willing to get dirty.

    For developing sockets, I'd say you should use POSIX sockets - the industry standard. Later you should check out more advanced solutions like ZeroMQ. Use PostgreSQL/*MongoDB* depending on your requirements. Those are really advanced database management systems where you'll definitely find less overhaul then in, say, MySQL. I'd say MongoDB will fit the cause better - it's faster but doesn't feature full support for ACID data.

    You should learn what you need for sockets programming in the MAN pages in any online/offline documentation base. It's not that hard. Here's a server example in C, study it, try to write your own client implementation, understand the basic principle of TCP/IP packet abstraction (by the way, this is a TCP socket, you should check out UDP examples, those are way more relevant for your project):

    /*
    "Arch_server" - a basic server program in C
    Copyright © Juozas Domarkas 2012, all rights served
    */
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    #include <strings.h>
    #include <unistd.h>
    
    void respond(int socket);
    
    void error(char *msg)
    {
        perror(msg);
        exit(1);
    }
    
    int main
    (int argc, char *argv[])
    {
        int socket_server_fd, socket_client_fd, pid;
        socklen_t client_address_length;
        struct sockaddr_in server_address, client_address;
    
        if (argc != 3)
            error("Correct usage: server [host] [port]\n");
    
        socket_server_fd = socket(AF_INET, SOCK_STREAM, 0);
    
        bzero(&server_address, sizeof(server_address));
        server_address.sin_family = AF_INET;
        server_address.sin_addr.s_addr = INADDR_ANY;
        server_address.sin_port = htons(atoi(argv[2]));
    
        bind(socket_server_fd, (const struct sockaddr *) &server_address, sizeof(server_address));
    
        listen(socket_server_fd, 16);
        client_address_length = sizeof(client_address);
    
        while (1) {
            socket_client_fd = accept(socket_server_fd, (struct sockaddr *) &client_address, &client_address_length);
            pid = fork();
            if (pid == 0) {
                close(socket_server_fd);
                respond(socket_client_fd);
                exit(0);
            }
        }
    
        return EXIT_SUCCESS;
    }
    
    void respond
    (int socket)
    {
        int n;
        char buffer[1024];
    
        bzero(buffer, 1024);
        n = recv(socket, buffer, 1023, 0);
        if (n < 0) error("ERROR reading from socket");
        printf("Here is the message: %s\n", buffer);
        n = send(socket,"Message received.", 17, 0);
        if (n < 0) error("ERROR writing to socket");
    }
    

    Depending on your experience, you should either write your server suite or use existing solutions. I recommend giving yourself a decent deadline (say, 8 months) and writing ALL the "HIGHER LEVEL" tools yourself. That way you'll get the most out of your project. Try to write them as basic as possible. Use low level existing solutions for better performance, study them, learn something from the 31337 h2x0r5.

    Definitely check out OGRE 3D instead of GL/ES. It's an abstraction library for OpenGL. Much easier than OpenGL, better support for modern 3D development, libraries, plugins, all sorts of already developed particle, locomotion, sky/water systems.

    Do not go for something like Unity3D. You have better things to do.


    The best book to learn real C programming is "The C programming language" by Dennis M. Ritchie and Brian W. Kernighan.

    Google has a lot of tutorials for Android development regarding the NDK. Definitely use the NDK. Java has good support for 3D graphics but it really isn't the right tool for the job. It's a 'niche' solution, not an industry accepted standard in game development. Regarding that, the industry uses C++ for game development. I'd seriously recommend using ONE language for the whole product life cycle. You'll need a networking server, database interface, hooks... Use C. With C++ you'll get way too much overhaul. You'll end up learning BOOST, STL, all that other crap that comes with C++. Better use C, libevent, OGRE 3D, some existing OGRE systems. All those projects have good solid documentation and are ready for prime-time use.

    Ogre3D is intended for 3D games. You can make a "2D platform" game with it. One extra dimension isn't really that much to learn.

    Learn each platform one-by-one. Don't read "all-in-one" books.

    Check out the documentation of those projects.


    Seeing as you have a lot of free time on your hands, better make yourself firstly a good plan. Organize yourself, your thoughts in one manner and try to reach for the "goal". It's really realistic to finish your MMO in, say, 4 to 5 years. That's how long it mostly takes for professionals and sometimes even indies.

    Be persistent, learn something new each day, try to write code each day. Work towards ONE goal - your game. If some other project comes up - postpone it. Be a pragmatic programmer. Don't be afraid to get dirty. Take a couple of days per month off for your title, don't go to school (don't drop it!!!). Be persistent.


    I hate doing this, but choosing a compiler, tool, platform, language is pure politics. I prefer "the best tool for the job", similarly to Linus Torvalds. I mostly use open source software since it does the job better. When it comes to "GPL" vs "BSD" or restrictive versus permissive software licenses, I definitely choose BSD, simply because I believe in free software versus somewhat "socially free".

    A good compiler, in my opinion, would be CLANG from Apple's LLVM compiler collection.