Devana how a browser game is made

24Jul/1134

onward

I've changed the MySQL storage engine from MyISAM to InnoDB so I can use transactions to provide atomicity to the game's actions. In conjunction with the serializable isolation level they allow me to control concurrent actions performed on the database.

Nodes (towns) can now be created and moved periodically (there is a cool-down timer). The movement feature can be turned on/off according to the game's gameplay conventions. For the default medieval setting of the game this feature will be turned off.
A simple admin panel has been added to allow admin editing of the game's flag variables. They allow core features like login and register to be turned on/off.

And here are the files so far: devana.zip
Note that the files now come with a license so read that before reading the code.

More work is to be done soon (the following weeks) as I have now got my college degree; I am now officially a computer software engineer. :)

Filed under: devana Leave a comment
Comments (34) Trackbacks (0)
  1. Looking foward to create a great 3D map AddOn for Devana 2
    Maybe you should contact me for the 3D modeling of the buildings (then to be exported to png)

    • All the better. I was actually looking for some royalty free building images.
      Should you choose to contribute you will be added to the credits page.
      Post a link here with some samples, or contact me via twitter. (link in the about page)

  2. Great stuff man, and congrats on your degree. Im shittin myself with anticipation.
    Further on if i get some free time off work, if you want i can create a new basic mediavalish interface for the releases (for all those that dont want to create their own and just run a little server). http://3agled.deviantart.com/art/Age-Of-Blood-142318986?q=boost%3Apopular%203aGLeD&qo=3 i made a while ago.

    • I love it when people contribute. It makes all the effort gone into the project worth it.
      I’ll be using a simple template, no fancy stuff. The template system already allows for custom templates and I’m sure there will be lots of those after the release.

  3. You need to change the database engine from MySQL to MySQLi or pdo_mysql. Please see this news article on php.net http://news.php.net/php.internals/53799

    • Done.

      class db
      {
      private $db;
      public function create($dbHost, $dbUser, $dbPass, $dbName)
      {
      $this->db=new mysqli($dbHost, $dbUser, $dbPass, $dbName);
      if ($this->db->connect_error) die(“Connect Error (“.$this->db->connect_errno .”) “.$mysqli->connect_error);
      //mysql_query(“set global transaction isolation level serializable”, $this->db);
      }
      public function query($query)
      {
      return $this->db->query($query);
      }
      public static function fetch($result)
      {
      return $result->fetch_array(MYSQLI_ASSOC);
      }
      public function real_escape_string($string)
      {
      return $this->db->real_escape_string($string);
      }
      }

      • You also need to indent your code.

        Like this:

        class db
        {
        private $db;
        public function create($dbHost, $dbUser, $dbPass, $dbName)
        {
        $this->db=new mysqli($dbHost, $dbUser, $dbPass, $dbName);
        if ($this->db->connect_error) die(“Connect Error (“.$this->db->connect_errno .”) “.$mysqli->connect_error);

        }

        public function query($query)
        {
        return $this->db->query($query);
        }

        public static function fetch($result)
        {
        return $result->fetch_array(MYSQLI_ASSOC);
        }

        public function real_escape_string($string)
        {
        return $this->db->real_escape_string($string);
        }
        }

  4. congratz con the degree.
    really looking forward to see your game online

  5. Hello and congratulations for you degree… Although I think that your real degree is Devana itself!
    Does anyone have the whole grotta script?

  6. When will version 2?

  7. i am trying to install it but i don`t know why its not working:(

  8. In the install.php, at line 34. replace this:

    mysql_query($query, $db_id);

    to:

    mysql_query($query);

    If you already installed, delete the users table in mysql, and reinstall.

  9. Why can’t i edit things in my town =P?

  10. Hi, thank for the files.
    Question: I install v 1.6.6, these files should be just put (copy) on the www folder? is there some action to upgrade or just copy?
    Thank

  11. and when you can expect DEVANA II

  12. Hi, i’m also waiting for Devana 2.
    i have also some more ideas for the game.
    Maby you can make a better admin pannel, where we can better see everything we can do.
    and a function where we can choose on what speed the game is playing. (the normal speed is very slow i think)

    I hope to here from you soon.

    Thanks for the great script!

  13. @ Guus
    “Ma[y]b[e] you can make a better admin panel”
    You could try being a bit more inventive with your suggestion. I am sure he is already planning a better admin panel and what he has included is just to help admins in the mean time. Also when othering such a mundane suggestion, it is customary to present some information to help along with the request.

    @extrm
    “[A]nd when [can we] expect D[vana] II”
    Unless you are activly contributing to the project, and I dont mean donating the odd pence here and there, although don’t get me wrong that helps, but what I rather mean is that you are paying him a preagreed amount for him to create this code for you. Then please satisfy my curiosity and tell me what gives you the right to constantly beg “Devland” for this game. Here is doing this project in his spare time and by himself. Give the man a break.

    @Devland
    I am currently working on my own game, although I am less of an opensource man than you are. I think this game is brilliant, especially considering you are doing this on your own, I don’t know how you put up with these people. Although you probably do a much better job of ignoring them than I do.

    If I happen to make some artwork that would suit your game more than mine I’ll make sure to send it your way.

  14. Game has a lot of potential, nicely done that man.

    Installed 1.6.6 without a problem and gonna play around with the code, template etc.

    I just wanted a simple web browser game similar to this for my community site.

    I’m going to integrate the Database with Joomla so their stats etc show up in their Joomla profile.

  15. xxxxxx.comVery interesting domain

  16. I’ve read some excellent stuff here. Definitely value
    bookmarking for revisiting. I surprise how
    much effort you put to make this type of excellent informative site.

  17. I recently installed devana-v2_beta-1, this went without a hitch, although I did have to make a small adjustment in the SQL file, nothing major. The game is up and running, all I need now are the players. I was thinking of changing the theme for something more personal, other then that, I’ll wait and see what the players think of the game. I’d like to thank the makers of the game, its a great piece of work.

    Greets
    Tony

  18. Sorry for my bad English.Helpful info. Fortunate me I found your site by accident, and I’m surprised why this twist of fate didn’t took place in advance! I bookmarked it.

  19. I sorry for bad English.I would like to thx for the efforts you’ve put in writing this website. I am hoping the same high-grade web site post from you in the upcoming also. Actually your creative writing skills has encouraged me to get my own web site now. Actually the blogging is spreading its wings fast. Your write up is a good example of it.

  20. Sorry for my English.Hello. splendid job. I did not anticipate this. This is a splendid story. Thanks!

  21. Sorry for my English.Excellent read, I just passed this onto a colleague who was doing a little research on that. And he just bought me lunch since I found it for him smile Therefore let me rephrase that: Thanks for lunch!

  22. English not my native language.My husband and I got absolutely thrilled when Raymond managed to round up his research from the ideas he came across through the web pages. It’s not at all simplistic just to always be offering tactics which usually the rest have been making money from. We really acknowledge we now have the writer to give thanks to for that. The most important explanations you have made, the easy website menu, the friendships your site make it easier to create – it’s many spectacular, and it’s facilitating our son and the family reckon that this situation is brilliant, which is certainly particularly pressing. Thanks for the whole lot!

  23. I sorry not speak good English.Keep functioning ,great job!

  24. I was examining some of your posts on this internet site and I think this web site is really informative.


Leave a comment

No trackbacks yet.