Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!






Project Progress

Posted by ZBethel, 08 January 2012 · 797 views

C++ architecture
Entity Management

As of late, I have spent hours agonizing over the best way to implement my entity system. I am suffering a bit from neophyte syndrome trying to think through all the different scenarios and needs of my application. One particular mind block I kept running into was how to handle articulate physics entities. I do not plan to have animated skeletal animations in my game. However, there will be skeletal entities consisting of a hierarchy of physics joints and rigid bodies. Originally, I had considered doing a fancy schmancy component system that seems to be the current rage, but I've run into hitches with that as well, and I think I'm best off slowing down and trying to write something specific to the needs of my application.

First off, the terminology has been messing with me. There's actors, entities, scene objects, renderables, and who knows what else. I think I've decided to call the building blocks of my scene entities. For my game, there are two large subsystems that the entity system will interact with: the render and physics subsystems. There could be more, like an AI subsystem for instance, but I'm trying to keep it simple so my brain doesn't explode.

As a result, until I have better idea of the requirements of my system, I plan to forgo a formal entity system. I'll simply do things the old fashioned way! Once I have something working, I may try to make a game out of it, in which case I may opt for a more formal entity system. What I'm realizing though is that these tools are only useful if they make my life easier. If I'm designing a pretty simple single player physics sandbox application, I don't need a fully fledged game engine with a component based entity system to make it work.

More Project Details

So what exactly is this project I'm working on? Well, I thought it would be cool to experiment with more advanced rendering techniques in DirectX 11, at the same time, I would love to get my hands on a 3D physics engine and have some fun with it. Enter the tank sandbox! Don't ask me why, but I have this vision of an articulate tank physics model, and I really want to implement it. Something like this (except in 3D):

Posted Image

The world will be an assortment of static and dynamic simple objects. I'm planning to use an XML file to describe the world map. Basically, the player will be able to ride around and shoot stuff. Woohoo, sounds fun! This is where my engineering side dominates my creative side. I can't think of a good game idea, so I'm just going to create a fun and pretty sandbox application.

So what are my goals? Well, goal number one is to learn DirectX 11. This is my first project using it, and I wouldn't exactly be a good graphics programmer if I didn't know it though and through now would I? As I have stated in my previous posts, I really want to play around with Deferred rendering, a few different shadow techniques (say, Cascading Shadow Mapping for example), SSAO, HDR, motion blur, and depth of field. That means most of my time will be spent on the rendering side, which is what I want. Although the physics aspect is fun, I also chose it specifically to experiment with animation and add the challenge of balancing visual/physical aspects of a game object. So that's goal number two.

Formulating a Plan of Attack

With I have so far, I can pop up a window and initialize DirectX in just a few lines of code. Here's what my main function looks like:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
{
	// Create DirectX with the default adapter
	SGF::IDX11Graphics *graphics = SGF::DX11CreateGraphics();
	if( !graphics->Init() || !graphics->CreateDevice(0) ) return 1;

	// Initialize the window
	SGF::DX11SampleWindow wnd("Hello", "HelloWorld", 800, 600);
	wnd.Init(graphics, hInstance);
  
	while( !wnd.HasQuit() )
	{
		wnd.PumpMessages();
		// Do Logic
	}

	graphics->Release();
	delete [] graphics;

	return 0;
}

My next plan of attack is to write a basic resource loader for textures and meshes, followed by a mesh helper class. Deciding on a file format is always hard for me, but I think I'll go with .x, since I'm familiar with it. I will probably use something like Assimp to load it rather than write something myself. Next, I want to create camera class and get some basic meshes rendered. It would be a good morale booster for me to see something on the screen, so I think that's a good milestone.

After this, I want to create an interface for the physics system and start playing around with rudimentary scenes. Everything will be rendered and updated brute force, but just for testing purposes. It's always good to unit test sections of code to ensure that they work. It allows you the confidence to build on it with later systems. Once I have this up and running, I'll start looking into a world manager to manage scene objects and load/unload maps. At the same time, I want to research the best way to organize my rendering pipeline.

There is so much to do, but I just keep telling myself that if I cut it down into manageable chunks and shoot for modest milestones, things will get done. It's fun being able to do this in a hobby setting, because I can go about it less structured and more experimental. I will continue to update as I make progress. I hope to have some screenshots in the next week or so! Until then, later.




Looking forward to playing the sandbox game! :D Can't wait to see how the effects will look.
PARTNERS