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.


July 24th, 2011 - 13:44
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)
July 25th, 2011 - 13:01
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)
July 25th, 2011 - 00:23
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.
July 25th, 2011 - 13:02
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.
July 25th, 2011 - 19:00
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
July 27th, 2011 - 15:06
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);
}
}
July 29th, 2011 - 22:01
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);
}
}
July 29th, 2011 - 22:02
Nevermind, it won’t indent…. Try pastebin: http://pastebin.com/Ftyq6Ydu
July 30th, 2011 - 10:36
The code is indented. WordPress just isn’t code friendly. The comments at least aren’t.
July 30th, 2011 - 15:32
ah, nevermind then.
Also, i suggest instead of MySQLi to do pdo_mysql. That seems to be the main focus of the PHP team now.
July 28th, 2011 - 17:01
congratz con the degree.
really looking forward to see your game online
July 28th, 2011 - 21:11
Hello and congratulations for you degree… Although I think that your real degree is Devana itself!
Does anyone have the whole grotta script?
July 29th, 2011 - 11:43
When will version 2?
August 9th, 2011 - 05:12
i am trying to install it but i don`t know why its not working:(
August 24th, 2011 - 08:18
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.
August 24th, 2011 - 08:29
Sorry, do not delete the users table. Delete only the userdata.
Devland, why do you store the map data in the database?
Tribalwars uses an algorythm for map generation, and not store the data in the database. Only store the villages data.
August 24th, 2011 - 18:55
Actually, it should look like this:
$db->query(“insert into grid (x, y, type, id) values (“.$i.”, “.$j.”, “.$sectorType.”, “.$sectorId.”)”);
Thanks for letting me know about this.
September 2nd, 2011 - 20:45
http://pastebin.com/uuzBrYvB
Here is the algorythm. You can play it with this logic. But need a rewrite first
August 28th, 2011 - 19:35
Why can’t i edit things in my town =P?
December 8th, 2011 - 10:57
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
December 15th, 2011 - 21:43
and when you can expect DEVANA II
December 26th, 2011 - 21:04
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!
March 18th, 2012 - 08:46
You have a few useful pointers on this site. This is a well written article that I have bookmarked for future reference. Have a great day
April 4th, 2012 - 10:48
@ 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.