Cross-platform CRM32Pro SDK available for Mac OS X

CRM32Pro is a free SDK written in C++ and built on top of SDL that facilitates the creation of cross-platform games. Begun in 2001, the SDL-based SDK is perfect for quickly creating games in 2D with the option to use OpenGL to develop games in 2D/3D. For Mac OS X, the SDK offers:

  • Supports x86 versions: 10.3, 10.4, 10.5 and 10.6. Uses Quartz, X11 and OpenGL as video backends and coreaudio.
  • Support GNU C/C++ 4.x versions.

As mentioned, CRM32Pro supports OpenGL to accelerate 2D blitting operations. Other notable features include scaled surfaces with smooth filter, GUI, optimized collision system between sprites and surfaces, and automatic smooth sprites movement (using interpolation). The included editor however seems to be Windows-only.

Related Links:

New SDL_mixer Announced

SDL_mixer is a cross-platform sample multi-channel audio mixer library. It supports any number of simultaneously playing channels of 16 bit stereo audio, plus a single channel of music, mixed by the popular MikMod MOD, Timidity MIDI, Ogg Vorbis, and SMPEG MP3 libraries. This release features the following improvements:

  • Added Mix_Init()/Mix_Quit() to prevent constantly loading and unloading DLLs
  • Check for fork/vfork on any platform, don’t just assume it on UNIX
  • Fixed export of Mix_GetNumChunkDecoders() and Mix_GetNumMusicDecoders()
  • Use newer MIDI API on Mac OS X 10.5+

Related Links:

SDL 1.2 Released – Now Builds for Mac OS X 10.6

SDL is a free cross-platform multi-media development API. SDL version 1.2 now builds on Mac OS X 10.6 (Snow Leopard). Eric Wing posted a good rundown on the numerous changes. This release is intended to clean up the bug list for SDL 1.2 and lets the developers focus on new development for SDL 1.3! General fixed include the following:

  • Fixed flicker when resizing the SDL window
  • Fixed crash in SDL_SetGammaRamp()
  • Fixed freeze in SDL_memset() with 0 length when assembly code is disabled.
  • Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal up/down events for Caps-Lock and Num-Lock keys.
  • Fixed audio quality problem when converting between 22,050 Hz and 44,100 Hz.
  • Fixed a threading crash when a few threads are rapidly created and complete.
  • Increased accuracy of alpha blending routines.
  • Fixed crash loading BMP files saved with the scanlines inverted.
  • Fixed mouse coordinate clamping if SDL_SetVideoMode() isn’t called in response to SDL_VIDEORESIZE event.
  • Added doxygen documentation for the SDL API headers.
    Read the rest of this entry »

SDL Contest and Tutorials

SDL scrolling
Dev Hub is running a contest aimed at SDL programmers. The contest’s aim is to make a side-scrolling shooter. The contest is open to all game developers, and has requirements similar to uDevGames. The grand prize is $200 with a deadline of September 1, 2009. If this contest has perked your interest in learning more about SDL, head on over to Bright Hub for their series on SDL tutorials — and yes, they even teach you about parallax scrolling.

Related Link:

Homeworld SDL for Mac OS X

Homeworld SDL Mac
Back in 1993, Relic Entertainment released the source code to Homeworld, their 1999 3d space RTS blockbuster hit. Developers at Homeworld SDL have been porting the original code over to SDL so that the game can be played on Mac and Linux.

The Macintosh version is currently incomplete, missing some major components such as sound and pre-rendered movie playback. However the game itself is otherwise quite playable.

The Mac OS X playable is at version 0.9alpha.

Related Links:

Laserface Jones Postmortem

Background Info

After growing up wanting only to make videogames, and making a few small games with Pascal and later Hypercard in grade school, I released my first game for the uDevGames contest in 2004, called Kill Dr. Coté. It won the award for Best Gameplay, was a fan favorite, went on to be published by Freeverse, and got me my first job in the industry as a programmer.

Laserface Jones1

Since then, my output has been scarce. I quickly followed up with “Arachnoid: Predator of Worlds” in July 2005, but after that, working full time in the industry drained me and thwarted any progress on independent work. Several years passed, and during that time I first yearned for the energy to work on a project, and after that failed, I started to even doubt whether I would be capable of such a project and still keep myself fed. When I heard that uDevGames 2008 was starting, I figured it would be the best time to find out once and for all. While in 2004, my purpose was to prove my talent and ability to the world, this time around it would be to prove it to myself!
Read the rest of this entry »

FIDRIS Postmortem

Background

I seem to be spending more and more time on planes these days — often slowly taxiing around airports or waiting in a holding pattern to land! While idly staring out of the window I started thinking about what it must be like to be an air traffic controller, trying to get so many planes to land safely and quickly with only a limited number of runways and aircraft stands. Thus the idea of FIDRIS was born. Fast-forward several thousand years and you have a game where the object is to manage a space station, docking as many ships as you can given finite resources of time and space.

As one of the uDevGames voters commented “I’d say it was a creative risk to tackle the idea of this game”, and that’s definitely the case — at the start of the contest I just had this idea, but didn’t know if it would actually turn out to be ‘fun’ or not! What I did know was that it was a simple enough idea to be finished and polished within the three months I had available for the contest.
Read the rest of this entry »

Pygame 1.8 Released!

Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language. Pygame is highly portable and runs on nearly every platform and operating system. Pygame itself has been downloaded millions of times, and has had millions of visits to its website.

Nanocrisis Postmortem

Game Design: Scale down!

My first step in creating the game was to figure out exactly how it would play. I decided on making a 3D-platform game because I had not previously tried making a game of this genre. My intention was to make a game that would at least be fun for me to play, so I added a lot of RPG features, such as the ability to upgrade your character as you moved through the game. The original design was more similar to Secret of Mana, and two-player support was planned. This turned out to be much too lofty of a goal, so the game was ultimately single-player, and not anywhere near as long as originally planned. Thus, the same lesson you hear a lot in the Indie game world persists here—scale down your plan! There’s no way to make a 3D game like the newer Zelda series or Mario64 within this short of a time period, and those are even single-player. Design a story with characters that stand out.

I wrote up an initial design document, and a friend filled in the story. The story was also scaled down a great deal, and what remains in the game are only some elements of the story that caught my eye. I don’t have a whole lot to say about the story, but I feel that making memorable characters in the game was very worthwhile—of course, you always have a main character or several who are memorable, but including a standout villain or a character who shows up frequently adds a lot more fun to a game. To appeal to casual players, keep it simple.

I am not really sure how successful the actual in-game design was, because a lot of people got stuck at the title screen (see uDevGames section below) and there really were not all that many comments about it. I think a lot of people were confused about this style of game, because the game didn’t really tell you what to do, you had to explore and try to find money and items to get further along. Those who got far into the game tended to like it, so there seems to be a certain hump to overcome, at which point you understand what the game is about and how it is to be played. Presumably a lot of people didn’t have time to try and mess around to get over this hump.

Game Engine: Never start from scratch!

Rule number one for actually making this sort of game is that you should never start from scratch, unless you have years to work on it, and an interest in how the guts of game engines work. With this in mind, I next picked out some libraries to start with, in particular the code of Devlib, which is an open-source, minimalist game engine. This was a great idea, as it gave me a notion of how to glue these separate open-source libraries together. Devlib by itself was not sufficient to do what I wanted, so I had to hack it like crazy—I would not recommend using it without modification. For making a 3D-platform game, I would actually recommend you start with a more high-level engine if possible, such as Torque. If you are very serious about making a 3D game, there are of course a lot of other great commercial engines as well, and again I would advise against starting from scratch unless you have lots of time and interest in low-level details.

Devlib incorporates SDL for setting up a drawing context. This is a great choice for the Mac OS X platform, and is becoming a lot more popular and stable. I would recommend it to anyone.

Drawing: DirectX and OpenGL

I chose OpenGL since I wanted to work well with the Mac OS X platform. Any cross-platform developer would want to do the same.

Image Loading: DevIL

The cross-platform image library DevIL worked great for what I wanted, and I recommend it. (Relevant to me was the JPG, PNG, and TGA support.) QuickTime is also popular for loading images, but I was interested in making the game as cross-platform as possible.

Font Drawing: FreeType for TrueType

This library is also fine, and by the way, there are plenty of free TrueType fonts you can find on the web, such at those at Tom7. I would not recommend using Devlib’s built-in font drawing support, which is quite inefficient and has a lot of overhead. Instead, OpenGL FreeType is a much better choice, tailored towards OpenGL rendering.

Physics: ODE

All in all, this library was acceptable for what I wanted to do, but it is somewhat quirky and difficult to get to work exactly the way you want it to. A game-specific physics library might be a better choice, but I haven’t played around too much with it. ODE definitely will get the job done, though, but it may cost you some time.

Scripting Language: Lua

This was the first time I wrote a game with scripting, and I was amazed by how much this helped to speed up game creation. Lua is one of the best choices you can use for a game scripting engine—so much that I have dedicated a section to it below.

Sound: SDL_mixer

FMOD is what Devlib used for sound, but I ended up using SDL_mixer, because I was trying to avoid the cost of licensing FMOD. FMOD itself is supposed to be fairly good if you actually do use it. However, using SDL_mixer turned out to be a poor choice. SDL_mixer is not as good about using audio hardware acceleration, and can sometimes introduce clicks and pops; also, it has limited features. I recommend using OpenAL instead.

Devlib also has several other components that I did not use, such as its mesh loading support, resource loading support, and font support. Devlib’s mesh support is not very flexible, so I wrote my own mesh/geometry code. This is a fairly simple linear-interpolation system; each mesh file is a group of keyframes, and each keyframe has all the vertex positions for a given pose of the model. Then, in animation files, keyframe weights are listed with time deltas. You can see this in the ‘ani’ files of the data folder. I created these models and animation files with my own modeler, OpenTeddy, which I describe a little further in the work flow section.

Resource Management: Caching is a powerful method for resources

Though I used Devlib’s resource support, I wrote my own resource management system. The system is simply a cache. Instead of having separate variables for each data pointer I want to store, I have a table for each type of data (e.g. sounds, images, keyframe data) and ask the system to give me a resource with a given name. The resource is loaded if it is not already in memory, and if not, it is loaded, but if it already is, a pointer to it is returned. To use this effectively, you need to pre-load a certain amount of resources to avoid delays when something new appears. For example, there is a noise for when the player swings a weapon; this sound is loaded when the game starts by requesting it instead of the first time the player actually swings, so there is no delay in case it takes a while to load the file.

Another consideration you might be worried about is taking up too much memory from loading all these data. Not to worry! In modern operating systems (Mac OS X, Windows NT or higher) when your program takes up too much memory, the operating system starts using the disk to store your excess memory that hasn’t been used in a while (this is called ‘virtual memory’) and it brings the memory back into your program when it is accessed. This is all done transparently, behind your back. So, you can load all you want, and if you load too much you should be fine, as long as you don’t work with a really big set of resources in a small time window. For those that use C++, here is a snippet of code from the system. PRall_lookup is a templated hash table, where you choose the type of the pointer to return. It also has a method find_or_load(), which returns a pointer to the loaded version of a data file you request. When g_all_music below is destroyed, its destructor from PRall_lookup will free all the loaded music files.

struct PRmusic : public PRcopystr {
public:
Mix_Music *music;
PRmusic(const char* i_filename) : PRcopystr(i_filename){
g_soundLoad();
music = Mix_LoadMUS(i_filename);
}
~PRmusic(){
Mix_FreeMusic(music);
}
};
PRall_lookup&ltPRmusic> g_all_music;
PRmusic* p = g_all_music.find_or_load("title.ogg");
PlayMusic(p);

Programming with Lua: Scripting helps speed up your development.

I should note that half of my code is Lua (in the data folder,

game.lua

,

title.lua

) and the other half is C++. Because I added scripting, I was able to add a lot of new behavior and features very quickly. By the way, make sure you are getting full output from your scripting interface. You need to know from which line and which file you are having a problem, and a full stack trace if possible.

Function Interface

What I found to be the easiest (though possibly not the most efficient) way to do the interface is have my Lua procedures each take in one argument, which is a table. This way I can quickly change my interface and allow default values. For example, I might have:

render_billboard( [x=50, y=20, texture="mytex.png"] )

Then if I decide to allow a color, I can make the default color white if it is unspecified and the user could also specify it:

render_billboard( [x=50, y=20, texture="mytex.png", color=[1.0,0.0,0.0] )

There is still some annoying manual labor you have to do to implement this. For each argument you obviously have to try to look up the string in the table, and if it’s there, use it instead of the default argument.

I would not use Luabind makes your compilation time incredibly slow, and if you start increasing the maximum number of arguments in your interface, it starts running into too-deep template errors. I tried it out and wasted a lot of time on it.

Vectors

I found it useful (though it’s somewhat slow) to represent vectors with tables. You can see in my previous code example how this works. The way to do this easily in Lua is to push a table, then push the number 1, push the first value, push the number 2, push the second value, then the third value. I use vectors of size 2 through 4. All my vector math is implemented in Lua. If this is too slow you can of course push it up into the engine layer, but again you still have this sort of overhead by converting to a table. However, I found it incredibly easy and flexible to do it in this way.

Handles

The way my system works is that when you ask for a new object, you get an integer handle to the object. You can then refer to it by the handle:

local ob = create_object( [model="test.model", loc=[0,1,0]) ... set_object( [index=ob, loc = [1,1,1] )

In my system, objects are the only things with handles. You could do a lower-level version of things where textures have handles, models have handles, etc. I find, though, that you may just want to specify what you want each time and simply use a cache. So for example instead of passing a texture to a handle, then using that handle, you just mention the name of the texture every time, and the system is smart enough to internally cache that texture so that it doesn’t have to load it each time the draw texture is called. This is described in the above resource management section.

There are of course a lot of programs that use Lua, and I have actually not looked at any other ones (which is probably to my disadvantage, but my engine is working fine so far, except being somewhat slow on older systems.) I am aware of one recent game, Gia (from rpgdx.net) that uses Lua. I haven’t looked at how he does things, though.

Workflow: Start simple as possible, and slowly grow a full game

The first thing I did was try to make a simple program using Devlib. Once I got that to work, I made more and more complicated programs, that first loaded my meshes, animated them, added physics support, and then scripted them. This sort of continual evolution is a very good way to develop a program, because you know that what you currently have is working fine, so when you add something new, you know that’s probably the culprit. I used a memory checking system (called MMGR.h) and turned out checking all the time, so whenever a memory bug came up, I could fix it right away. Once I got scripting working, I made a simple demo where the character could walk around on another mesh. From here I tried to make sure I had all the features I wanted, by adding more and more interactions with other objects. At this point I started making the actual game levels. Use a professional tool chain.

Making character and monster models was done in OpenTeddy, which I developed myself earlier in the year. The reason was surprisingly not that I wanted more power from a modeler, but that I actually, despite being a computer graphics student, do not know how to use professional modeling packages, such as Maya, as I never learned them. I would recommend against making your own modeler. I had tons of trouble with my modeler, and it was really insufficient for making level (room) models. Instead, you should learn how to use Maya, for example, and you could write some plug-ins for it in order to do things specific to your game. This is certainly the best approach, but rather difficult if you don’t know too much about it. So start learning how to use a professional 3D package as early as possible.

A lot of the level data is in my scripts, which is also a fairly bad idea—it meant that I had to type in the location of exits and entrances, which was a huge nuisance. It would have made a lot more sense to store this data inside the level meshes, or make a special level format just for rooms.

I had a lot of fun making characters and monsters, however, which is a big part of what motivated me to keep going. This was the only advantage of my own tool, because OpenTeddy is specialized in making organic shapes. As an aside, OpenTeddy is based on the work of Takeo Igarashi. His team created an easy-to-use 3D modeling tool based on creating mesh blobs with 2D strokes. I extended the concept to include boolean operations, which made it a lot more usable, and allowed me to make (debatably) much more professional-looking models. I hear there is a Teddy plug-in in several professional 3D packages, and I would recommend using such a tool to save you time.

Music for the game was created with FruityLoops. I had a lot of fun with this, and would recommend it to anyone. It is, however, PC-only. I felt that the music added a lot of mood to the game, but from the uDevGames results, people either didn’t like the music that much, or didn’t like the sounds that much. It’s difficult to tell, because I didn’t receive many comments about it.

Audio was created by finding free sounds, and then modifying them with Audacity. This is fairly straightforward, so I won’t say much about it, but you should remember that OGG is a good sound format to use, though you will need to get the correct libraries for this.

uDevGames: Make sure your opening interface is simple and comprehensive

When I received my scores for uDevGames, I was disappointed, because I expected to do somewhat better. However, I did something really stupid. At the title screen, I opted for somewhat of a consistent keyboard interface, but this was a very bad idea, because people didn’t know to press a key since in most computer games you would click the mouse instead. I did not implement mouse support, and I really didn’t want to. I should have though, because it would probably have given me a good deal more votes. So the tip here is you should definitely make your out-of-game interface both mouse and keyboard—a standard interface is best. Instructions all along the way (even CLICK THE MOUSE TO CONTINUE at the beginning might help) are probably a great idea; in-game instructions are the best, and I think it was helpful for me to include them. If you’ve played the fairly recent “Prince of Persia: Sands of Time” game, it has fairly sufficient in-game instructions, which gives you an idea about that. Simpler games appeal to the public.

About gameplay, again I received very few comments, and what comments I did receive I fixed gameplay for, so it’s very difficult for me to gauge what people actually thought about it. My personal opinion is that I received a mediocre score because the game was too complicated—remember that for uDevGames you are being judged by the public, and a game that will be most successful with the most number of people is one with a simple interface, so nobody has trouble playing it. I should also note that historically, RPGs have not placed all that highly in uDevGames for what I feel is this same reason of complexity. I also encountered some game crashes despite testing with a reasonable number of people. Because again my game was somewhat complicated, it was almost impossible to anticipate these bugs coming up.

Try your sound on headphones, and on different systems

For audio, one comment I heard is to make sure things aren’t too loud or too soft—there should be an audio adjustment menu and you should test the game with headphones. I did neither of these things. Another problem I came across is that a few people felt the music was somewhat monotonous. However, I was only allotted 10MB of space for the whole game, so each song was only a minute and a half to two and a half minutes. It would have been a better idea to just make one or two pieces of longer music, and leave the other music out to decrease download size. Small downloads can lead to more votes, because non-broadband users probably will download smaller games first in the interest of time. The best-rated graphics are clean and consistent.

Finally, about graphics, I think I was judged somewhat harshly because I had a lot of repeating textures—since I didn’t have the time to make really detailed levels, I went for levels that were just comprehensible but not really detailed. This was probably not such a good idea, because I think it introduced the perception that I was just being sloppy. The fact that I had animated models did not seem to help me all that much, and you can probably get a lot of mileage out of 2D graphics that look good.

  • Genre:
  • Developer:
  • Url:
  • Team size: 1
  • Released date:
  • Project length:
  • Development hardware:
  • Critical applications:

Feathered Soccer

Project Aims

To avoid comparison with the big Pro Evolution Soccer or FIFA series, I wanted my game to be strongly arcade. I also wanted to develop a game that both a child and an adult could find fun to play.

Design

At the beginning the design was very poor. Of course, I produced a lot of ideas for the game, but I knew that developing even a simple soccer game in three months would be very hard for me. Consequently, I decided to first develop a simple game and then add additional features as time permitted. So I simply designed an objects tree, thinking of the C++ classes I would have used and keeping the game concept in my mind.

What Went Right

Math

Coding a 3D game usually requires a lot of math, trigonometry and physics formulas, and Feathered Soccer made no exception. Moving the ball realistically, moving characters, and checking collisions are some examples of where math is essential in this project. However, I love this subject, and when I started coding I had just completed a first year Computer Science course at college that included one physics and two math exams, so producing the needed formulas wasn’t a big problem.

Happy Coding

Even if I had to fight against some bad technical bugs during this project, they didn’t take much time to discover and fix. Their presence was due mainly to the little time I had to complete the project. Because of this, and of course because of being a big (and bad) programmer sloth, my code isn’t very good in regards to maintenance. However I had the code clear in my mind at every stage of the project, so I could fix the bugs with little pain.

Using Strong Tools and APIs

It could seem an obvious thing, but it’s not: choosing strong and proven tools like Xcode and strong and proven APIs like OpenGL and SDL really helped my development. You can of course use and be fascinated by a new tool, however it’s not a good thing if, having only three months to develop a game, you also have to beta-test the tools you use.

What Went Wrong

Artificial Intelligence

Well, I’m coding a soccer game and everything’s going fine, so where is the tricky part? That part is Artificial Intelligence (AI). It took me a long time to produce a not-so-stupid AI and I found the teammates’ AI expecially difficult. When the player controls a character, all the other characters of his team should move in a meaningful way. The first experiment I made resulted in very unintelligent AI. It was clear to me that I had underestimated the problem. So I spent a lot of time on this, thinking of a better solution, playing other soccer games and, at coding time, using a try-and-fix approach. In the end it seems that because of a fear of making AI that was too easy, I made AI that, according to user feedback, is too difficult. So the moral of the story is “In medio stat virtus,” as the Romans used to say, which means, “Virtue stands in the middle.”

Sound

I added sound at the end of the project, which means I had very little time to find and implement it. I was in trouble trying to find some good royalty-free sound effects and background music so I decided to buy a copy of iLife ’04 and produce my own music with GarageBand. Then I found some nice effects and bought them. There were also some problems from a technical point of view. I tried to use SDL_mixer to add sound, but for some reason, probably due mainly to me, I wasn’t successful in doing this in even a simple way. Because time was running out, I decided to go platform-specific for this contest and I encapsulated some Cocoa code into my C++. I found the Apple documentation on this topic very clear. Then I noticed that the game slowed down while playing a sound effect, so I modified my Cocoa code to be multithreaded. Finally everything worked and I am very proud of my encapsulated Cocoa code. I will, of course, have to change it if I decide to port the game to other platforms.

Fighting Against Time: Mid-Project Changes

One of the worst enemies in this project was time, so there are a lot of features I would like to add which are not present in the current (1.0) version of the game. Choosing what to implement and what leave for later versions was very hard. I tried to think of what is really necessary in an arcade 3D soccer game and what is not. I only wanted my game to be polished and fun to play, even if this would have meant the lack of some features. I list here some of the features I didn’t implement.

  • No bonuses — If you played the game, you may have noticed that tackles aren’t punished and that, even if the game has a strong arcade/cartoon inspiration, it hasn’t any kind of hyper-speed or other bonuses, which would have also changed the gameplay experience positively.
  • No two-player game
  • No configurable options
  • No replay
  • More teams and competitions

Of course this is only a small selection of the things I didn’t add because of time.

Risk Management

Choosing the API and the Game to Develop

Even though I had experience with 2D games, considering that I had never developed a 3D game before, choosing OpenGL as the main API was a brave decision and a big risk. However I really wanted to do something I would find fun and a 3D soccer game fit the bill. In real life, with a boss who wants a good game developed in three months, I would probably take another route.

Conclusion

One thing I learned from the development of this game is that I should pick a project that is possible for me to complete in the given time with less pain. However, it’s also important for a person to pick a project which he/she likes and enjoys developing. As a matter of fact, I also had a confirmation of human will power: I really wanted to have something playable for November 6th and I had it. If I could suggest something to a person who wants to conduct a big project I would say this: choose something you really like and trust yourself.

  • Critical applications: Xcode, GraphicConverter X, GarageBand, Cinema 4D CE, Art of Illusion, The Logo Creator 3
  • Development hardware: PowerBook G4 867MHz (384MB RAM)
  • Url: www.bluepixysw.com/
  • APIs: SDL 1.2.7, OpenGL, Cocoa (only for sound)
  • Project length: 3 months
  • Page 1 of 2
  • 1
  • 2
  • >

iDevGames Forum

iDevApps Forum