I moved to a new URL! Check it out!

posts tagged with: programming

Dev Log: Going Data Driven

Dev Log: Going Data Driven
I've been making a lot of progress on tackling this system I want to implement for my next game. Since yesterday I decided to scrap a bunch of code in favor of going for a data driven approach. Lars gave me the final push I needed to go for this method of content.

My initial design of the code structure was going to be object or class driven for specific content. For example I had a namespace and a folder set up for "Weapon" and inside Weapon there was a "Base" class for any sort of Weapon. Then I made a few classes that extended the Base class inside the Weapon namespace which then changed values and added their own code to various functions.

This seemed like a good idea at the time. Using classes and extending base classes for specific functionality is something I do a lot in my games. It makes sense for a lot of things, I think. Like enemies. The enemies in All the King's Men for example are specific classes that extend a base Enemy class to implement their own specific functionality.

As I began to think about all the possibilities for gear, weapons, enchantments, and whatever else in my game, I was pretty grossed out by the thought of having a billion classes in my project for each single one. After thinking it over I ripped out all my old code for content and started on replacing it with one class for each different thing, and having a factory that instantiates objects using data from various data xml files.

I'm more excited about this method since so far it feels cleaner. The code to parse everything out of the xml for each object is pretty ugly, but editing content should be pretty easy with this structure in place. I can also use the xml files as a good guide on what to do next. Right now my work flow is to just start writing the xml data for whatever I can think I would want to customize for each thing, and then I start implementing each thing I've written. Working "backwards" like this can be a big help when working in a system where I have no idea where to begin.

More Otter Updates

More Otter Updates
Whoops! I really let myself go on the blog updating schedule. I've been still cranking away at some updates for Otter.

Image

The latest update that I've pushed includes some new stuff for rendering Images. Images can now be drawn by using only a specific source rectangle from the Image with the function Draw.ImagePart(). This resulted in me also making Draw.ImageWaveX() and Draw.ImageWaveY(). You can see those two functions in action up there in that image. Yeah, I know a shader can also do this, but I thought it'd be fun to do it an old fashioned way as well.

I've gone through and fixed some bugs in the new StateMachine<>() class as well. The new StateMachine<> lets you use any key you want to keep track of states, and if you use an enum for the states then it will automatically populate the states from the names of the enums and the matching names of functions. For example, if you have an enum with the name "Walking" the StateMachine will look for functions named "EnterWalking" "UpdateWalking" and "ExitWalking" to correspond with that state. This means less boilerplate code for getting a state machine up and running.

There's been some other minor clean up of bugs and I've been tinkering with things as I chip away at my next big project. The latest version of Otter is always available here. I wonder if anyone will use it for the upcoming Ludum Dare! That would be super cool.

Otter Updates: Effects!

Otter Updates: Effects!
Another round of Otter updates are here! I'm getting ready to go to a game jam for the weekend so I wanted to make sure I was equipped for making rad special effects for whatever I end up making (if I end up making a game, even.)

Image


* Added the Particle entity. It can be used to easily create particles with simple effects.

* Added the Flash entity. It can be used to easily create screen flashes.

* Added the ImageSet graphic. This is used by the Particle entity right now. Think of it as a very very simple SpriteMap. You can render one image from a set of images (a sprite sheet) but there's no automatic animations.

* Added various window options to the Game class.

I have a few more fixes I want to do before the jam starts including a small fix to the Axis class and possibly changes to the StateMachine class to use enums for states, but I don't know if I'll be able to get to those before the jam starts in just a couple hours.

Otter Updates

Otter Updates
I just recently pushed some updates to Otter with a lot of changes to various things!

* The Controller class had some changes to allow for recording and playback of input. This is best applied to controllers used by Sessions. You can now record input to a compressed string, save it to a file, and play it back. This probably only works in fixed framerate mode.

* The performance of the game is now more accurately reported.

* Started working on an ImageBatch class that will batch rendering of a bunch of images sharing the same texture into a single draw call (or will try to minimize the amount of draw calls.) I might end up switching all of Otter's rendering to this technique at some point, but for now I'll leave it up to the user to decide what to batch.

* Various bug fixes across the board, and updates to the documentation. Note that the most recent version of the docs is in the repository and the ones online may not be the latest yet.

More updates are on the way! I'm planning on using Otter for a game jam this weekend and we'll see how it goes.

Otter Documentation

Otter Documentation
Just a quick update about Otter! If you don't know already, Otter is a 2d game making framework that I'm making using DotNet/C# and SFML 2.

I just pushed a first pass at some documentation. This should be enough to at least help some people out with basic questions, but I'm sure it all has a long way to go. It's being generated from the source using Doxygen.

I'm going to be attempting to use Otter for a game jam coming up next weekend, and I can't wait to see either what I can make with it, or what horrible bugs will reveal themselves! I've been tinkering away on two different projects in Otter and so far so good, but you never know until your deep in the trenches of a game jam...

Dev Log: Boring Code Stuff

Dev Log: Boring Code Stuff
With the release of Otter I got a brand new handful of bug reports and other things to fix, so I've been busy churning away at those over the past couple of days.

My collision code for AABB test was off by just one pixel (because I guess I needed to use >= and <= instead of just > and <, oops) so I got that fixed up. I also fixed some other bizarre bugs in the collision code that was mostly caused by me just using the wrong variable for some things.

I recently changed the input components around to allow for external sources of input. This is a pretty cool feature that I personally like a lot because it goes along with one of my methods for making computer controlled entities, like enemies or characters or whatever.

As an example, I like to code all of my enemies in games as potential players... meaning that they control themselves with input from a controller just like a player would. Instead of just moving left and right by changing their speeds, an enemy will push left and push right on its movement axis, and then other code will read that input and change the speed. For some reason I like doing this a lot because it feels like the enemies are operating under the same rules as the player -- and if I ever wanted to give players control over specific enemies or characters I could easily do that!

Even Dinobaus from Offspring Fling is internally controlled by a fake controller that is being fed input by his "AI."

This also allows for people to potentially record input over time, and then play it back by taking external control of the state of Buttons and Axes, a feature that is often cool for replays, or attract modes.

The one bug I'm currently stumped on is that there is a crash when you close a game in Windows 8 in Debug mode when using an Intel HD graphics card. A very specific weird thing that I have to hunt down... and I have no idea what could be causing it! The joys of programming.