Tag Archives: android

Orbital Defense II In Progress

So I kind of started One Game a Month last month, though my first game didn’t really fully come together what with being sick and having a prototype to build for actual work.  For February I’ve decided to update an old game of mine, Orbital Defense and making Orbital Defense II.

ODII 2013-02-11a

The first order of business for the update is that I’m converting it over to use LibGDX.  This is the framework I’ve used for my later games.  I think it will help it run better and just look nicer overall.  I’m still in this stage of the process, to the right is a screenshot of the current progress.  The star field is twinkling, the Earth and the orbital zone are there and meteors are being created and run across the screen.

I still have a long ways to go, I need to add in all the other units, take care of unit collision and attacks, add the info bar and unit selection bar, etc.  There is plenty to do here to have it converted and ready for the next step.

The next step will be updates.  Since this is a tower defense type of game one big one I want in there are upgrades for satellites.  This is really something I should have had in the first version but I just didn’t have a good plan in mind for how to go about it.  I feel like I do now and it will work out nicely.  I also want to add more satellites for the player to use, and perhaps a selection screen to decide which satellites you use.  I want it to also have levels and more wave style gameplay for enemies instead of the random enemies it currently throws at you based on difficulty level.  I’d like to do something more with the graphics as well, at least update how it looks so units are quite so cheap looking.   Overall I just want to make it a better game that continues to be fun.

That is a lot to do, and the way I work I’m not sure it will be done this month so this might be an entry for another month.  Either way, this is something I’ve decided to do so hopefully I end up with something interesting.

More development

I finished Speeder, put it out on the Android Market and of course get no sales.  The free version is doing okay and it’s generating more ad revenue then any of my other apps but that’s still nothing.  It’s unfortunate but if nothing changes I’ll probably be looking for another job in July.  I haven’t given up though as the idea of getting a regular job sounds dreadful.  I had an idea for another new game that I’ve started work on already.

The new game is going to be a math game, and force you to try and do simple math problems quickly in order to do well.  I like this because it’s something you can get better at over time, the more you play the easier it will be to work quickly.  I’ll post more about it as I get more finished on it but it’s coming along really nicely I think.

I’m using libgdx to make it, previously I’ve worked just in the Android Canvas to write things, but I wanted to try out something using OpenGL and nice game framework.  Libgdx seems to have the best documentation and demos and tutorials and such of the game frameworks I looked at.  I’ve been able to figure out how to do anything I need to do in it by looking over their website and forums so I’ve been happy.

I’ve also been goofing around with Haskell in order to learn it.  Haskell is a completely functional programming language as opposed to Java which is an imperative programming language.  It’s a different way of thinking when you write programs in a functional language and a lot of people think it will be the way to go in the future.  I’m starting to feel good about what I’ve learned in it so I’ll probably fiddle around with writing some stuff from Project Euler, algorithm stuff like that seems perfect for what Haskell does.

Not much else to talk about, it’s getting nice out so I’ll probably start going to the beach soon, I’ll post some pictures from there because that place is rad.

Speeder Devlog 2011-02-14

So today I did a bunch more coding in Speeder.  I implemented scoring, which will continually increase as you are driving with modifiers that increase for every car you successfully pass.  If you collide with a car your modifier will go back to 1.

To go with that I implemented collision detection for the cars.  It isn’t fully what I want but it stops cars from clipping through each other, or mostly your car from clipping through other cars.  Other cars can still clip so I’ll have to do some work to stop that.

I did some initial work on power-ups too that you can pick up on the road.  So far I have 4 different types in mind, tires that will let you move left to right quicker, nitro that will speed you up going forward, allowing you to get more points faster, simple point powerups that give you a bundle of points in one go, and a cowcatcher that will go on the front of the car and let you plow through other cars, not losing your modifier or taking damage.   Tires and nitro might be permanent upgrades that can help the game to go quicker, points will be instantaneous and the cowcatcher will take damage of its own over time and eventually fall off so you go back to normal.  I don’t have graphics for any of those so I might go about putting those together sometime this week.

I also put into the game the idea of lanes, so that traffic you are driving through is lined up in these lanes.  To go with that some of the collision stuff I still need to implement will cause cars to shift lanes, and I want other cars that shift lanes themselves in the future.  Right now I just have them being drawn with debug output putting a rectangle around them but I eventually want them drawn to look like a normal road.

So to go with that here is a new screenshot, you can see the lanes and my debug score and modifier output up top.  I’m also collided with a car in a screenshot which of course you can’t really see if it’s not in motion.

I also realized in putting this together that anti-aliasing has to specifically be turned on for Paint objects in Android.  I went back to my old games and enabled it for some stuff so that the graphics, specifically text, look a lot nicer now.

Speeder Devlog 2011-02-10

So with Wordel out on the Android Market (you should download the lite version or full version) I am starting up on my next game.  My first thoughts were a shoot ’em up or another tower defense game, but last night when driving around I decided I wanted to make a car driving game with the working name Speeder.  The main hook of the game will be that it will use phone tilt to move the car back and forth on the screen as you race down the roads avoiding other cars and obstacles and such.  I’m going with a top down view, similar to a Spy Hunter on NES type look.  I’ve decided it would be a good idea to keep track of what I do in the game every day by writing a blog entry here possibly including screenshots and such so here is the first one.

So today I started work.  Luckily I’ve done some testing to see how tilt works on the phone so I had code I could copy over to get the right data to move the car back and forth on the screen.  I’m keeping it’s vertical location on the screen fixed for right now, not sure if I’ll change that later, but the horizontal location changes based on the tilt.  It moves faster or slower depending on how far you are tilting the phone and has a spot in the middle where it won’t move.  It will stop at the edges as well so you don’t go off the screen.

I’ve also added in basic enemy cars, though I guess they are really just other cars since they don’t attack you or anything.  They move from the top of the screen down towards you right now and they move based on a speed you pass them.  For now the speed is the speed I have set in the player car but I’ll want those moving at different rates in the future, the way I have it set up will facilitate that well I think.  The cars start just off the top of the screen and are removed just off the bottom of the screen so they smoothly enter and exit the screen.  For right now I have a counter to determine when I generate a new car and a max number of cars but that will be changing once I get further into the game.

I don’t have collisions between the player car and other cars put in place yet but that shouldn’t be difficult to add.  I have some more designing to do to figure out how I want to handle collisions for both player cars and other cars or even obstacles and such in the future.

I’ve designed some basic sprites for the player car and other cars, nothing fancy but I think they look decent for a start.  Here is a screenshot that shows what I have so far, not a lot but I think it is a solid start:

You should follow me on Twitter here or kyrutech here

Android StateListDrawable Padding vs. Margin

So this is something that has been bugging me for a while that I just now figured out today by reading the right thing.

Basically in Android when you are making layout objects you have several options on how to present these objects.  One of the options is padding, the amount of space around the edges of the object you are placing, but not exactly.  Padding is the space inside the object between the edge of the object and the content.  So if your object is as wide as the screen, padding pulls in from the edge of the screen, if your object is 100 pixels wide, the padding pulls in from the edge of the 100 pixels.

In most cases that is fine, padding is exactly what you want, but where it was a problem for me were Buttons using a background defined by a StateListDrawable.  See with a StateListDrawable you can define exactly how things like buttons look when they are pressed, not pressed, focused, and so on.  For this to work the StateListDrawable is set as the background to the object, which is where padding doesn’t work.  Since background is not content padding has no effect.  This drove me nuts until today.

After finding just the right post on StackOverflow I realized what I needed to use was instead the layout_margin option.  The margin around an object is in effect the padding for the entire object in comparison to the parent.  So if my object is told to be as wide as the screen, a margin will pull the entire object from the edges of the screen meaning the background along with everything else.

In hindsight it makes perfect sense and I can’t see why I didn’t realize it before, but now that I do I just wanted to post about it so if anyone else has the same trouble maybe this will help them.

And since this is a boring post if you don’t care about Android, here’s a Morning Musume song

Continued Work

Work on my word game comes along well.  I still need to decide on a new name for it since Word Drop already exists.

I have single board gameplay finished up.  Basically you decided if you want to play on a single board for 1, 3, or 5 minutes and see how many points you can score.  I don’t have any high score tracking in yet but I will track high scores for each time.

I also have basic gameplay for continuous mode set up for me to test.  Basically you are given a goal score to achieve in the time given to you at the beginning of each level.  If you make the score goal you get bonus points for the amount of time left on the clock when you finish and move on to the next level that will have a harder goal to reach.  I have to make sure my score goals work out and that passing from level to level works as intended as well as making sure game over if you don’t make your goal in the time given works.  I believe I’ll just have one high score list for continuous mode, though if I make different difficulties available for that mode I’ll split up high score tracking for those.

I want to make a board clear mode, where you are making words to try and clear the board, but I need a good method of checking the board for words.  The way my word dictionary is currently implemented that might be a difficult thing to do.  If I was still using the trie it would be simple, in fact I have it all written up, but the trie killed memory.  I may come back to this as a puzzle mode with levels set up with a soluti0n in mind that lets you completely clear them, but I do still need a check for remaining words.

I have a weird issue where my X tile displays in gray after modifier tiles show up on the board.  I have no idea why it would do this but it does it every time.  It is pretty low on my list of things to work on right now, but that’s something I’ll have to check into at some point.

Pixel Art

So my next game is going to be a shoot-’em up style game and I’ve started to work on pixel art for it.  Now I’ve never done pixel art so it is a interesting to read up on and find out how to do stuff.  Here is my first creation, what will hopefully be the main ship in my new game.

ship

Nothing too fancy, but I’m happy with it as a first attempt, we’ll see what else I can do.

Android Intent Flag FLAG_ACTIVITY_CLEAR_TOP

So working on Galaxy Destroyer and I needed a way to smoothly go back to the main screen after games are over.  Now traditionally I’d just finish the game activity and go back except I wanted a final stats display before returning to the main screen.  What this meant is that I wanted to go from the Game Activity to the Stats Activity to the Main Screen Activity.  Now a finish in Stats Activity would just go back to Game Activity and I’d have to rig up some cascading finishing so that wasn’t a smooth solution.  Luckily I found FLAG_ACTIVITY_CLEAR_TOP flag for Intents.

What the FLAG_ACTIVITY_CLEAR_TOP flag does is say that if an activity you are trying to load is already running, go to that running activity and kill anything above it.  In my case when I run the Main Activity from my Stats Activity with this flag it kills the Game Activity and the Stats Activity.  This isn’t anything that fancy but it is super handy for what I was trying to do.

Galaxy Destroyer First Game

Galaxy Destroyer

Well I’ve gotten Galaxy Destroyer programmed to the point where I could run a first game on it.  Plenty of interesting things to come from it.

First here are my final stats as I currently measure them:

  • Stars Destroyed – 40
  • – O Class – 1
  • – B Class – 1
  • – A Class – 2
  • – F Class – 5
  • – G Class – 5
  • – K Class – 9
  • – M Class – 8
  • – Gas Clouds – 9
  • Supernovas – 0
  • Hypernovas – 13
  • Civilizations Destroyed – 6
  • Total Population Destroyed – 19,122,391,112

So that’s not bad, I’m playing at smaller settings then I want to make random galaxies as far as starting stars and gas clouds go and I still had a good number of things happening.  It looks like it took me about 42 turns to get to this point because that is the oldest star left on the map, 42 billion years old.  There was only 1 that old with a few others around 40 billion years old.  Many dwarfs were on the board at the end as I expected.

At the very end there were still 4 civilizations that survived with around 16-17 billion people amongst them.  The largest two had 6 and 7 themselves.  Adding an indicator for the main map screen that shows a star is inhabited was a great idea, makes it very easy to find those.

Things that I could use:

  • auto-centering on novas would be nice
  • limiting aging and growing to stars that could go nova and an indicator for those would also be nice so you aren’t stuck looking all over
  • an indicator on a star when it increases class, especially during novas
  • on screen text saying how many turns have gone by, possibly by universe age in billions of years

A good first game test that gave me some good additional ideas.  There are still plenty of things outside the game I need to put in, static starting galaxies, high stat saving per galaxy for comparison, basically the entire main screen, game ending display, etc.  Having the game playable and interesting is most important though and I think I’m pretty much there.