Monday, February 28, 2011

The Milestone

Last week I accomplished quite a feat. I made it to my personally defined 0.4 milestone!

Now this was quite something for me. It took a lot of effort to accomplish all the things I had planned for this milestone. For one, the Editor is now usable in a reasonable fashion. Sure it crashes when you click on uninitialised toolbox buttons, but that's a minor detail. The GUI looks nice, I've got sprite-based buttons as well as rectangular buttons with text. I got the features in the game engine that I wanted and I even scraped some last minute animations in there.

For next week I plan to pick things up again. I took a little break after reaching 0.4 and gave it to a few friends of mine who picked and commented on it a little. One such comment influenced how a jumping character handles. These sorts of comments I tend to value as that's one of the first things that you get blind sided on from playing with the build for so long. You tend to notice subtle things less like how character movement 'feels'. Mostly the comments have been on par with what I've been going for so I guess I'm on the right track.

Next week I'll start implementing doors and switches, right after I fix how "Hurt" objects are handled, which currently don't respond very well if you're bumping into them from the sides. I think doors and switches will be one of the first changes to a more complex and entertaining object palette with which to build engaging levels. I've got big plans for the future... well... y'know. Big within reason.

See you next week!

Oh, and for those who care, here's the monstrosity that is 0.4's changelog.





Main v 0.4 (unreleased)
- Added smooth scrolling of the screen.
- Gave Player character arms and a gun.
- Player animation subsystem implemented.
- Currently the legs animate and can be controlled individually.
- Reimplemented level structure, it's now it's own class.
- Sepperated the player into it's own source file, it was getting too undwieldy.
- Player no longer dependant on the tile class, collision triggers from main loop.
- Added Goodies to the game. These are pickups that help the player.
- Goodies are now rendered, interactive and loaded from the level file.
- Implemented a basic GUI to display player health/lives/score
- Added a static backdrop to make the level appear less plain.
- Made goodie collision more accurate.
- Added hazards that can hurt and kill the player.
- Started the CubeWars Editor. An application to more easily build levels.
- Added function to save level & player states to file.
- screen.draw() function now takes argument which defines the framerate cap.
- Complete restructuring of source files. Sepperated GUI functions and window manager.
- Also, as part of the restructure, Editor and CubeWars now share dependencies again.
- Finished "graphicalinterface" reimplementation. Made functions accessible to Main.
- Fixed a bug in the scrolling routine that got it stuck near the edge of the level.
- Goodies and static objects can now animate at 3 basic speeds.
- Moved the animation handling to WindowManager. No use having thousands of copies of that during runtime.
- The Coin and Life powerup now have animations.
- Losing all your lives now causes 'game over'. Currently this just brings you to the Title screen.
- Reduced friction while Player is airborne. This causes more realistic jumping behaviour. (Thanks Martijn!)

- EDITOR: Version 0.1
- EDITOR: The Editor shares all classes and functions with game core.
- EDITOR: Added class to track mouse actions and positions.
- EDITOR: Added classes for buttons and buttonpanels to act as GUI elements.
- EDITOR: Using the mouse, tiles can now be picked from panels and placed in the level.
- EDITOR: Also wrote sweet-ass 'snap-to' logic.
- EDITOR: Redid the GUI layout and wrote button sorting functions.
- EDITOR: Created art for the new GUI layout.
- EDITOR: Moved a large number of variables and functions to a 'graphicalinterface' class.
- EDITOR: Rewrote most, if not all, of these functions.
- EDITOR: You can now scroll freely around your level at 2 different speeds.
- EDITOR: Added redundancy check, eliminating multiple tiles at the same coordinates/drawlevel.
- EDITOR: You can now place Player Start, all current goodies and the Hurt static actor.

Tuesday, February 22, 2011

Re-arrangements

So this week I did a lot of reorganization code-wise.

I moved a whole bunch of code around between files, trying to find a good configuration with as little dependency overlap as possible while giving each class or function access to the other classes and functions that they would need access to. It was a bit of a shuffle but I'm happy with how things are now. I'll most definitely do this a few more times over the lifespan of the project, but that's what you get when your aim is mostly short-term progress. The upside to this approach is that I'm fixing problems as they arise, rather then trying to set up a structure to prevent every problem I might possibly encounter. The later is the reason another project is currently in limbo. This whole experience should give me some great insight in how to structure a project, which will be invaluable the next time I start, or continue, a project.

To not bother you too much with specifics on this, let me just leave you with the schematic I drew which helped me organize my code in an adequate fashion.

On to things I did that have a more practical result in the program. I redesigned the Editor layout (see screenshot below) so that you can easily pick a tool from the toolbox and then a brush and get to building. This whole ordeal brought on the creation of a system that handles drawing and manipulation of on screen buttons and panels, as well as mouse handling. You can see these in the above schematic as 'Graphical Interface' and 'Mouse' respectively.

The Cubewars editor currently only works to place world tiles, so you can make a maze to maneuver through or make jump puzzles or whatever. I'm currently getting the static_actor and goody classes to work as well, but that was a little less straightforward so I'm still on that. It should be implemented by next week. I've also figured out how backgrounds will be handled. In your level you can simply define which background # to use, and the game loads the bg#.bmp file that corresponds with that number. It's really simple stuff.

I also fixed a truckload of bugs and worked out a ton of kinks everywhere, but that's so specific it ceases to be relevant reading for anyone but myself. Rest assured though, awesome things happened behind the scenes.

Though, on a last note, I do hope that I can do some more visible things in the coming week. It just feels more rewarding to say to yourself that you got X in the game.

See you then!

Monday, February 14, 2011

Death and creation

So this week was rather busy. I seem to be doing that off and on. We're working on a grand awesome project, me and some friends, and I'll announce that when we have something to announce. For now there's just 1 word you need to remember: Thorworks. That's right.

Regardless of these things I still managed to do quite a bit of work on CubeWars. I continued implementing objects, now adding a static actor class. This class will encompass all objects in the level (save goodies) that do not get their logic processed without direct player influence. This would include things like buttons, doors, hazards and the like. Anything that doesn't do squat unless you interact with it or just bump into it. I already made the Hazards work and also implemented dying. I already have plans to have the player explode into gibs when they die, but that's cosmetic and will come at a later time.

Aside from some tweaks to collision for non-tile objects, the major change I made this week was to something I had figured I would add at a later time. I'm talking about the level editor for CubeWars. Originally I had planned this for the Beta release, or whenever I would be needing it more to start making levels, but modifying my levels through a text editor became too unwieldy and I figured I might as well do it now. Rather cleverly, I made the new Editor core depend on the game source files so I wouldn't have to redo those and if I make any changes/additions to them, I don't have to go to great lengths to make it work in the editor.

There are a few things which are needed for the Editor which are mostly done now. First is mouse control. CubeWars will play completely with a keyboard (or controller) and doesn't use a mouse, but the Editor kind of depends on this so I started a class that would hold the mouse position, if it was clicking, what 'brush' the user has selected and so on. After that I added a 'button' class for the GUI and a panel that would hold multiple buttons. Using these simple elements I can easily craft a simple interface that would make building levels a cinch.


I tell ya though, the biggest challenge was figuring out how my makefile would build 2 projects with slightly deviating dependencies. That ended up being real simple though, just like when I ran into some trouble with dynamic arrays causing segfaults. I love programming, don't you?

See you next week!

Monday, February 7, 2011

It's beginning to look it

This past week I've done a ton of work on Cubewars. First off I started doing some reorganizations with the code. I created a class for the level (rather than having all the variables for it lying around) and updated all the code relating to that to take advantage of this. I also moved the Player class to it's own source file as it was getting a bit big. For this to work I had to remove it's dependency on the tile class (which it interacts with for collision checking) and made the whole thing a lot more clean as a result.

Yesterweek I also mentioned that I was working on an animation subsystem. This is now finished (for the legs at least) and I even went so far as to have the legs animate independently. This is really great as I just need to draw frames of 1 leg walking and I can just duplicate and offset where it is in the animation for the other leg. Presto! You now have a walking animation. I already drew some frames but am not too happy about them yet, so I will end up redoing those before release.

I finished the 'goody' class, which will represent objects that are beneficial to the player. Such things include health, lives and items that increase your score (yes, I'm going down that path). I had a bit of a scuffle with this but it works perfectly now barring a minor issue that I discovered while working on the HUD. Oh didn't I mention that already? We have a proper HUD now. On it are the things I just mentioned that can be affected right now. I spent some time frogging with it before I found the right orientation for all the individual components, but I'm pretty pleased with where it is now.

Also, just 5 minutes before I started writing this post, I threw in a backdrop, it makes the whole thing seem a lot less plain then the stark black that the level is drawn on. I'm not sure if this will end up in release, but I'm definitely looking into the possibilities I have with such a system.

Here's a screenshot of how the game looks now.


Whew, that's a lot of stuff for one week. Things are really going well. Every time I'm doing other things (such as StarCraft 2, gotta get Master League) I'm already looking forward to working on this bad boy again, so that's nice for a change. Let's see how the next week pans out.

See you then!

Tuesday, February 1, 2011

Small fry

This update will be brief, I've been busy this week.

I spent most of the time implementing and, consequently, fixing smooth camera scrolling. It now works in a way that I like, so that's covered. In doing this I also found and fixed some bugs related to tiles and the player character's position relative to the screen's offset. I also started to implement items when I realised I only had 1 static look for the player character. Being a bit OCD about stuff like that, I started figuring out how many more frames I need to 'reserve' to cover all the player's animation before I can start dedicating space on my tile sheets for non-player objects. For this reason the player character currently has arms. An animation system will follow shortly.

I also started work on redoing my level implementation. As it is now the level is just a number of pointer arrays for the tileset. Another array was going to be added for goodies when I realised this would create a whole cluster of level specific variables and those would probably have a better home in their own class. So I'm writing that and reworking the rest of the program to use this new level class.

Progress is good. I'm feeling comfortable with how things are moving along.