Last Good Quote: Son's are the seasoning on our lives. - Someone on Facebook

Friday, March 20

Code: Merge Gifs with PHP

For those who need it, and for my bad memory. The following code will take two image files, lay them over one another, and print some text on the top.

An easy way to create dynamic images.

//
//base image (is under everything)
//
$image = imagecreatefromgif("background.gif");
$width = imagesx($image) ;
$height = imagesy($image) ;

//
//create the final image to be output
//
$image_final = imagecreatetruecolor($width, $height);

//
//create a few colors, for drawing
//
$black = imagecolorallocate($image_final,0,0,0);
$white = imagecolorallocate($image_final, 255,255,255);


//Get destination coordinates
$dst_x = 75;
$dst_y = 75;


//fill image with background
imagefilledrectangle($image_final, 0, 0, $width , $height , $black);


//copy background to output image
imagecopyresampled($image_final, $image, 0, 0 , 0, 0, $width, $height, $width, $height);


//
// Add another image over the top
//
$overlay = imagecreatefromgif("unit.gif");
$width_o = imagesx($overlay);
$height_o = imagesy($overlay);
imagecopy($image_final, $overlay, $dst_w,$dst_h,0,0,$width_o,$height_o);

//
// Write some stuff on the image
//
imagestring($image_final, 3, 15, 32, "Hi there", $black);
imagestring($image_final, 3, 200, 32, "Holy Moly", $black);


//
// Send the image to the browser
//
header("Content-type: image/gif");
imagegif($image_final);

Angels and Demons – Traps

I recently added a new feature to the Angels and Demons game. To date the game has consisted of a pretty simple game model. You build buildings, research and level up till you have the best units you can get. You then start to attack the Holts (player maps) around you. Seeking to take them over.


When a battle takes place, the Attacker decides on the number of warriors to send on the attack. They send the warriors on their merry way and 10 min later the battle takes place.

When a player is attacked, the Defender, all available warriors will participate in the battle.

Now with Traps, Defenders can take a part of their Army and "hide" it on a specific Holt. Once those warriors are hidden in a Trap the Defender cannot use them to attack anyone. However if an Attacker launches an attack on the specific Holt the "hidden" warriors do twice as much damage and have twice the defense.


An Example:

The Demon "DemonKnight" is consistently attacking "Heavens Path" which is owned by the Angel "Eternal Life". Eternal Life decides to set a Trap and hides 300 Arch Angels on Heavens Path. This leaves Eternal Life with 1,000 Arch Angels to play with.

DemonKnight attacks and finds himself facing 300 Arch Angels at (*2) attack and (*2) Def. And an additional 1,000 Arch Angels at normal attacks and defense.

He is routinely demolished.


My Thoughts

I think this adds another dimension to the game, as players can bait Holts by making them look like easy targets. Attackers could be suckered into attacking, but when facing a unit with 2 times the attack, the Attacker units die faster. And because the Defender has 2 times the defense, the defender units die slower.

This seems to be a clever way to slow down an aggressive player.
























Wednesday, March 18

The Warriors of Angels and Demons

I changed the stats on the warrior classes within Angels and Demons. Some people might like to know the thought process, other just want to know so they can rule in the game. Either way, here are my thoughts.

Level 1
New Users will need to have some cheap units, so they can build an army quickly and feel properly impressed with the shear volume of warriors they have. I also want to encourage them to build some buildings and get used to the whole research / train/ fight. So for all of that I have created the following:

(Att: 1, Def: 1) Dark Warriors, Holy Soldiers : Starting warriors, a little attack, a little defense, really cheap. Build away

(Att:1, Def: 0) Grimlins, Soldiers: Cannon Fodder, a little attack, no defense. Good to train a bunch of these if you are about to attack.

(Att: 5, Def: 5) Angel, Fallen Angel: Good soldiers, some attack, some defense. These will be your staple warriors until you can advance a few levels. They are not bad and even as you advance you should keep a good bit for defensive purposes.

Level 2
Now at this point in the game, you've attacked a few folks and discovered that while the Angel and Fallen Angel are good for attacking newbies and weak players, they just don't cut it when it comes to a real battle. This is when you begin to pay attention to the actual attack and defense value of your Warriors.

(Att: 10, Def:100) Warlock, Cleric: Your first real warriors. These warriors become available after you have played for about 2 hours. Great defensive warriors and good for attacking.

(Att: 50 Def: 25) Hero, Dark Lord: Your elite attacking squad. It will take about 5 hours for them to become available, they cost a lot but are worth it if you are attacking.

Level 3
So, you've collected a few Holts. Maybe you have opened a Realm Gate. You know how to time your spells and attacks. But there is this one major bad a** who keeps attacking you. You really want to plan something special. An attack of massive proportions, one which can wipe out a whole Holt in one swoop. Now it's time for you to train the big boys.

(Att:150, Def: 50) Arch Angel, Lower Demon: Now your talking, send these guys in and they can wipe out a watch tower by themselves. They do cost a lot of souls.

(Att:300, Def:150) Demon Priest, Demi-God: The strongest unit in the game. By the time you have these guys you should be fighting battles over multiple Holts and Realms. You should only be able to afford a few thousand of these at a time.

Wednesday, March 4

What is Angels and Demons?

Angels and Demons is the latest game I have been working on. It is a resource management game where the primary resource is souls.

The game starts of simply and gets more complex as you progress. There is a certain language or culture that goes with this game as you will see.

When you start you have to choose a side to join. You can either join the Angels or the Demons. Angels defend a bit better and Demons attack a bit better. Once you have made a choice, you can not change sides.

After you have picked a side you are given a piece of land, called a Holt.A Holt consist of a 7 x 8 grid of land. It is your base of operations...of sorts.
On a Holt you can build structures, each structure allows you to do take different actions. Certain structures train warriors, others will gather souls, others will cast and maintain spells.

Each building that you build increases your Holt's attack and defense powers. Not important right now, but critical later on.

You start the game with 1,000 action points. Action points are the life of the game, they allow you to perform actions. You receive 1 action point per min up to a max of 1,000. (This may change depending on the game server and general feelings of the developer). Action points can not be purchased.

You start with the ability to build three types of buildings:

One that will train warriors. One that will gather souls. And one that will defend your Holt. You can build as many as you want although each building cost a different amount of action points and souls to build.

Each building allows you to "Research" another building. These research able buildings can not be built by you yet, as you do not know "how" to build them. Spend the action points and these buildings will become available to you. The first few are easy to research.

Now this game takes a bit of thought, initially it would appear that if you build a bunch of stuff you can win easily, but you will find that your action points will not be enough. You can not win this game by being the fastest "clicker" or the person who visits the most often. You have to do a bit of planning. Strategy some might say. *grin*

Once you have an Army go exploring, visit the Holts around you and figure out who deserves to die.

The Next Level

There is a meta game, to Angels and Demons. You have your Holt and you can explore the surrounding 8 Holts. These 9 Holts, yours and the 8 around it, make up a Realm.

Initially you are competing with just those folks in your Realm. But when you begin to dominate and hold 3 or more Holts you will receive a "Realm Gate", sometimes called a Neather Rip, this gate will allow you to travel to other Realms.

However it's a double edged sword. Until a Realm Gate is built your realm could not be attacked from other Realms. Now that one exists, other Angels and Demons can enter.

So at this point you are now competing against other Realm holders.

Ranking

You will always see a ranking for just players who have Holts in your Realm.

You can see a game ranking which ranks you with all players as well.

Tokens and Membership

Members can purchase Tokens. Tokens allow you to perform certain actions quicker but still take action points. For example you purchased a "Fallen Angel" for 500 Action points....normally you would have to wait about 3 hours before that unit is ready to fight. Member tokens can be used to bring that character up to speed immediately. There is a limit to how many tokens you receive each day, and every time a member uses tokens, free tokens are given to Non-members.

Members have special avatars in the rankings, chat and online boards.

Members are able to name their Holt and lay down different floors on their Holts.

Members are able to view a full list of all their buildings and all the outstanding actions for those buildings.

Thanks for reading the post!!!

Followers