Devana how a browser game is made

19Sep/1014

getting started

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.

The code is written in an object oriented manner, using an array to store the data from the database. All the classes are stored in core.php. core.js will hold the various JavaScript functions used across the pages.

Here are the files so far. Account registration & login are working. devanaFiles

Comments (14) Trackbacks (1979)
  1. Keep up the good job ;)

    I do not know that you’ll start from zero, all the dev work…

    I’m making a new visual to version 1.6.6 and soon I will launch the game to my testers community ;)

    I’m waiting to the 2.0 version… ;) One sugestion: Have comments to most complex structures and code ;)

    Keep it up… and good luck

  2. I love this blog so far :) Thumb up for Devana!

  3. Great Dude, I Will always Praise You :D

  4. i got to say i dont like the way you call your headers and footers. Headers should be called prior to ANY html. the should be within the header

  5. I dont like the way you call your headers.

    You call it like:

    <?php echo "”; ?>

    testing…

    Thats a sloppy way of calling headers/footers.

    It should be:

    testing…

  6. As I said, I’m not a guru. :P

  7. Well, i would suggest calling the header file prior to any HTML being outputted. This would allow you to use header redirects w/o getting any errors on most servers.

    On servers, such as mine, when there is an output prior to a header, you would get the error ”
    Warning: Cannot modify header information – headers already sent by (output started at /path/to/file.php:581) in /path/to/file.php on line 180″

    Which, i’m sure you would agree, would be a problem

    • I toke that under consideration after you or somebody else proposed it, and if you look at the files attached to the latest blog post, you’ll see that I’ve added the header.php and footer.php files.

      PS: I really appreciate these suggestions/comments. They’re helping make the game a better one. :)

  8. excellent, but please work the hours and times in seconds! : D (unix or epoch format) is much easier and is the most accurate calculation for ajax work.

  9. Hi, good job, but does the sitter login work?

  10. The sitter feature will no longer be implemented. Maybe later, as a plug-in.

  11. Good afternoon

    very good game Devana good teams developper ^^

    i give the traduction en French language for version Devana 1.6.6

    sorry if not good perfect English

    just the traduction
    version devana_v1-6-6
    in file language in French (fr.php)
    correction

    thanks
    here the file compressed with winrar

    [url=http://www.fileserve.com/file/vcVdHfm/fr.rar][b]File name: fr.rar File size: 7.16 KB[/b][/url]

    [url=http://www.fileserve.com/file/vcVdHfm/fr.rar][b]File name: fr.rar File size: 7.16 KB[/b][/url]


Leave a comment

(required)

*
= 5 + 6