It has taken a while, but I have reached the third milestone in Dope Runner. Things are starting to look very good now! After this one there's one more major milestone, followed by the finishing touches, and then the game can be released.
So what new features have been added? In the previous version, you could only buy drugs from dealers. Prices fluctuated, and from time to time prices peaked or crashed. In this version, drug labs and farms have been added. From time to time, they will have a supply of drugs for sale at much lower prices, so huge profits can be made. The supply doesn't last long, however, so you have to be fast!
Notifications now work properly. You'll receive notifications of price peaks and crashes, and of new supplies in labs and farms. There was already a text notification in the app itself, but now you'll also receive on through the notification bar when the app is running in the background. I'm thinking about getting rid of the in-app notification text, because it has become more or less obsolete.
Speaking of running in the background, this was a major obstacle for me to overcome. It's the first time I used services, and it was a bit complicated to get it working as I wanted (see my previous post for more about this). I also had to implement a wake lock, because the app needs to keep running even when the screen is turned off.
So what will the next milestone introduce? Cops! From time to time, they will try to arrest you. To fight back, you'll be able to buy guns. If you get shot, you'll have to visit a doctor. Also, burglars may visit your safe house! It will make the game quite challenging, and it's the last major feature to be added.
One more thing I'm gonna add is a settings screen. In my main menu, I've included an Instructions-button. This will be replaced by a Settings-button, and the instructions will be published on this website. When I started I didn't think a settings screen would be necessary, but I changed my mind. For example, the GPS update interval. A short interval is more accurate but consumes more energy. I tried to find a good balance between accuracy and battery life, but it's best to let the player decide.
Things have been quite for a while, but I finally picked up where I left. Not exactly easy, because I kinda lost track of where I was. But I managed to figure it out, and the first thing I had to tackle gave me quite a headache. So here's what the problem was. The app uses GPS, and it had to keep running even when the player opens another app. This means putting all GPS-related code in a background service. Even when the app isn't in the foreground, it keeps running. The real issue was communicating between the service and the app. There are several ways to do this. One is creating a bound service, and then you can access the background service like you would any other object. Doesn't sound too difficult, does it? The problem arose when I searched for a way to stop the service. The game has an exit button. It doesn't really exit the app (this is frowned upon bigtime in Android), but rather it stops the background service and goes back to the start screen. The problem with bound services is that Android activities are bound to it, and as long as there are any bounds, you can't stop it. It keeps track of the number of bounds and stops automatically when this is zero. And that's what gave me such a headache, because at some times, I just couldn't stop the service! So I decided to try something else. I started the service without binding it to the activity. This means you can't access it as an object, but instead you have to send messages between the activity and the service. This is a little bit more work, but you can always stop the service no matter what. This was the first time I used services. It's a complicated subject, but I learned a lot in the process. Now I can move on with all the rest.
The second milestone (out of 4) of Dope Runner has been reached! Each milestone is a completed, playable sub-project. Here's what's included in this one:
The player can visit drug dealers and buy and sell drugs. These are placed in the player's inventory.
The payer can access his safe house and store drugs there.
Drug prices fluctuate. From time to time, one drug's price can peak or crash for a short while.
There's a price list of all drugs and all dealers. You don't have to visit a dealer to find out the prices.
GPS update frequency has been changed to prolong battery life.
Now I'm gonna do some live testing, and start planning the next steps. One thing I have already found out is that this game is best played by bicycle, not on foot. The playing area is big! If you play it on foot, you probably won't be able to make a lot of money before the battery runs out. I have already done a few live tests, and I'm really starting to think it's about time I got a new phone. My old HTC Hero is getting really slow, and it seems to have problems with GPS. It takes really long to get a decent fix, and it often stops working for a while. Not to mention it's still running Android 2.1! So what will the next milestone involve? In the next one, the drug labs and farms will work. From time to time, the player will be notified of new batches. The price of drugs will always be lower in labs and farms, but the player will have to be very fast, because the supplies won't last long. Once a new batch of drugs is ready, the supply starts decreasing and the player has to be fast to get his hands on it. Also, your inventory space is limited, so you'll either have to sell it as fast as possible, or store it in your safehouse.
For more information and my other projects, visit my website, Epic Zombie.com