Monday 30 August 2010

Defeating Math

This is one of the reasons I love programming, pure problem solving!
I have just finished the drawing part of the object maker. Apart from the fact objects can't yet be saved, we can now create any object we want from multiple tilesets if needs be (which by the way is not a feature you find in most map makers. In fact, I've never seen that feature at all before...go figure).

But at what cost? Well aside from various other trixy problems I've had to solve, this one was fun because it was pure number crunching. My favourite type of puzzle! Yeh, I know, I'm a big geek. Sue me.

The puzzle is as follows:
The program has been designed so that tiles from a tileset have a specific ID. For example:
This is a typical tileset. Notice the grey square in the bottom right of the image. This is the size of a single tile and therefore each bed takes up 2 tiles; one above the other.

Each tile has it's own ID, as an example I've drawn this nifty diagram:
Now keep in mind that computers work with pixels, so we must specify the dimensions of a tile...which could be different for every tileset, so the dimensions of a single tile must be able to change. The number of columns and rows per tilesheet may change. The tilesheet itself has dimensions that may change and the tiles that we have selected may also change. For example in the case above I may have selected a square of tiles (5, 6, 9, 10). Now what series of mathematical equationa can I perform for a tileset with X, Y dimensions on a selection of A,B dimensions at position P, O when a single tile is of I, J dimensions so that I get the result of the 4 numbers I just mentioned.
And you thought it was as simple as "take this and draw it" ;)

Enjoy!

P.S.
You can use incrementing numbers (or for loops if you're reading this ogre). By this I mean the first time you do the equation the number is 0. the second time you do the equation the number is incremented to 1. Do the equation again and it becomes 2 etc.
Solution will be posted when I make the next post, whenever that may be...probably tomorow

Sunday 29 August 2010

Back on track

The holidays are coming to an end and my mood for doing work is slowly increasing...In short, I'm getting back into the swing of things! Visual studio blowing up in my face repeatedly certainly made my enthusiasm drop, but the source of the problem has been sorted and even better, I've finished that particular part of the map maker. A grid is now draw on top of tilesets of any size the user defines. I'm also half way to being able to select parts of the tileset to be drawn.
At the moment clicking on the tileset will draw a red box around the tile clicked (the size of the box depends on what the user has specified the size of a tile to be). Clicking and dragging selects multiple tiles and unlike my previous map maker, you can now drag in any direction and the correct tiles will be selected.
There's still a few more things to do since at the moment the only thing happening is that a red box is drawn around the "selected" tiles (they are not truly selected, it just looks like they are). Next step is to move these selected tiles into a map or object space

Thursday 26 August 2010

Particles in action

Okay, so I've finished the particles system (or at least the testing of it) which means the code can be bundled up and stuck in a library ready to be part of the map maker and game. It seems that uploading the video directly to the blog isn't an option due to lazy servers or something...
I'm currently uploading the video to youtube so check back for the link. The video isn't of the best quality and doesn't get the best FPS but rest assured that the particle system itself runs smoothly and looks very pretty =)


Monday 23 August 2010

Drawing the line

Seeing as I don't have time to do any actual coding, I figured I would attempt to debug the exploding visual studio problem. The problem occurred with some code that was simply trying to draw lines. Once this bit of code is run once, visual studio cannot seem to recover even after several computer restarts. I did however manage to fix get visual studio working properly again by removing the entire form that contained the fragment of code. Once removed I could then re-add it to the project (I made a backup of course) remove the buggy code and run the program again normally.

This means that when I get the time, I can continue where I left off. Yayyyy!

Thursday 19 August 2010

Holy Smokes Batman!

Alrighty, been doing some freelance work recently and haven't had any time to work on games'y stuff, but just so's you know I'm still here and haven't given up on it here's a quick screenshot of the particle system I was talking about. Hopefully I'll have a bit more time once September kicks in. Also the freelance work I'm doing may find it's way into this project...you'll just have to wait and see what/how...

Thursday 12 August 2010

All the small things

It seems that restarting things has given me an opportunity to blow things drastically out of proportion (like I usually do). By this I mean the addition of a particle effects engine. I was going to be using particles for various spells and special effects during the game, but it has just dawned on me that I can use particles for various effects on the map as well. Rain, snow, chimney smoke and waterfalls to name but a few. It also means I don't have to start redoing everything I just lost right away as well! Always nice to have something fresh to get you motivated again! So it seems my first video will be of pretty pretty flashing lights, something to keep people happy at least ;)

Wednesday 11 August 2010

Next iteration please...

Well it seems that visual studio has officially gone 'blegh' as far as the project goes. I can't build/run the program without it freezing and some of the GUI aspects aren't updating. I always new I was going to start from scratch (just to keep things neat and tidy by re-factoring a few things) but it seem I'll have to start the next iteration earlier than I really wanted. It seems that I'll now be working throughout the rest of the holidays as well which gives me very little time to work on this. Be prepared for a long haul....

Monday 9 August 2010

They're coming outa the god damn walls!!

Squashed a few more bugs today. A load seem to appear every time I add something new to the program! Calling it a day for the moment as every time I seem to try and run the program visual studio dies on me. Bug with the program or with visual studio? Find out in the next post 'cause I can't be bothered to restart my computer to find out =p

The object maker window is now split into 2 panels to make it easier to resize the object but still have access to the required tilesets. The form resizes controls appropriately based on if the form has just been resized or if the tileset is to big/small for the current control size. I'm in the midst of drawing a grid over the top of the tileset preview and object for use of a 'snap to grid' option when drawing



Sorry for the slow progress! I watched the batman movies the other day and it put me in the mood to play batman arkham asylum again...what a game! Can't put it down!

Thursday 5 August 2010

I see the future...and it is problematic

Not had a lot of time to tinker today, but I've finally got a few bugs out of the way and I can now load mulitple tilesets. Once loaded the file name will appear in a list. Clicking any file name in the list will display that tileset ready for drawing. In the event that you accidently add the wrong image, you can also remove tilesets. Although doing this to a tileset that has already been used in a map would NOT be a good idea.

Anywho, as I was squashing some bugs it started to dawn on me, just how many bugs I'm going to find in the initial stages of this project. It is not going to be fun...

Tuesday 3 August 2010

Can't we all just get along?

This is the second time I've had an error that was nothing to do with my code being wrong. Makes it particularly difficult to debug!! It seems that certain versions of certain frameworks don't like playing with certain versions of certain builds. Yeh, I don't understand what that means either. Luckily Shawn Hargreaves over at the XNA forum has indirectly come to my rescue after someone else posted the same problem. Gotta be the 4th time he's helped me out now? damn he's good.

For all those who stumble here from google due to this error:
The "Message" task could not be instantiated from the assembly "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Build.Tasks.Message' to type 'Microsoft.Build.Framework.ITask'.
The "Message" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name


You can get the solution here:
http://forums.xna.com/forums/t/15214.aspx

Now that I've fixed that bug I'm now able to load images and store them inside the TilesetManager. Not going to do any more tonight because trying to fix that bug took a lot out of me! More to follow.

Sunday 1 August 2010

Beware the fast moving slug

Ok, so it seems that despite my last post I've done quite a bit. The only thing left to do is create the map classes. Which despite it's name making it look like it is the bulk of everything is actually quite a small part...but not small enough that I can be bothered to do it now. Once that's done I can start hunting down bugs, followed by showing off some funky pictures of how things are coming along!

Next steps will be setting up the GUI (graphical user interface) to sort through the mass amounts of objects I'll be creating, Sorting out maps and objects being drawn in layers (I.E the player walks behind the roof of a house and not on top of it) and of course saving and loading!

Give it a few weeks and I should have video ready to show off what the hell I've been upto!