![]() |
Platforms, Frameworks & Libraries »
Game Development »
Games
Intermediate
Endogine sprite engineBy Jonas BeckemanSprite engine for D3D and GDI+ (with several game examples). |
C#, Windows, .NET 1.1, GDI+, DirectX, VS.NET2003, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
Some of the examples are included in the source.
Endogine is a sprite and game engine, originally written in Macromedia Director to overcome the many limitations of its default sprite engine. I started working in my spare time on a C# version of the project about a year ago, and now it has far more features than the original - in fact, I've redesigned the architecture many times so it has little in common with the Director++ paradigm I tried to achieve. Moving away from those patterns has made the project much better. However, there are still a lot of things I want to implement before I can even call it a beta.
Some of the features are:
Some of the current GUI tools (editors, managers etc.).
I had been developing games professionally in Macromedia Director for 10 years, and was very disappointed with the development of the product the last 5 years. To make up for this, I wrote several graphical sub-systems, some very project-specific, but finally I designed one that fulfilled the more generic criteria I had for a 2D game creation graphics API. It was being developed in Director's scripting language Lingo from autumn 2004 to spring 2005, and since then it's a C# project..
The current engine design is not carved in stone, and I have already made several major changes during its development, and even more are planned.
Optimizations will have to wait until all functionality is implemented. The GDI+ mode is extremely slow, because I haven't ported my dirty rect system yet. The D3D full-screen mode has the best performance.
The code is poorly commented at this stage, as it is still possible I'll rewrite many parts. If there is a demand for documentation, I will create it as questions appear. For now, you can get a feel for how to use it, by investigating the Tests project.
There are two solutions in the download. One is the actual engine, including a project called Tests which contains most of the examples and code. I choose to include it in the solution since it's a little bit easier to develop/debug the engine if the test is part of it, but that's not the way your own projects should be set up. The MusicGame project is closer to how it should be done.
There's also a simple tutorial text on how to set up your own project.
I wanted to have a simple, but real-life testbed, so I'm creating a few game prototypes. Currently, they are Puzzle Bobble, a scrolling asteroid game, a golf/snooker game, CaveHunter, and Space Invaders. Other non-game tests are also available in the project. Turn them on and off by bringing the main window into focus and select items from the "Engine tests" menu.
Note: For using dialogs / editors, the Endogine.Editors.dll has to be present in the .exe folder. For sound, include Endogine.Audio.Bass.dll and the files in BASS.zip (shareware license).
To try out some of the examples in the Tests project, run the Tests solution and follow these steps:
numParticles, the bottom the size. The buttons switch between color and size schemes. After playing around with it, turn it off by selecting Particle System again from the menu.
ERectangle(F) classes, there's currently a bug which makes the ball stick in the wrong places. Will look into that later. (May be fixed.)
Prerequisites: .NET 2.0 and DirectX 9.0c with Managed Extensions (Feb 06) for the demo executable, and DirectX SDK Feb 06 for compiling the source. You can download SharpDevelop 2.0 or Microsoft's Visual Studio Express C# for free, if you need a C# developer IDE. Read the README.txt included in the source for further instructions.
Note that Managed DirectX versions aren't backwards nor forwards compatible. I think later versions will work if you recompile the project, but the demo executable needs MDX Feb 06.
I'm currently redesigning the workflow, and you would need a fairly long list of instructions in order to set up a new solution which uses Endogine, which I haven't written. The easiest way to get started is by looking at the Tests project. You can also have a look at the MusicGame solution, which is more like how a real project would be organized.
Most of the terminology is borrowed from Director. Some examples of sprite creation:
Sprite sp1 = new Sprite();
//Loads the first bitmap file named
//Ball.* from the default directory
sp1.MemberName = "Ball";
sp1.Loc = new Point(30,30); //moves the sprite
Sprite sp2 = new Sprite();
//If it's an animated gif,
//the sprite will automatically animate
sp2.MemberName = "GifAnim";
sp2.Animator.StepSize = 0.1; //set the animation speed
sp2.Rect = new RectangleF(50,50,200,200); //stretches and moves the sprite
Sprite sp2Child = new Sprite();
//same texture/bitmap as sp1's will be used
//- no duplicate memory areas
sp2Child.MemberName = "Ball";
//now, sp2Child will follow sp2's location,
//rotation, and stretching
sp2Child.Parent = sp2;
I'll be using the engine for some commercial projects this year. This means I'll concentrate all features that are necessary for those games, and that I probably won't work on polishing the "common" feature set a lot.
There will be a number of updates during the year, but I've revised my 1.0 ETA to late autumn '06. I expect the projects to put an evolutionary pressure on the engine, forcing refactoring and new usage patterns, but resulting in a much better architecture. Another side effect is documentation; I'll have to write at least a few tutorials for the other team members.
Currently, I put most of my spare time into PaintLab, an image editor, which is based on OpenBlackBox, an open source modular signal processing framework. They both use Endogine as their graphics core, and many GUI elements are Endogine editors, so it's common that I need to improve/add stuff in Endogine while working on them.
I've started using Subversion for source control, which will make it easier to assemble new versions for posting, so updates with new tutorials and bug-fixes should appear more often. Some probable tasks for the next few months:
Again, other projects have taken most of my time - currently it's the OpenBlackBox/Endogine-based PaintLab paint program. Side effects for Endogine:
Canvas, Vector3, Vector4, and Matrix4 classes.
I've focused on releasing the first version of OpenBlackBox, so most of the modifications have been made in order to provide interop functionality (OBB highly dependent on Endogine).
RenderToTexture.
Canvas and PixelDataProvider classes instead of the old PixelManipulator.
That's pretty much it. But don't miss OpenBlackBox, in time it will become a very useful component for developing applications with Endogine!
Some major architectural changes in this version, especially in the textures/bitmap/animation system. The transition isn't complete yet, so several usage patterns can co-exist and cause some confusion. Some utilities will be needed to make the animation system easier to use.
PixelManipulator - easy access to pixels regardless of if the source is a bitmap or texture surface.
PixelManipulator (adapted Smoke and Cellular Automata3 from processing.org - thanks Mike Davis and Glen Murphy for letting me use them).
TriStateTreeView - thanks Carlos. Added a TriStateTreeNode class.
IntervalString class (translates "-1-3,5-7" to and from the array [-1,0,1,2,3,5,6,7]).
Since the last update wasn't that exciting from a gaming POV, I decided to throw in a new version with a prototype isometric game. Totally R.A.D.
OK, it's over a month late, and it doesn't include stuff you might have been waiting for, and the things I've been working on - mainly creating two script languages - aren't that useful in their current state (especially with no good examples of their use). I think it was worth putting some time into, as I'm certain FlowScript will become a great tool later on. Here's what I've got for this version:
Map (probably a bad name) class - like a SortedList, but accepts multiple identical "keys".
Node class, like XmlNode, but for non-text data.
Sprite.Cursor property (works like Control.Cursor).
PropertyGrid instead of custom property editors.
VersatileDataGrid User Control (a new DataGrid control which implements functionality missing in .NET's standard DataGrid).
TreeGrid User Control - a bit like Explorer, but the right-hand pane is a VersatileDataGrid locked to the treeview.
BinaryReverseReader which reads bytes in reverse order (for .psd), and BinaryFlashReader which reads data with sub-byte precision (for .swf).
EPoint(F) and ERectangle(F) classes. Note that Puzzle Bobble doesn't work properly after the latest changes, I'll take care of that later. ValueEdit (arrow keys to change a Point), JogShuttle (mouse drag to change a Point value by jog or shuttle method).
EPoint(F) and ERectangle(F) classes. int (ROPs.Multiply instead of 103).
Point(F)/Rectangle(F) classes to my own EPoint(F)/ERectangle(F), which have operator overloading and many more methods. Note that I've chosen to write them as classes, not structs - i.e., they're passed as references, not values.
You can read about my early thoughts about the Endogine concept, future plans, and see some Shockwave/Lingo demos here.
I have added a Endogine C# specific page here, but it probably lags behind this page.
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Jul 2006 Editor: Smitha Vijayan |
Copyright 2005 by Jonas Beckeman Everything else Copyright © CodeProject, 1999-2009 Web19 | Advertise on the Code Project |