4 Hugues Ross - Blog: DFEngine Update 3
Hugues Ross

5/24/14

DFEngine Update 3

Sorry for the late post! This one took a while to write up.

Changelog:

  • Finished Lua integration
  • Added some basic collision checking
  • Added a special component to hold user-defined data.
  • Made a basic prototype for a new game (!!!)

Lua:

This was a bit of a pain to figure out, but lua scripts can now be attached to entities. Instead of running my stupid little scripting thing from AMAZE, entities now have access to a fully featured scripting language. In fact, all of an entity's data gets exposed to the lua scripts, so you can mess with pretty much anything as you please now. Global game functions are also accessible, so you can now do crazy things like entities that can add components to themselves when certain conditions are met. I can't wait to explore the new possibilities that this will open up for me.

Collisions:

Currently, collision checking is very basic. The engine can only handle basic AABB collisions at the moment, making it even worse than what AMAZE had. I'll improve this eventually, but for the moment it'll do. Since it's been a while since I've posted anything particularly technical, I think I'll explain AABB collisions here: 
AABB stands for Axis-Aligned Bounding Box. In other words, an AABB is a rectangle that surrounds something without rotating. In order to check if two AABBs intersect, you just need two diagonally opposite corners from each, generally the position of the top-left corner, the width, and the height. From there, you only need to make four checks. If they are all true, then the two AABBs overlap. Otherwise, they do not. Here's some pseudocode describing these checks:
Rectangle1.x + Rectangle1.width >= Rectangle2.x
Rectangle2.x + Rectangle2.width >= Rectangle1.x
Rectangle1.y + Rectangle1.height >= Rectangle2.y
Rectangle2.y + Rectangle2.height >= Rectangle1.y

The first two checks ensure that the left/right sides of the rectangles touch. The other two do the same for the top/bottom sides. This is easily the quickest and easiest way to check for collisions, and often an AABB check is enough. It's generally quite inaccurate, however, to use a rectangle to describe most objects. For more complex shapes, more precise calculations are needed. I'll describe the methods of checking other shapes as I add them to the engine.

The New Game:

So, you're all probably curious what this new game is! First though, I'd like to explain how I came to my decision to make it. After AMAZE was done, I felt that one of the biggest issues I'd run into in terms of DFEngine's development was the size of the game. DFEngine's code was supposed to be updated regularly, but because my first project ended up being too big I ran into some issues. This became especially true once I started working on the game's levels. At that point, an update could force me to redo tons of work, and I started dreading engine updates. Thus, I want my first game with this new engine to be short and easy to make. With that in mind, my first game will be..... Akradion! This will be a simple breakout-style game, and I'm not putting any upper or lower limit on the number of levels. In the end, Akradion will probably end up being more of a minigame, with around 5-10 levels. To see if I could actually make this game, I threw together simple prototype yesterday. It was extremely basic, and it had a few bugs, but the fact that it took me so little time makes me very happy. If I'm lucky, I might even be able to finish the game in a month! I'm not making any promises there, though. (By the way, the name Akradion is actually an anagram of Arkanoid)
Post a Comment