smert.net

Polluting the Internet one post at a time…

Warbook Alliance Manager

Warbook is a Facebook Application focused on war. There are several different character classes to choose from when playing. Jordan (the other person that write on this site from time to time) was a mogul and he is the one who invited me to play. I must say at first glance the game wasn’t fun at very low levels. You would get chain attacked a lot and there wasn’t much you could do. Lucky for me it was easy to get money and move up. I focused on defense at first but read that it was pointless at higher levels to defend your self. BLAH BLAH BLAH LONG boring story.

Anyways at some point we were recruited to a bigger alliance. I had an idea to use Greasemonkey and save stats to a PHP + MySQL back end for better searching. I also wanted to share spy/survey data between members using the script. I wanted to build a C4I and IFF like system for Warbook. I began in December and wanted to keep it quiet because I didn’t want to loose such a huge advantage to someone else. Only trusted members were able to use it for testing. Near the end of the month the client was fully completed. It worked and it worked well.

Around Jan 10th things started to change in Warbook and they made some rather poor changes. It started when they reduced land received by 4x. Of course they made adjustments afterwards but I lost 1 billion in gold because of it. This made advancement a lot slower and made it BORING (much like this article). That was the down fall it quickly ruined all the fun I was having with the game and my interest in maintaining WAM (Warbook Alliance Manager). Many of my friends have stopped playing too. Now some weeks later I feel that I should try to finish but I have no desire even to maintain the script. I’m about -3.8bil gold and today I felt like I might try to work on it but I’m bored by the idea. So RIP Warbook.

Let’s get one thing out of the way first… I’m not sure whether or not this script violates any TOS while playing Warbook. I don’t know if you could get banned. Don’t complain if you do. Also this script shouldn’t be against the rules. Warbook is lacking in many areas (Yay you finally made some lame time stamps (I hate them, you should use MINE) and made it impossible to attack allies) but my script attempts to expand upon your deficiencies and create a more feature filled experience and improves usability (slightly) and organization. Anyways I don’t think it does since it functions like a distributed Brimstone. If I was still playing today I would be using this regardless. I’m glad all of this stuff isn’t included and makes it interesting to people who took the time to create such systems. It is kinda like the chat that can be easily broken into. Everyone knew you could but it made it interesting to make sure people didn’t mention important things. Most used a Facebook group anyways. I’m sure I’m not the first to make an alliance manager for Warbook. I’ve saw an alliance leaderboard that looked nice and I read one alliance description suggesting they have a database of some sort. That was going to be one tiny part of WAM.

We’ll start with current features (except stats, I never finished).

- Saves all messages (in a green box) from the server with a time stamp. You can view up to 100 messages on the home screen. More options will be available on the website.

- Saves stats from the home (gold, army size, land size, mana), kingdom (land size, total income, revenue, upkeep, free land, % free land, mines, % mines, forts, % forts, training grounds, % training grounds, barracks, % barracks, amplifiers, % amplifiers, barriers, % barriers), military (army size, attack score, defense score, soldiers, knights, pikeman, elites), hero (level, type, attack, defense, spell power, mana, experience remaining), alliance (total kingdoms) and user page (player name, alliance, tag, level, type, land size, alert level, resources).

- All messages are processed to collect stats.

- Spy/Surveying is shared between members. Projected values are calculated when the target attacks or gets attacked.

- Allies/enemies are color coded and are defined by the alliance leader. Individual users can add their own targets by alliance or individually. These overwrite the alliance defined ones and you are responsible for damage caused to friendly targets. You can overwrite the colors with your own.

- Alliance tags are highlighted yellow in player search and on the user page. Users in alliances without tags show up as “{NOTAG}”. Players that have the character class “God” show up as white.

- Below the alliance chat is a warning message about how unsafe alliance chat is.

What can you do with all of this? Basically you can do anything that you would find useful with the information you obtain from Warbook. You could add a messaging system for players and give them orders on who to attack. Use can use the information to create a leaderboard for your alliance. Create a page to do specific searches on targets added to the database (view collected info by allliance). If used by an entire alliance you could mark repeat chainers as such create a public site for people to view this information. You could create a page so that people can add their own allies/enemies. You could make a learderboard that does a query on logs looking for chainers and then anyone in your alliance can retaliate for them. You could create a page the views all logs obtained by any of your players. You could create a page to share intel reports between everyone. You could collect stats on how much damage is done to each individual/alliance. You could finish adding the levels of trust into the script and make only certain things available to trusted members (check out j1.php through j6.php for more ideas).

Various notes

Major changes to IFF (Identification Friend or Foe) have been made. Before the system only supported enemies and allies. Now it supports more defined allies along with custom color coding. The current code is backwards compatible for the time being. I will switch this over tomorrow or the next day when I get time. I will let everyone know since you will need to re-download the client and it will break current IFF when changes take effect.

Here are the details...

AAP - Aggressive Alliance Policy (Enemies, we are at war with)
LAP - Low Aggressive Policy (2 attacks per 24 hours)
NAP - Non-Aggressive Policy (no attacks permitted, disables attacking)

MAP - Mutual Alliance Protection this is an attribute that can be applied to a LAP or a NAP. It can also be by its self. It means they have our backs no matter what. The MAP can be hidden from the alliance as well in case we have hidden protections.

NAP + MAP = PPP (All the time) - Privilege Protection Policy.
MAP = MPP (LAP non-war / NAP at war) - Mutual Protection Policy. This is based on a status set by the leader of the alliance.
LAP + MAP = LPP (LAP all the time but they still help us) - Limited Protection Policy

A NAP by its self is someone neutral to us and not technically an ally. LAP is limited aggression and not technically an enemy or neutral (like a step below neutral). Normal people are not defined as an enemy or ally. probably somewhere between an enemy and a LAP. It could be written like this. Left to right is most ally to enemy.

PPP --> MPP --> LPP --> NAP --> LAP --> Normal --> AAP

These will be the default colors after the change. The leader of the alliance can change them for everyone else. You can overwrite the colors set by the alliance as well. Marking the MAP hidden will make it a normal LAP/NAP to people in the alliance.

AAP - RED
LAP - ORANGE
NAP - BLUE
LPP - YELLOW
MPP - YELLOW (non-war) / GREEN (war)
PPP - GREEN

You could break it down like this...
RED - Attack
ORANGE/YELLOW - Caution attacking (2 attacks per 24 hours)
BLUE/GREEN - No attacking

When we start doing queries against our members my system will be using the following.
NAP/PPP - You shouldn't have attacked them at all.

LAP/LPP/MPP (non-war) - Divine Intervention counts as TWO attacks since it does double. So on your second attack if you got divine it would make it 3 attacks. You should be accountable for the second attack since it is a diplomatic agreement.

Normal People - We encourage a LAP but don't enforce it. We shouldn't be accountable at all for divine on the SECOND attack for normal people. It won't be considered as 3 attacks, just luck of the game. Any more than 2 attacks is up to the individual to be responsible for their actions brought upon by their chaining.

Any more than 2 attacks against our members is chaining. You will have to view the logs to determine if it actually was chaining or the result of something else (someone being stupid). I need to change a few things with messages and mark them by type. I also want to have another field for the alliance name and tag for each message. That way we can easily tell which alliances are hitting us.

I've decided against directly building MPP (which relies on a status) into the client. You can get the same effect by manually switching a certain ally between LAP/NAP. The only down side is there isn't a single place to do this. You have to do it for each ally. This reason was because of technical issues. I could get it to work but I don't feel like adding the complexity for a tiny feature. Now when you view an ally because of the different colors that could be assigned it displays the diplomatic status (PPP, NAP, etc.) in my message area.

The client is now consistent with the current features page. There are still two things not working on the server side. Statistics and projected values. These are very big areas on the backend and have taken a lot of time which is why they aren't working yet. You are now submitting the number of kingdoms when you view an alliance page. I have also added a warning message about the safety of the alliance chat.

I did some behind the scenes maintenance. Before I had the spy/survey sharing working the spy logs were only good to you. I repopulated them from older messages. The purpose of the maintenance was to retag all of the messages so we eventually can search by type. I found a few messages that I wasn't processing. I know there are a few I don't have mostly spells from hero types that aren't using WAM. I know I don't have a boundary shift message either.

Once I get stats working I'm going to calculate the current stats from all previous messages. Once I have all the bugs worked out with stats I will be resetting all of the messages and stats to start clean. At that point WAM will be considered safe for general usage and we can get a bunch more people to start using it. This will probably still be a few weeks away. I want to complete the webpage for allies/enemies, stats and message search. Stats and message processing by far is the hardest part. Those other pages I can do in a very short period of time.

There is something unique about "Intel Report" I'm unable to tag the player you cast it upon. I will make a separate query to pull all previous intel reports. I might make a page so that you can manually tag it your self but it won't be automated since it doesn't say who you got it from.

Now for the limitations :( You can’t use the back button EVER. It will cause any message in a greenbox to be sent again (causes duplicates in the database). The only safe time might be when you get a white screen. I’ve been lucky and haven’t seen it break doing this. If anyone knows a good way to prevent this let me know (after lots of searching I found no option). There is no ideal way to filter duplicates so I do no checking on the back end. It simple isn’t possible to do a %100 solution. The solution is to not use the back button :( Good thing Firefox has tabs and you can open people you are attacking in them and then attack them and close the tab when you are done. The navigation bar helps a lot too.

Now the actual code can be found here. As a reminder, since I don’t have it clearly posted, all code on my site is GPLv2 unless otherwise specifically noted. You need to have Firefox and Greasemonkey to use the client. Then you need a web server that can run PHP + MySQL. I will post the SQL file of the database structure soon.

Update (26JAN08)

The description of what this does might not be clear to everyone. This is a PHP script that you use on your OWN hosting. It saves Warbook information to YOUR MySQL database to do what ever you want with. No information is sent anywhere else. The Greasemonkey script is the client that must point to your server. You could use it standalone but you just get the navigation bar. That means you have to have your own hosting and be fairly intelligent to modify the script to work with your host. Also I’ve put up the schema for the database structure which can be found here. Here are some screenshots.

3 Comments so far

  1. Wolfenn January 25th, 2008 12:38 am

    Doh.

  2. matt February 9th, 2008 7:43 am

    just wondering if you have completely given up on this project? I made a basic website where people entered information (not auto collected like yours) and it was a BIG success in the war that we just had. If you are still developing are there any updates? if not then we can offer you a place in the alliance give full protection in exchange for working with us to create an alliance management system.

  3. Jason February 12th, 2008 10:37 am

    Sorry about the delay in moderation. I have stopped developing and playing Warbook (though I haven’t destroyed my kingdom). I would consider developing if there was a large enough demand. I have also considered making a website for users to sign up but assumed that many people would be uneasy about giving all their alliance information to me. There are a lot of other reasons that make this unlikely to happen. For now the best I can do is provide answers to questions about the code.

Leave a reply

Firefox 2