generic low price cialis

Archive | June, 2012

More screenshots, improved graphics

I have been working my ass off the last few days to create some decent graphics for Dope Runner. With my previous projects, I always used dummy graphics at first and didn’t start working on proper stuff untill all the coding was done, but I’m not gonna do that anymore. It’s a lot of work, and I don’t want to do it all at once. Instead, I squeeze it between my coding sessions. The screenshots you see are the result of lots of work and a few failed attempts. Often I have an idea in my head, I start drawing something, I think it looks fine at first but when I run the app on my phone it looks like absolute crap! Usually this means back to the drawing board!

The menu got a thorough overhaul. The molecule in the background is an LSD molecule, by the way. I also designed an app icon, a task that can be more difficult than any other. I came up with a good color scheme for the entire app. Considering you play the bad guy, it had to be something dark. And I designed some map icons. These represent the different locations you can visit. There are drug dealers, labs and farms, a loan shark for when you’re low on cash, a gun shop, a doctor in case you get shot and, of course, your safehouse. The last screenshot is the game’s main screen. This is still a work in progress. You always see your location here, game status (such as money) and a menu. At the bottom, there will be a pager-like display for receiving messages.

Besides graphics, I also tweaked the code a lot. When I first tried it on my phone, it drained the battery in about an hour! That’s what happens when you set the GPS receiver to update continuously. Updating every few seconds is more than enough for an app like this. And I put the GPS code in a background service. When I started development on Dope Runner, I just put GPS code in the activities themselves, wich results in a lot of duplicate code. Now I only have to write GPS code once and it sends the location data to the different screens. This wasn’t easy since I never used services before. It was a bit confusing at first, but now it works fine.

My focus at the moment is tracking the location and enabling and disabling menu items when you’re near certain locations. I have also drawn up some blueprints for the buy/sell drugs screen, wich will be a major milestone.

Introducing Dope Runner

It’s about time I introduced my latest project! I started working on this a few weeks ago and now I’m finally able to show something to the world. I have divided the project into several “milestones” and now I have reached the first one. Each milestone is a finished part of the entire project.

So what is this project about? It is a location-based game, inspired by the classic Dope Wars game. In the game, you are a drug courier and your goal is to make money buying and selling drugs. Drugs can be obtained from dealers, farms and laboratories. Of course, the police will be on the lookout, and you can be arrested at any time! Of course, you won’t go down without a fight…

The game is location based, meaning you’ll have to get outside into the real world! The locations in the game are real world locations, placed randomly on the map. The game requires GPS, you it’s best to play it in an area without tall buildings so you have good reception.

The first project milestone consists of a map generator. When you start a new game, various locations are placed randomly on the map. You enter a name for the game, select the desired size of the playing area (1, 2 or 4 square kilometers) and when the GPS has a decent fix, the map generator can be started. The location you’re at when doing this will be your safe house, where you can store things when you don’t need them (or don’t want to get caught with).

The map generator required a bit of creativity. The locations had to be placed random in the area, but there had to be a minimum distance between them. I thought about several ways to do this, but the solution I found is quite elegant. I started by generating 1000 random locations in a certain radius around the starting location. Being completely random, they could be any distance from each other. Here’s how I made sure the points I end up using are far enough apart. I have a list of 1000 completely random points. I take the first point and start calculating the distance between this point and each of the 999 other points. If a point is, let’s say, closer than 100 meters to this point, I remove it from the list. When I’m done cycling the list, all points in a 100 meter radius around the first point have been removed. This is repeated for all other remaining points. This takes a few seconds, but the speed is acceptable.

After that I end up with a much smaller list of locations, but still more than I actually need. I then gradually increase the allowed distance between the points and repeat the process until I end up with the number of points I need, with the maximum amount of distance between them.

The final step is making sure all locations can be easily reached. Since the locations still consist of random coordinates, they might be in a place you can’t possibly reach, such as the middle of a river! Luckily, Google has a service called the geocoder. The geocoder takes coordinates and finds the nearest street address. I use the coordinates of this address and voila, I have a random location that can always be reached! There’s one disadvantage I probably won’t be able to solve, however. When you’re in an area that doesn’t have many roads, all generated locations will be placed on the available roads, and they will probably end up too close together. Playing the game in such a place would be kinda boring. The best environment for the game would be a town with a pretty dense road system, but without skyscrapers.

So what kind of locations will you visit during the game? First of all, you have a safehouse. You can hide cash, drugs and weapons in there, but remember it’s not burglar-proof! There will also be several drug dealers. They buy and sell drugs, and by keeping an eye on the prices you can make a nice profit. On medium and large maps, there are also farms and drug laboratories. From time to time, you can buy drugs there at much lower prices, so you can make lots of money. Speaking of money, if you’re running low on cash, you can visit a loan shark to borrow some, but you better pay him back quickly! There’s also a weapons dealer where you can buy guns and ammo. And finally, there are cops and competitors. You won’t see these guys on the map (they’re undercover) and can stop you at any time. The competitors, by the way, are NPC’s, it’s not a multiplayer game. The game has no time limit. You can play until you get killed. This can be in a police shootout, a loan shark you didn’t pay back in time, or a competitor.

Here are two screenshots so far. The first one is the map generator. I’m not too happy about the colors, so I’ll probably try lots of other color schemes until I find something I can live with. The second one is a map of the area surrounding the Google HQ, with random locations. The icons are the default Android icon, but I’m working on a nice icon set. This time, I’m not gonna make the mistake of waiting until all coding is done to get started on graphics!