Tuesday, October 4, 2011

Collision Detection and Response in Platformers

Working on my platformer, I came across the inevitable problem of collision detecting. This sucks so hard because lately I've been just winging it with basic theorems and such. I came along the Separation Axes Theorem which checks the collision between two convex polygons, which is exactly what I needed. The makers of N, metanet, have provided a sophisticated tutorial on how to accomplish such a task with the SAT.

source: http://www.metanetsoftware.com/technique/tutorialA.html

Saturday, April 30, 2011

Project Management: Using Redmine

You are an average indie developer. You come across a few friends who wish to join you on your quest to becoming a successful game developer. Days, months, maybe even a year or two pass by, and you are relying on skype chat and google docs to develop a video game. Sure, it may get you what you need for a small game, but what happens when you want to expand your project? Tread uncharted territory? Take on bigger challenges that require bug testing, version control, team management, and other important additives?

Welcome to Redmine, a flexible project management web application. Below are some of the features of Redmine:

  • Multiple projects support
  • Flexible role based access control
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications
  • Per project wiki
  • Per project forums
  • Time tracking
  • Custom fields for issues, time-entries, projects and users
  • SCM integration (SVN, CVS, Git, Mercurial, Bazaar and Darcs)
  • Issue creation via email
  • Multiple LDAP authentication support
  • User self-registration support
  • Multilingual support
  • Multiple databases support
If you head over to the Redmine main website, you can check out all sorts of stuff, including demos of users using Redmine.

The game development company I'm working for is currently using this webapp, and boy is it useful. Managing a team of 30 can be hard work, and with a webapp like Redmine, a large group of people can stay organized.

Tuesday, April 5, 2011

"Streets of Rage" Remade by Indie Dev

Promotional pic from the website itself
 I was just heading to bed when I discovered the release of an AMAZING remake of streets of rage! The developer, BomberGames Soft, took on an outstanding 8 year project. My god, everything about playing this remake made my spine shiver, my nerd senses tingle, my fingers eager, and my heart so warm it was like my first kiss.

Here are some screenshots:

A brand spankin new character screen

A route map!!! This guy thought of everything!

And oh my god the detail!!!
And for comparison:

SNES character select screen

SNES stage one

Streets of Rage Remake is a project created from scratch, it does not use reverse engineering nor a single line of code from the original games. It’s all based on visual interpretation, comparing how things work in the original games and trying to mimic it for Streets of Rage Remake.

Some of its functions:
* Animation timing, animation positioning, control response, X/Y/Z positions and physical movement for all characters are accurate to the original games.
* 64 modules of ..

Click here for more info and download links...

Wednesday, March 30, 2011

Hawken Development

This is what the devs over at http://www.hawkengame.com/blog/ are working on.


This game emulates reality so well, I almost got motion sickness from watching the video. It makes me tear up seeing how far graphics have advanced. I MEAN COME ON, DYNAMIC SHADING ON THE HUD WHICH BY THE WAY IS EMBEDDED INTO THE MECH, A++ GAME ALREADY.

The only thing that could make this game better would be destructible environment; other than that, this game is insane! I would give everything to work at their studio to work on Hawken.

Collection of Websites for Gamemaking in general

I have here a list of websites that may be use to some game makers out there

This is a list that is un-organized and may not be of use to you, but is good to check out.

Francesco's knick-knacks
desc: This website hosts a Gameboy Advanced SDK. Its cool to check out, i made pong and ended up working on my GBA emu.

Aaron Stebner's Weblog
desc: This blog by Aaron Stebner contains valuable information about how to do great things in XNA from the mind of a developer.

desc: A pretty good Game Maker developer, he has some useful plugins, some-what useful programs, and some games to look at for reference.

Blue Rose Games
desc: Blue Rose Games has a great beginner tutorial for XNA on 2D and 3D game programming, as well as Silverlight for those interested in MSN games.

Catlin's XNA Blog
desc: This XNA developer may be average, but has created some interesting blogs about certain techniques in XNA from a beginner's perspective.

Metal Slug Sprites
desc: A sprite site I used when making a Metal Slug remake for Game Maker. Contains most of the sprites seen in-game in .GIF form, as well as some sprite sheets.

RB Whitaker's Wiki
desc: This is by far my favorite collection of XNA Tutorials; those that make sense the most, and have taught me the basic fundamentals the best.

Riemers XNA Tutorial
desc: If you have ever asked:
"How do you program terrain generation like in Worms or Minecraft"
this may answer your question. These are also great beginner tutorials on 2D and 3D game programming in XNA.

Safari Books Online
desc: This website has thousands of e-books available for online view (preview). Ive seen many programming e-books available on this website such as the Mastering Unreal Technology (http://my.safaribooksonline.com/9780768689006) series.

Sprite Database
desc: This is an incredible sprite database. I am currently using it for a metroid remake (no, it's not going so well).

The Video Game Name Generator
desc: Obligatory video game name generator.

Tile Studio
desc: Never used it, but my artist says it is a great tool for creating tile sheets for platformer games. Could also be possibly used in 2D RPG games.

Unreal Development Kit (UDK)
desc: The Unreal Development Kit (UDK) is an outstanding developer's kit to allow the developers to get past quite a few walls of development, and can also bring 3D games to life. A very tough tool, but mastering it may be the true start of your indie career. [/viraladvertisement]

XNA Resources
desc: Yet another website dedicated to starters on XNA.

XNA Tutorial
desc: Yet another BLOG dedicated to starters on XNA.

desc: This is an extremely crucial wiki for those XNA developers. It can be used as a resource guide when programming any game in XNA.

raven67854's Youtube UDK tutorials
desc: Most guides on the UDK can be confusing and troublesome to the common beginner. This youtube series can be argued as a godsend to those struggling to learn the UDK.

desc: FlatRedBall is a great 2D engine used in XNA, and can simplify the process of many 2D games.

Setting up a 2D Game Camera in XNA

I actually took some of the code from a few websites, but this shit was incredibly hard to find, so i put together what worked for me for you guys :3c

The Camera2D class
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

    public class Camera2d
        protected float _zoom; // Camera Zoom
        public Matrix _transform; // Matrix Transform
        public Vector2 _pos; // Camera Position
        protected float _rotation; // Camera Rotation

        public Camera2d()
            _zoom = 1.0f;
            _rotation = 0.0f;
            _pos = Vector2.Zero;

        // Sets and gets zoom
        public float Zoom
            get { return _zoom; }
            set { _zoom = value; if (_zoom < 0.1f) _zoom = 0.1f; } // Negative zoom will flip image

        public float Rotation
            get { return _rotation; }
            set { _rotation = value; }

        // Auxiliary function to move the camera
        public void Move(Vector2 amount)
            _pos += amount;
        // Get set position
        public Vector2 Pos
            get { return _pos; }
            set { _pos = value; }

        public Matrix get_transformation(GraphicsDevice graphicsDevice)
            _transform =       // Thanks to o KB o for this solution
              Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                                         Matrix.CreateRotationZ(Rotation) *
                                         Matrix.CreateScale(new Vector3(Zoom, Zoom, 0)) *
                                         Matrix.CreateTranslation(new Vector3(/*Application Window Width*/ * 0.5f,
/*Application Window Height*/ * 0.5f, 0));
            return _transform;


Then you implement it as follows

Camera2d camera = new Camera2d();

camera.Pos = //some vector2 that represents a position
camera.zoom = //some float that represents a zoom. anything > 1 will be "zoomed in" and anything < 1 will be "zoomed out"


Then when you go to call the spritebatch.Begin function, you use the following overload



that should be it :D

Some things like the mouse position from Mouse.GetState() is not relative to the camera, so you have to add some logic like

mouseLoc = new Vector2(curMouse.X, curMouse.Y) + (camera.Pos - new Vector2(ScreenWidth / 2, ScreenHeight / 2));

to get the mouse position relative to the camera.

Sunday, March 27, 2011

Optimizing your Game Code: Using Pools

Using pools is a standard technique in game programming. If you ever played a Real-Time Strategy game (RTS) like Starcraft, Halo Wars, Age of Empires, etc.. then you have experienced an "object pool".

In Starcraft, you construct a base, manage an economy, and train military units to tear down the other opponent until either all their buildings are gone, or until they leave. Each unit you train has a designated "food usage", meaning that you may create a unit until you run out of "supply", or your food count is lower than the required food usage. To manage this, you create supply buildings (or in zerg's case, Overlords) to increase your supply. However, you may only have a maximum of 200 food. This is called an object pool.

In Starcraft, you may use a maximum of 200 food. When a unit dies, it no longer uses that food.

You can think of the object pool as an array. You have this array of 10 circles as such:

Circle[] circles = new Circle[10];

Now, say you want to use 3 spots in the array to create 3 circles, so you would type:

for(int x  = 0; x < 3; x++)
     circles[x] = new Circle(3.4f); // 3.4f would be the "radius" in this case

Now say you wanted more than three, you would simply designate which "empty circle" you want to use to contruct a new one.

circle[6] = new circle(4.2f);

But what if you want to "destroy" one of these circles? Well, when using pools, you don't actually "destroy" an object. You simply just change its properties to make it what you call empty.

circle[3].radius = 0;

Or you can create a boolean variable "IsActive" to let the program know if it is active or not.

circle[3].IsActive = false;

When you have a property like this, you can make a constantly running function that runs through all the objects (circles, in this case), check if it is active, if not, do not use (in video game design, you can tell the engine not to render the "circles" that are inactive)

void CheckCircles()
     for(int x = 0; x < circles.length; x++
               circles[x].Draw(); //If the circle IS active, then the engine will draw it on the screen

The reason why "pooling" is standard practice is because it is an efficient way to handle multiple objects. Why would you want your game to constantly create hundreds, even thousands of objects, and then just get rid of the memory? Why not just re-use those objects? If you have any questions about pooling, please post in the comments.

Sunday, March 6, 2011

Automatically increment revision with each build in Microsoft Visual Studio 2005+

This works in MVS 2005, 2008, 2010, so far what i've tested.

In your project, go into the AssemblyInfo.cs of the project you want to edit, located under:
PROJECT NAME -> Properties -> Assemblyinfo.cs

and change the line:
[assembly: AssemblyVersion("")] 
[assembly: AssemblyVersion("1.0.*")]

This will give you a more accurate version number, based on the amount of changes and the amount of builds.

In my earlier post, you can see some made up number i used for my project build in the top left. This is the result after changing the assembly info: