Due to excessive spam bot posts the forum is going offline.
I am very sorry for those who used the board for mods, but I just cannot keep cleaning up after people who just do not appreciate such mediums. It's a real shame, as phpBB is really good.
The forum will reemerge once devana 2.0 nears completion and it will use code written by myself since that is the only way to prevent spam bot abuse.
I had a school assignment for today. Some algorithm optimization using Newton's discrete method.
The fun thing is that I got to display f(x, y) type functions in 3D space. I chose to do so using the new webGL draft from the html5 suite.
It was a whole lot of fun making it. A colleague created Newton's method code while I just wrote the 3D rendering stuff.
Here's the link: http://devana.eu/misc/newton/newton.html
Keep in mind that since this is a very new draft (v1.0 released on March 3, 2011), not all browsers currently support it.
At the time this post was written, the script was tested and worked on Chrome and Firefox 4 Beta. It might also work in Safari, but It needs testing.
This will surely be a thing of the future as I'm sure lots of great games/applications will be made using it. Even more once the support across browsers will be wide spread.
Make sure to first press "compute" and then "draw" for the script to work properly.
Also, here is a set of functions I used to test this script:
Math.pow(x, 2)-Math.pow(y, 2)
Math.pow(1-x, 2)+100*Math.pow(y-Math.pow(x, 2),2)
For the last one to display properly, use a "z scale" value of 0.0007 as that function conjures high Z values and they won't show up nicely with the default 1 "Z scale".
It's been a while since the last update. Busy have I been. 😛
2. I've moved the game configuration variables from the database to a php file.
It currently isn't finished, since I have to add all the units, buildings in it, but it has a few entries added to illustrate it's functionality.
The labels have also been moved to a php file instead of being stored in the database.
3. I've worked on the database structure a bit as well. See the attached zip file for the current structure.
the files so far: devana.zip
I've finished the database structure for the economical part of the game; that includes module construction, resource management and various costs and requirements.
The multilingual system now includes a database side for the game assets localization. All asset names and descriptions will be stored in the labels table.
The labels are identified by type (numeric value that identifies which asset type it represents), id (asset id) and language (language id defined in each language's file in the languages folder).
Each faction has max values for how many nodes and modules (per node) one player can have. The faction type is assigned to each node.
Nodes have a lastCheck value, defined as a datetime type which indicates the last time the game has calculated the resource production values and other queue related calculations like module construction, unit training, ...
Modules are divided into types, based on what function they will have. The main mechanic is that modules require a static resource type, a resource type that cannot be produced, but exists in finite quantity. Think of modules as machines that require energy to produce stuff; where the energy is the static resource type, and the "stuff" is the dynamic resource type. Dynamic resources can be stored.
Each module requires an input (the static resource type), a maxInput value and a ratio. The ratio is an unsigned floating point number that defines the output based on the input using the following formula: output = input*ratio; the output is a "per hour" value.
The game determines the output type based on what entry the "module" column one resource type has.
0 is for static resources, while any other unsigned int designates the id of the module where that resource is to be produced.
Resources also have a max storage value.
The dynamic resources are stored as values in the resource_storage table, per node, and per resource type. And yes, static resources do not have entries there.
Free static resources are determined by the following formula: their maxStorage value minus all input values from all modules that require them as input.
Modules slots are stored in the module_slots table, with an assigned value for the module's required input. These entries are defined per module and per node.
Costs are stored in the costs table. The costs are defined per type (module, item, unit, ...), id (be it moduleId, unitId, ...) and faction. Each entry has a (dynamic) resource type defined and the value of that resource type required.
One can define costs as being comprised of 1 or more cost entries; 1 for each required resource type.
Example: there will b 3 entries in the costs table if the sword item costs 3 lumber, 5 steel and 10 gold.
Requirements are stored in the requirements table. The requirements are defined per type (module, item, unit, ...) and id (be it moduleId, unitId, ...). Each entry has a value associated to it depicting the id of the required type.
One can define requirements as being comprised of 1 or more requirement entries; 1 for each required requirement type.
Example: there will be 2 entries in the requirements table if the barracks module requires the blacksmith and mill modules.
And here's the sql structure: economyStructure
I've finished the grid view.
It is based on AJAX, meaning that no page refresh is required to move about the grid.
It will need some tweaks once the nodes (towns) come into place.
And here are the files: devanaFiles.zip
The grid is the game's map. I didn't name it "map" because the game will eventually allow users to modify it to such a degree that they will be able to create other types of games in which the term "map" may or not be suitable. So I've named it "grid".
I've also created the install page of the game, where the admin account is created and the grid data is inserted into the database.
The grid data is taken from a png image where each pixel is a grid sector. The color coding is as follows:
blue [RGB: 0, 0, 255] is the blocked type of sector; [water]
green [RGB: 0, 255, 0] is the active sector; [available for building towns, or as I call them, "nodes"]
The grid table has the following columns:
x is the horizontal grid coordinate; on the image it goes from left to right passing through the 0 and imageWidth-1 values;
y is the vertical grid coordinate; on the image it goes from top to bottom passing through the 0 and imageHeight-1 values;
type is the grid sector type identifier;
-> 0 for the blocked type of sector [blue pixels]
-> 1 for the active sector [green pixels]
-> 2 will be for constructed nodes [towns]
id is the image tile identifier if the type is not 2; if the type is 2, then the id is the node id from the nodes table.
And here are the files so far: devanaFiles
Lots of people said that Devana 1.x.x has messy code and an ugly UI. They were right.
So, a while ago, before starting work on Devana 2.0, I created 2 small projects.
The first was tap4.net which today became open source. It helped me learn more about HTML, CSS and it also started the template system that I'm currently using in Devana 2.0.
The code is a bit messy, but fully functional.
As one would do with all web-based projects, the start is very important. This is when you define your core rules that will later on influence the whole project. So spending some time thinking on how these rules should be is beneficial.
Now, to clear things, I don't consider myself a programming guru, so some things you might read here might seem, or frankly be, outrageous; I don't use frameworks, so no jQuery or any of that stuff.
I use a basic template system in which each displayed page is made out of 2 separate php pages: 1 page handles data processing while the other handles the way that data is displayed.
There also is a default.css file for each template that governs over the form of the various html objects. Each object type has it's own CSS class.
A config.php file handles the MySQL database connection. There are a header.php, footer.php which generate the menus and other header/footer stuff.
There also is multilingual support. This also is basic. There is a php file for each supported language; that file contains an array of labels. The labels change according to the language, while their identifiers stay the same across all language files.
To show various messages I use a special div, which is displayed only when a php variable ($msg) is not null.
The ids of database entries are also automatically managed, so that no gaps are created when deleting entries. Instead, the ids of deleted entries are stored in a free_ids table so that they will be used the next time entries are added to that table.
Also, I manage concurrent write attempts made to the database via table lock.
Here are the files so far. Account registration & login are working. devanaFiles
Welcome to the development blog of Devana 2.0, a "when it's done" to be released browser based open source game.
To check out the current version, go to the sf.net Devana page.