Monday, November 26, 2012

Making an overhead map

Unlike classic RPG's of old, I want to keep as much info as possible off the game screen and keep that real estate for the actual game. I don't have any interest in a small overhead map in the corner of the screen that will create clutter and only be looked at some of the time.

I actually struggled with this for a while since I really had no idea how to code it. I posted in the Blitzmax forums asking for ideas and one of them (and a pretty good one) was to create a pixmap sprite. A pixmap sprite allows you to manipulate every pixel in it terms of color and what's the draw. One idea is each pixel would represent a single tile on a level and either draw that tile had or perhaps shade it so objects would be one color and the ground would be another.

After thinking a lot about it I think I have it figured out, in theory anyway. When I read in a level it populates several data structures. Basically, you have square at X and Y and I store the data. What coordinate does that square represent, what sprite gets drawn there, etc. When I render the screen I just loop through those arrays and draw it.

So why not pull in that same data but scale it! When I draw a level, I start at a fixed point for the first square at it's center, say X 0 and Y 0. The next square gets draw at X 32 and Y 8 and so on. If I wanted to draw a mini map of the entire level I could scale by size and coordinates. Let's say we have a 64x64 sprite. Zooming   out by a factor of 1 would make it 32x32. Now, instead of drawing it at the same coordinates I will draw it at X 16 and Y 8. If I wanted to zoom out more I could keeping halving the numbers.

Of course this is all in theory. Fleshing it out in this post sounds like it should work but there is only one way to find out. Since I don't plan on constantly refreshing the map I would only have to loop through all the items only once so bigger maps shouldn't be a problem to draw. Once I get this coded and hopefully working I'll post more about it.

Sunday, November 25, 2012

Why a post-apocalyptic theme RPG

I just finished driving 22 hours straight from Florida to NJ with my girlfriend so if this post sounds a bit like rambling I will apologize in advance.

As a kid I played Dungeons and Dragons over the years, pen and paper style of course. In my early 20's we used to play every sunday afternoon. Don't get me wrong, I like fantasy just as much as the next guy... but there are only so many goblins and orcs someone can kill in their lifetime!

I always had a fetish for end of the world scenarios and sci-fiction, I love it. A mass disease that wipes out the human race, a nuclear war, the zombie apocalypse, love them all. I have zero interest in making yet another fantasy RPG about so and so magic user trying to find the kidnapped Princess in some dungeon somewhere.

Give me guns and bullets, they are fun to use, not crossbows and arrows. With a post-apoc RPG you can make it pretty gritty, read: not a "pg" family orientated game. I also think that if I make a deep story driven post-apoc RPG series I can create a niche market for myself. That remains to be seen but I want to be known as that post-apoc indie guy someday :)

Like I said my other passion is sci-fi. I can totally see cranking out some sci-fi rpg's taking place in a futuristic city with cool weapons and alien races. I think that would be received well since there aren't many turn based rpg's in a sci-fi setting out there. There could be all kinds of cool stuff I can do, evil corporations, a desert wasteland with some experiment gone wrong, alien races with various attributes. It would be pretty cool.

So in closing, no more magic spells and no more castles, let's fire off a few nukes and have some fun.

Tuesday, November 20, 2012

Turn based combat system: Building the classes

My girlfriend and I are currently vacationing in Florida for the Thanksgiving holiday so I haven't been coding at all. This does however give me time to think about the game mechanics and how it's all going to come together.

My combat system is all in spreadsheets with all the stats, skills and other character attributes. Of course this is a raw system that I made up on my own and completely unproven. I have no doubt once I see it in action there will be a lot adjustments.

Since my game isn't fantasy based upon I felt I was really restricted on making classes. For fantasy classes you can have a fighter, mage, cleric, thief, barbarian, paladin and so on. My game setting is post apocalyptic so I originally decided to not have classes at all and let the player build up the character stats as they saw fit, four characters in all. I also originally had it real old school with basic stats such as strength, endurance, etc in their own separate container that would receive their own points to upgrade with on each level up.

So I got to thinking and the more I thought about it the more I realized I wasn't really thinking outside of the box. The above system would still be fun but it's kind of one dimensional and doesn't allow for a lot of possibilities or tactical decisions in a firefight.

Here is what I came up with so far that I think will really open up the possibilities. The classes will be soldier, demolitions, sniper, heavy weapons, and locksmith.

The soldier would have bonuses for automatic weapons and be well rounded. Demolitions would have a love for explosive weapons and be able to set and disarm traps. Sniper would excel at longer range fire. Heavy weapons will be for heavy fire support but you would have to use those weapons wisely since ammo use will also be an issue. A locksmith will be a key master, able to hack terminals, open locks, steal, etc.

In addition to each class having their own specialities I'm also going to make certain upgrades available to only that class in leveling up. I can also see designing missions where you can pass them no matter what you have but a particular class would help a lot. It might also allow the player to build a party that is suited to their playing tastes. I also like the fact that if I create 6 classes but only allow four characters in the group it will force some decisions to be made. I plan on having a dozen or so characters that can be picked up along the way.

I'm confident that this new system, even though it's still only on paper, will allow much greater playing choices. I can't wait to see it in action.

Friday, November 16, 2012

Writing the perfect code, why do I torture myself?

I wonder if other people do this or am I a unique being. Today I went to work on the turn based combat system since I've barely scratched the surface. I quickly realized my inventory screen was broken because other changes I had made a few days ago. Fine, then I noticed for each character's inventory I had a 25 cell array. This annoyed me because I was using a Tlist in most cases and wanted things to be consistent. Since I had to fix the inventory anyway I changed it to a tlist.

Fast forward over an hour later, fixing things because I changed the type of inventory system. What did I gain from this? I'm not quite sure really, other then I'm using a Tlist instead of an array. So the question I'm going to ask out loud is why? If it works, leave it. There is no perfect code or structure, of course it's going to be a bit sloppy no matter what I do. No matter how I write it, a time difference of 2 milliseconds isn't really going to matter.

I need to tell myself to stop tinkering, stop going backwards and stop wasting time. Ok I think I'm done lecturing myself, next.

Thursday, November 15, 2012

To Blitzmax or not to Blitzmax

I've done this to myself many times over the last few years and figured it was an interesting topic to talk about and I wonder if I'm just a weirdo or perhaps other aspiring game makers do this too. Ok I'm probably a weirdo regardless.

Given the pace that I'm making this game I always think there might be something better that I could be using, such as Unity 3D for example. Over a year ago when I took up Blitzmax I was confident it was what I was looking for and wanted and something I could stick with. I was using Torque Game Builder before that but it wasn't a good fit. Recently a thread was created on the Blitz forums about how there aren't any updates left to it and wondering of Blitz is going to be obsolete in the near future. I also read comments how Blitz is sorely lacking some essential features like AStar and items like that.

Now of course I read it and it fed the always present self doubt that I have about the time investment I'm making and if using Blitz is still the way to go. Maybe I should take up Unity 3D so I can eventually get my game published on the ipad really quickly and other platforms with one code base. Maybe Blitz could be a lot better and it's past it's life span.

I ran some searches on making a isometric rpg with Unity and found very little. I saw some posts asking if you "can" make an isometric rpg with Unity and the answer is the generic "you can make anything you want".  I also read a blog of an indie that has actually made a few games and he is into Unity and he talked about how there are a lot of "tricks" to making a good rpg with Unity.

It took me about a day to realize I already had been down that road before and forgot the lesson I learned. I'm not a very good programmer by any means. I can't look at source files in an engine and figure out what's going on (or at least with any ease) or make any modifications to it. I had really struggled with the Torque engine because while it has a lot of great features a lot of the work I did was figuring out how make feature X work with design Y. It really did get exhausting after a while, always jumping hurdles to figure out how to make it work.

I'm sticking with Blitzmax and I'm not letting a few forum threads influence me. Just because something can be bigger and better it doesn't mean it's really for you. I remember reading that Cliff Harris still used I believe Directx 7.x to make his games until recently where he upgraded one version. And I also thought about people's comments how Blitz is lacking features like Pathfinding. I already made a pathfinding system in Blitz that works great and it's coded to exactly what I need.

So yea I'm sticking with what works for me and what I'm comfortable with and I'm not going to adopt the "grass is always greener on the other side" motto.

Tuesday, November 13, 2012

Capturing the essence of turn based combat

I know a lot of people gag at turn based combat, that's fine, the RPG I'm making won't be for them. I'm just at the beginning stages of coding the combat system. I have a bunch of spreadsheets with how it should work but I still need to polish the numbers again.

One of my goals is to create a combat system that relies on smarter decisions by the player, not just simply put guy in square X and fire at guy in square Y until combat is over. I can't help but be inspired by a childhood memory of playing Pool Of Radiance on the C64. I remember early in the game I discovered this island that had a castle full of kobolds. As soon as I went into the courtyard my party got attacked by a few dozen of them. I instantly fanned my party out thinking I can easily handle all of these low level creatures.

I quickly realized I was wrong. Each of my characters quickly got surrounded and overwhelmed. I tried again and again and kept losing, sometimes coming close to winning but the outcome was clear. Also a nice fireball spell, I think I only had one of them from my magic user, was only able to take out 2 or 3 kobolds. Not good.

But then I realized something. On the map there were these stone columns. Aha! I formed a defensive line with my party using the columns as anchors. Sure enough when my party got charged by the large wave of kobolds they had to stack up 2, 3 or even 4 deep waiting for a space to open up to attack. Now my party members were only getting one or two attack swings aimed at them instead of 4 or 5. After a few rounds I fired off a fireball right into the middle of the kobold pack. I remember killing 8 or 9 of them. Another round or two and they retreated and felt really good that I figured it out.

Ok granted, I'm not 12 years old anymore but I hope to capture that seem feeling of having to think things out and a bunch of little things have to be done right to add up to a win. I realize this is difficult and I'll probably never got it right but I'm going to try. I'm not ging to post my combat system because it's not even coded yet and I'm sure it will go through changes because there is a big difference between seeing it in a spreadsheet as opposed to playing it.

That is the advantage of a turn based combat system. You have to use resources and spaces carefully and think about your next move instead of just rushing and let the mathematics take care of the rest. It provides a chance for an overwhelped player party to win against superior numbers or firepower by using strategy.

It's probably going to take me a month to get the combat system into code, I hope to do it sooner. I hope it will come close to recreating soem of those fond memories I have.

Monday, November 12, 2012

Isometric Screen To World Coordinates

I struggled with this topic for a few days, to the point where I think I lost a few brain cells. When using a square grid it's very easy to click a mouse and know exactly where you are in your game world and which tile you clicked on. However, the math and dynamics change when it's an isometric grid and a grid tile is a 2:1 ratio, ie it's 128 pixels wide and 64 pixels high.

See the graphic below for an example.


Notice the blue square that is selected. Wrote some fairly involved code several different ways and just couldn't get this right. When I clicked near the middle of the tile I knew exactly which X and Y tile had been clicked, my code worked fine. However, when I clicked in the corner the problem became clear because my  logic thought I had clicked in the next tile over. I looked at this 10 different ways and just couldn't get my head around it. How?

Then I found this article while searching for an answer and it became clear. If you scroll down the page you will see the author talk about a rectangle graphic that's 5 colors. It took me a little bit but I understood the logic behind it. In Blitzmax this was fairly easy to do. When I clicked with the mouse I calculated which of these rectangles I was clicking on (I didn't actually display the graphic). Once there I calculated where in the actual rectangle I was clicking on and then pulled the color out. If it was white, I was clicking on whatever row I had coded in the grid. However, if the color was red or green, I knew I had to subtract the row. It worked great and now my world selection worked 100%. Phew!

Friday, November 9, 2012

Blender, choking on it

I learned a lot about Blender yesterday and feel confident enough to start making basis shapes. What I'm really choking on is painting textures and this whole UV unwrapping business. I have more questions then answers at this point and I still don't quite understand it. I wish I could just taking a 3rd party texture, paint it on a face and be done with it. I suppose that's how it essential works but I'm still a bit lost.

I think I'm going to spend a few hours coding in Blitzmax and let all this new blender knowledge sink in a bit and start again either tonight or tomorrow.

Thursday, November 8, 2012

More Blender Goodness

I'm working from home today with no client calls so I've spend the last few hours going through Blender for Dummies and I become intrigued more and more. I was always very intimidated by Blender and thought I could never learn anything about it even though I always heard good things about it. While I'm still a Dummy all the way I see how streamline it is and I know, in theory, how to create isometric objects.

I have no doubt when I start using it I'll stumble and forget the million keyboard shortcuts for it but I have to keep reminding myself I don't need complex objects so I can get by on the more simpler tasks. I'm also confident that after a few weeks of using it I'll be become more comfortable with it.

Hopefully I'll make it to the chapter on applying textures. I also have no idea how to correctly setup two cameras (I just know how to setup one camera), I assume that will be easier then rotating the object at both angles.

Wednesday, November 7, 2012

Blender 3D and Isometric Tiles

I like SketchUp a lot and wish I could use it but it seems that I can't. First, it doesn't allow you to output a 2D image exactly how you want it and adjusts it for you. Based on a few forums responses I got from my thread, the Iso camera isn't exactly a 2:1 isometric ratio. I created a simple floor and attempted a bunch of times to get it working in Tiled (I'll talk about that next) and couldn't get it to line up right. I wish I can use SketchUp but I'm tired of wasting time.

Enter Blender. I found a few tutorials on making Isometric tiles with Blender which was encouraging. When I first opened it, I stared at it for about 5 seconds and closed it. All I saw was numbers, lots of numbers, and panels and descriptions and so on. Not for me, way way too complicated.

Ok but I can't use SketchUp so I have to use something. I don't think it's going to be within my future undecided budget to outsource every piece of art. With a grand scale RPG that's going to add up fast. I bought Blender for Dummies. Slowly it's all starting to make sense to me when you take it apart. Granted, I'm not going to use 90% of what Blender has to offer. I don't care about the animation, skeleton rigging and so on. There are a ton of options that I have no idea what they do. Sometimes I have to reload Blender simply because I can't figure out how to undo something I did.

Where was I, oh yes. When you strip away the other stuff blender is shaping up to be exactly what I need it to do. I'm not making complex scenes with all sorts of light, people, animation, etc. I can output exactly the size tiles I want and I just need to manipulate shapes. I'm still reading through the dummies book on my Google Nexus 7 and haven't even reached the part on how to texture shapes but I'll get there.

The real hard part is going to be making some walls. Walls are easy, making walls that will interlock on a isometric grid is another story entirely.

Monday, November 5, 2012

I'm a newb indie dev and proud of it

I'm not in the habit of blogging, I keep thinking nobody is really interested in what I'm doing. On the other hand, I think I do have some interesting things to write about and it's my dream to publish this game eventually so why not. Maybe some day when I become rich and famous I'll look back at some of these and say yea I can remember those days. 

Ok so what game am I working on. Right now I'm referring to it as Apoc even though that won't be the release title. It's a game set in a, you guessed it, post apocalyptic world. The view will be isometric, yes old school, and combat will be turn based. 

You will control a group of 4 player characters in this wasteland. There will be lots of items, guns, enhancements, skills and upgrades. My aim is to have a few hundred missions in the game, hopefully I can make them interesting. I have a few ideas for the overall plot but not going into that right now. 

I'm programming in Blitzmax so that means PC and Mac. Sorry but I don't see the point of learning how to write games on a tablet so I can sell them for $1. This is an old school RPG that is meant to be played on a screen with a mouse and keyboard. 

It's also a part time effort meaning I code in my spare time at nights and weekends. I wish it could be fulltime but I have to pay the bills somehow. I've learned many things about programming and the skills needed to build a game so I'll be talking a lot about that in the next few blogs.