Friday, May 30, 2008

Extinctathon: Enemies and Dying


I've been working pretty hard on Exctinctathon, and I've started adding an enemy and dying. Right now, there's just one enemy (the purple blob), and he just walks back and forth in a sinusoidal path. If you hit him from the top, you kill him; otherwise, he kills you. Fun!!

I started out with an Enemy class that inherited Species, and while that was fun (if only because I got to type "public Enemy" a lot), I'm having better luck with making the on-screen enemies Species objects just like the player is. I might go back and change this again later, but I really need to read up on things like inheritance in C#. I think it's pretty obvious if you look at the code that I'm working with some sort of fundamental misunderstanding when it comes to that.

I still need to add other types of enemies, each with their own set of behaviors, and the ability to save the list of enemies with the list of blocks in the level editing system (right now the enemies are just hard-coded into the level). I need to see how to save multiple object types in an XML file. Shouldn't be TOO difficult.

Current short-term goals for this project:
1. Include enemies in the level saving and loading procedures (this is by far the most important).
2. Add a menu system and pausing.
3. Add some sounds and music to spice things up.
4. Add new enemy types as well as new blocks.
5. Clean up and document the code.

I think that's reasonable for now. I'll post again in a couple of days and we'll see how far I've gotten.

Project Files:
Extinctathon Project Snapshot, 05/30/2008

Video:
"Extinctathon: death and enemies"

EDIT:
I've added the ability to add enemies in the level editor. The list of blocks that was being used to add to the level has now been made into a generic list of objects which contains both Block and Species objects. WARNING! Very exciting video ahead. Here it is.

I need to come up with some better ideas for enemies.

Wednesday, May 21, 2008

Extinctathon: level editor saving and loading complete



Just a post to let anybody who's reading this that I've finished the level saving and loading features and they work quite nicely. The in-game level editor (still a work in progress--it's not very fancy at all) can save all the blocks in the current level as an XML file. I can then add that file to the project, where my Content Pipeline library converts it into a binary XMB file at compile time. My XMB reader then converts said XMB file into objects in memory.

Basically, List<Block> -> XML -> XMB -> List<Block>. Apparently doing it in this way is much faster than the easier way of simply writing to and reading from plain text XML files. When you're saving thousands of blocks, you end up with a good 2 or 3 megs of XML which takes far too long to parse.

I'll post details, code, video, et cetera a little later on.

Also, I should say that writing this took a good deal of work on my part, and once again the XNA tutorials were a HUGE help. However, while in the middle of this, the XNA site was down for about a day preceeding their big relaunch, and this was the first time I just NEEDED other people's help. I ended up getting it on the forums after the relaunch, and it helped me to understand some of the things that weren't clear to me before. In other words, "Thanks, internerds!" Where would we be without you?

Source:
Program.cs, Extinct.cs, Species,cs, Block.cs, BlockReader.cs (rar)
BlockPipelineContent.cs, BlockSettingsWriter.cs (rar)

Wednesday, May 14, 2008

Extinctathon: Level Editor



I've been working on Extinctathon pretty regularly lately, at least 2-3 hours per day, and I've updated quite a bit. I've got multiple types of background tiles (Block objects), I've updated the collision detection (it works about 95% as well as I want it to), and the beginnings of a level editor (as seen in the video). It's all in one program; you hit up on the d-pad to toggle between editing and debug modes (as seen in the upper right hand corner). In edit mode the shoulder buttons cycle forward and back through the types of tiles (grass, mountain, cloud, block), and the cursor is moved with the left hand joystick. Tiles are placed by pressing A.

I still have quite a bit to work on, including adding blocks that can be broken, blocks that can pop out power-ups, enemies, and all sorts of other stuff. The code needs cleaning up, too, and there's a good amount of commenting that I need to do before I move forward. The next step I'll be taking, however, is adding a level loading and saving system. I'd like to then make one semi-complete level so that I can test it out and then add enemies. I'll hopefully do that this week.

Source:
Extinct.cs
Species.cs
Block.cs

Friday, May 9, 2008

Project 5: Extinctathon!



Extinctathon is my newest project, and boy, is it a doozie (I just wanted to say that). Imagine Bioshock and Super Mario Brothers and Margaret Atwood all rolled up into one--that's Extinctathon.

So far it's a 2D side scroller with a rabbit-monkey hybrid that can walk and jump. It sort of has collision detection in that if you fall on top of something you stay on top of it and if you walk into something you magically appear on top of it because it's not really done yet. It takes input from the XBox 360 controller (just got two this morning) and moves the little guy around onscreen.

It's already big enough to occupy three (3!) source files, and it's only getting bigger. I've only spent 2 or 3 hours on it so far, so it's pretty limited, but I'm looking forward to working on it in the coming weeks.

I'll post more when I have the time.

Wednesday, May 7, 2008

Project 4: Solvle


Okay, so I'm pretty proud of myself for this one. Using the methods from my previous project, I added the ability to, given a particular arrangement of letters from a game of Boggle, find all the words possible according to the rules of the game.

This is accomplished by the same basic method that a human would use while playing the same game: starting with a letter, move on to the adjacent or diagonal tiles to find any English words. I used the ENABLE word list which is a free text-based Scrabble dictionary in exactly the format I needed.

The first working version of the search took a good 90 seconds on my computer, which seemed way too long for practical use. It was searching literally EVERYTHING, though, even after it would be impossible to find additional words. In other words, if searching on a path yielded "ASDF", which isn't a substring of anything, it would keep on searching all possible subpaths which would all yield nothing. One line of code later, and the search results are visible by the time the mouse button has been lifted up.

It works great, as verified by a few games of Noggin (I'm not a habitual cheater, I just wanted to test it out). The only words I didn't get were verified as not being in my dictionary file. Aside from those, Solvle found every single word on the list in a fraction of a second. Fun.

One thing I did differently this time is I tried to fully document the code as I was doing it. It's a good habit to encourage, so I'll make myself do it even though for most of this stuff I'll be the only person to see it. Still, the code could certainly use some tidying up, and some optimizations here and there. I'll take a look at it later.

With regards to what's coming next, I've been talking with somebody about moving on to Scrabble. That would be WAY more complicated, however, and I might want to do something a little lighter for the moment. My wired Xbox controller should be here soon, so I'll get to work a little more with XNA. I'm looking forward to that.

Source:
Solvl.cs
Solvl.Designer.cs
Solvl.resx

Friday, May 2, 2008

Project Update: Dictofunk

I've updated Dictofunk to add searching to the tree. It's fast enough that it updates in the time between keystrokes while typing a word. I'll post screen shots, details, and the updated source code when I get home.

Second update:
I've gone ahead and made the Boggle Solver program in the past couple of days based on the tree stuff done already. I'll pretty it up a big (both visually and in code) and post it later today.