A blog detailing the creation of my FPS engine.

Wednesday, May 26, 2010

Interfaces...

A few of the current interfaces being developed in my engine.
In my previous post I stated that my engine would maintain abstractness from the physics engine. Well that was mostly true. I want almost total abstraction from everything but SunBurn (it's quite abstract to start out with). So I started to plan how all the objects would interact in the engine and how to make code that is reusable. Actually all code is reusable, just copy and paste and modify to work. Problem is if you use that method of code reuse you end up changing your original design and have to go scan through all the times you pasted that code to make the change and then figure out why it doesn't work everywhere. Good programmers use Object-Oriented design techniques to isolate code into reusable chunks. C# is no exception to OO design, in fact C# highlights this feature with the introduction of Interfaces. Because C# only allows one base class to be inherited (I know, that sucks), interfaces became a necessary item.
Anyway, I won't go into crazy detail, but lets just say I am using interfaces for as much as possible in my engine. This will allow any class in the engine to potentially perform any action. For example I have decided to include the editor in the game engine. This led me to decide to include an IEditable interface that defines everything an object must implement to be editable. Then when I create my scene object class I can simply implement the IEditable interface and then that object will become editable in the game engine. Then later when I add a light object to make that editable all I need to do is implement IEditable for it as well.

No comments:

Followers

Blog Archive

About Me

Cortland, Ohio, United States
I'm a self taught game programmer currently serving in the Ohio National Guard and working a full time job at the Unit Training and Equipment Site. I spend all day repairing M1 tanks and other military vehicles. My life long goal is to one day become a professional game programmer/designer.