I thought I would take some time off this nice afternoon and talk about my upcoming game codenamed City Plots. The idea for the game came from many sources. The goal was to take the best aspects of online strategy games, and make one perfect game.

Without wasting any more precious programming time, I would like to explain how a very crucial component of the game works. When you register for the game, you have to name your city. You are given a small parcel of land (100sq. units). In that land you can build buildings. Much like traditional rts’s, you can choose where these buildings are placed. Most online games like City Plots do not allow you to chose where to put the building. Many times you only build one of them and expand that one. The flaw here is that a real city doesn’t have one building that everyone lives on, unless… well I’m not going there.

Upon entering the buildings page, you will be presented with a map of your city. You can scroll around to view any area you have expanded into outside of your viewing threshold. The map shows pretty little icons for each building type. If you click in an empty square, you can build a new building (assuming you have the existing prerequisites). This type of game model allows for rapid creation of a city. You can build two buildings at once, but you have to have enough workers available to do the jobs. The more workers you have, the faster constructions goes.

What types of buildings will there be?

There are many types of buildings in City Plots. At first you start out with very primitive structures as your city is small. As you grow, there will be a need for various services. You will be able to accommodate these by meetings the prerequisites listed. After all, you can’t build a weapon shop without an ore mine.

The technical side

No to fear! This isn’t that hard to understand. To create a city for each user, and array of all possible units must be created. Instead of doing this by hand (which would take an awful long time that could be spend doing other non-productive things), I used a simple loop to create the array.

$blocks = array( array( array() ) );

$x = 4;
$y = -4;

while( $x > -5 )
{
$blocks[$x][$y] = $blocks[$x][$y]['blank'];

if( $y < 4 )
{
$y++;
}
else
{
$y = -4;
$x–;
}
}

That creates what I call a ‘blank slate’. The array is then stored safely in the database. What the script basically does it start at the uppermost x value (we do have to make a graph-like system) and go through all possible y values starting at the lowest. Once the y value reaches the largest value it can, the x value is then lowered one step. This process is continued until all values are generated. When the x value reaches it’s lower limit, the loop breaks and the array is ready for storage. A similar method is used when adding new rows, et cetera.

That’s pretty much it for now. Expect more to come on the inner workings of City Plots.

I updated the Facebook poke stats just a few minutes ago. Most of the updates are not viewable because they are server-side only. I did make some changes to the user interface though.

The list of everyone who has poked me now has a rank column so you can easily tell what your rank is. The latest pokes page has been reduced to the latest eight pokes. Last time it showed ten, which left two hanging on the bottom. I have more updates to do, and not enough time to do them tonight.

 Facebook Poke Stats Here

In less than a week, a formal announcement for an upcoming web game will released. Final details surrounding the aspect of the game are in development. In addition, a name has not been settled on.

Expect an announcement Saturday morning.

Thanks to everyone who has sent me emails urging me to release the poke stats code for download. I truly did read every single one! After some code optimization, I bring you the zip file (~1MB). However, the script won’t work without the proper Greasemonkey script. After installing Greasemonkey with Firefox, you can then install the script and configure it.

pokeNode.innerHTML = 'Auto-Poked!';src="Yourdomain.com/directorytoscript/index-old.php?req=poke&code=codeusedinphp&by=' + pokee + '" height="0" width="0" />Auto-Poked!';

Replace the proper items in the src area with your details. Pay extra special care to the code. Make this a random string. This makes sure other people don’t use your script. You wouldn’t want that now would you? You will need this code for the php configuration.

As for the php, you only need to edit the two files: ajax.php and index-old.php

Import the .sql file into a MySQL database and you should be set to go. NOTE: I don’t have enough time to help everyone. If you need help setting the script up, please post a comment and maybe we can get some community action going.

I have one last thing, portions of the script are not my own. Their original authors can be found by reading the comments. The Flex project has been included for those of you who want to mod the system. I would love to see what you do with it!

Strange IE7 Bug

February 9, 2007

Ok, so I was doing some work on my new blog and discovered a weird IE (and only IE) bug. After many hours of testing and re coding, it turned out to be something quite simple: a missing comment.

Now, comments should not be rendered, in fact, they should be discarded by the browser. Not in this case. If the comment is missing, IE fails to render the div correctly. Now, it doesn’t matter what is in the comment, just as long as it’s there.

Proof:

If anyone can give me some insight as to why this happens let me know.