The challenge of an open-ended gameplay.

Ever since I delved into the misty world of Oblivion (The Elder Scrolls IV: Oblivion), I could not help but admire the game and its design as a whole. Now I feel my initial comments and observations (except on the technical aspects) were somewhat misplaced. I had seriously miscalculated the depth of the gameplay for a game like Oblivion. Though Oblivion looks like a first person hand-to-had combat game, something like the Riddick game in a medieval backdrop, it is nothing of that sort. It is very much an open ended game. Let me come clean, this is my first true experience with a game that has an open-ended or sandbox gameplay. I am a FPS-RTS fan and my initial experiences with Oblivion were frustrating. I was like, “Why the hell do I have to talk to some many people, give me something to slash and hack”. But that is where an open ended game differs from a normal run-of-the mill game. An open ended game often makes you build a true unique identity for yourself as you play the game. Meaning, in the world of Oblivion you could end up being a hero, a thief, a vampire, a magician or a complete nobody if you so choose.

I really started to enjoy the game when I began to forgo preconceived notions on how a game should be played. While most FPS-RTS game allow the player to make micro level decisions, ie. where to hide, how to attack, which weapon to use, an open-ended game will demand the player to make decisions that will affect the progress of the entire game. Based on your decisions, the game will play differently. The game is modeled on a decision-consequence behavior, which is perhaps why I initially found it difficult to adapt to. It is very difficult to explain exactly what I am trying to convey, maybe you can’t make head or tail out of what I am trying to say. It’s basically the experience and you have to play the game to understand it. The game is radically different from a pure goal scripted type game. It is not something totally like a MMO, say for example like Second Life, or for that matter nothing like Sims, Oblivion is very different. The only game that I have played and could say was somewhat close, is Heretic II. For one, you could play Oblivion for almost like “forever”. I have heard people compare it to WoW and Everquest, but I have never played WoW or Everquest so I don’t know.

The game has had a profound impact on me. That’s rare. As I said before it is not the very best of the games I have played, but it’s not the game as such but the whole concept that has made me look back and wonder. It is very different from the regular “Hey! Here is a monster we have seem so many times before, pump his guts full of lead! Oh OK, we know there is nothing new to that, we have like done that 10000000 times before, but look look, he has shining eyes, and see the bump mapping and the parallax mapping and did you notice the shadows and look at the his tail and the x y zee graphics that we have put in,,, and then there is next monster behind the next bend,, and and the next,,, woooh!…” bah! boring! Done that, been there, not once, but again and again. I am tired of games that follow a stereotypical gamplay. Give me something more. Give me more experience. Let me explore regions where I have never been before. Let me experience something new. OK the FPS game genre was great 10 years ago, but move on guys! Putting new graphics on top of old gameplay is just like having remixes of old songs with dancing half nude women; phooey, maybe even worse. I find Oblivion interesting because it allows me to experience something like I have never experienced before. Not some mundane redundant crap dished out on a graphically attractive platter.

I find open-ended gameplay both fascinating and challenging from a designer’s point of view. To give a open ended experience, the game design needs to have far more scalability. The designer needs to plan out far greater sets of unknowns than are possible in a scripted style game. In a scripted game you generally have a single unfaltering goal. You have to complete the goal before you proceed to a new one. Conversely in an open ended gameplay you are allowed to approach your goal in infinite possible ways. You can have smaller goals or smaller sub-goals which too can be as non-monotonous as your ultimate goal. While this may be easier said than done, it really got me thinking as to how one could approach designing such as game from a game designer’s point of view. Interesting, since every unknown you place in a game will increase design complexity substantially. In Oblivion the entire game is divided into Quests, where the quests can be thought of as goals. While there is a main quest, there are an almost infinite series of sub quests that branch off the main quest. You have a choice of doing the quests at your discretion. But the game does play very very differently depending on the choices you make and the quests (goals) you complete. The game doesn’t force you to do anything particular, it’s just one giant simulation, which plays on you just as much as you play on it!

Having played Oblivion (, there are still 100s of quests left), I can tell you I have become a fan of the open ended style of gameplay. Don’t be surprised if you find more ramblings on similar topics on this blog. I can now see why people hijack their lives to play something like WoW incessantly. These games are truly a new experience and if you have played them before you will understand what I mean. If you haven’t, you should!

wxWidgets + Code::Blocks, are we there yet?

wxWidgets wxWidgets is a mature and very powerful cross-platform GUI framework with a very liberal non-restrictive license. It has a very big community behind it and a also has a huge support base. There are tons of tutorials, excellent examples and many companies large and small have successfully used wxWidgets to develop their applications. When it comes to GUI frameworks, wxWidgets is among the best out there.

Code::BlocksCode::Blocks is more of a “new kid on the block” Integrated Development Environment when it comes to IDEs in general. If you see the design and layout of the IDE, you can unmistakably see traces of Microsoft Developer Studio and KDE Development environment in it. It reminds me more of the old Visual Studio 6.0 IDE. Programmers who have worked on the VC IDE v6.0 and Code::Blocks will know what I mean. Code::Blocks is written using wxWidgets and shares a very close relationship with wxWidgets framework.

wxWidgets is very similar in design to MFC (Microsoft Foundation Classes), so developers who have worked on MFC tend to gravitate towards wxWidgets more than any other GUI when they have to develop a cross-platform solution. I don’t blame them the least. Learning a brand new framework from scratch can be intimidating even for experienced developers. Being a long time MFC programmer myself, I personally like wxWidgets more than any other GUI out there.

So where does Code::Blocks fit into all of this? Code::Blocks has an integrated GUI editor and code manager (just like the famous “ClassWizard” of VC++ 6.0) for wxWidgets called wxSmith and its is very good for rapid GUI development. Code::Blocks is licensed under GNU GPL so it is the perfect solution for budget development solutions and for programmers that have to pay a bang and a buck for an IDE. The combination of wxWidgets + Code::Blocks takes rapid cross-platform GUI development to the realm of possibility.

A GUI that is very similar to MFC and an IDE that is custom made for it, and not mention all this for ziltch/nada/nothing, seems too good to be true. But wait a minute before you go and make your brand new mega budget office suite, there are some things that are not up to the the mark just yet. As I said earlier Code::Blocks is pretty new and it has some way to go. The IDE has had more than a jagged development path. It’s official 1.0RC release is doggy to say the least, not to mention it was released more than a year ago. The IDE has had a major re-design since then, why, your guess is as good as mine. New projects don’t need redesign this early in their life cycle. Maybe the dev team thought that the IDE could not stand up to others like eclipse, or maybe it was the plug-in system that they added or some other feature, I don’t know.

There hasn’t been a major release of the IDE in a long time and that’s a fact. What the dev team does release, are nightly snapshots and I must say these days the builds of Code::Blocks have been pretty impressive. The product has been in beta for way too long and I wouldn’t put my production projects on it just yet. There are also some issues with stability that the dev team is working on. The last time I checked the IDE was great while using GCC but MS compilers need some work. Though the IDE claims to work with many more compilers, I haven’t checked them all out yet. For Linux development I would recommend this IDE hands down, but for Windows I think I will stick with Visual Studio Express a while longer.

I suspect there is going to a major release of the IDE soon, I hope there is. I am eagerly looking forward to that. But one thing is clear, wxWidgets + Code::Blocks is a win-win combination. I think that wxWidgets will also greatly benefit from a stable Code::Blocks IDE. More people will use it, I am sure. More companies will adopt wxWidgets as a development environment of choice. In any case what Code::Blocks team has achieved is commendable, especially since most other similar project have long gone cold.

References

wxWidgets
Code::Blocks

Selecting a scripting engine – Part 2.

My quest for a scripting system for the O2 Engine continues. This blog is a continuation of the “Selecting a scripting engine” series. You can check out the first part here. I tried a couple of different approaches to try and attack the problem. I am currently in prototyping phase, and things and decisions can and do change drastically. Also I have to test a lot of different techniques and scripting languages before deciding upon a final solution.

Python

I continued my experiments with Python with trying to integrate Python into a moderately sized project. Something that I had worked on before beginning with the O2 Engine. It has similar structure to the O2 Engine but is comparatively far smaller. Python is easy to bind (, than what I initially thought) but the party ends there. I must say I am a bit disappointed, extending the classes is turning out to be far more difficult that I had anticipated. As I mentioned in my earlier post, to build a game successfully with the engine you not only have to work with the engine classes but also engine design. Exporting the design was not very intuitive while working with python bindings . I am not ready to give up just yet, I have decided to look into how others are approaching the problem. Maybe look into how bindings for wxWidgets are written (wxPython).

New scripting language

I have no experience in scripting language creation but recently after a long conversation with an old friend of mine I was forced to look into ANTLR. ANTLR is a parser generator which could be used to create a brand new scripting language. Before I proceed I must warn you though that I am no expert in Lexers or Parsers and have no clue how to make a scripting language. My knowledge in this area is limited and I am just about getting my feet wet in this arena. Treat my comments in this area with a pinch of salt.

OK, coming back to the main topic. Some people I chatted with recently were of the view that it would be better off in the long run to implement a new scripting language from scratch. Let me say, this remains an issue of debate between us, and I have not reached a conclusion yet. Having said that, a scripting language specific to the engine will be excellent for scalability. Grammar to tackle game development specific issues could be built into the scripting language itself. This would avoid archaic constructs that often arise out of bindings for languages like Python or Lua. With off-the-shelf languages you do have to make design compromises to get all of your functionality in into the scripting language. Again, I am not making tall claims. As is said, I am still working with this whole concept of bindings and scripting languages.

Tried my hand at ANTLR and could not make too much out of what needs to be done. But I am very much a newbie at this, and besides, I didn’t spend a lot of time with it. Just a couple of hours on a Sunday afternoon aren’t really enough to make conclusive claims. I did a lot of googling around and I can see people have good things to say about it.  So, lets see how this turns out after some more experimentation. ATM I have very little time to devote to this.

A couple of interesting events.

  • FX composer RC1

    NVIDIA released the release candidate of the FX composer not too long ago. I downloaded and gave it a “breezy” try, but I don’t see GLSL support! Maybe I missed it. Why is there no GLSL support? Nothing is mentioned on the site as well. This is what the site says about API Support, “HLSL, COLLADA FX Cg, CgFX shading languages”.

    I don’t have a latest card to test all profiles, but the product seems good, though it crashed on me once on an older gen card! Some dll problem. Ran ok with 6200 and 6600 cards. I am eagerly awaiting the gold release. Comes at an opportune time too since I will be finishing up with the current project and moving on to the next. Maybe I can seriously think of including this in the pipeline for the next version of the O2 Engine.

  • Silverlight

    Apparently Microsoft’s answer to Adoble system’s Flash player. Or so they say. A significant development if you are a Flash game developer. I don’t see myself developing Flash games in the near future, but you never can tell.

    Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.

    Hmm, cross-platform, cross-browser! So are we going to see Microsoft officially support Linux and other *NIX platforms, and browsers like FireFox? Usually in Microsoft’s dictionary cross-platform means platforms including Windows ME, Windows XP, Windows 2000, NT, Vista and cross-browser means Internet Explorer 5, 6 and 7 .

  • Intel® Threading Building Blocks 2.0 (TBB)

    Intel released a library designed to get the most out of multi-core processors under a modified GPLv2. This could be an interesting development. Parallel processing and parallelism is another contentious issue. Especially when it comes to implementing it. Many people have said that true parallelism is only possible while programming with a Functional approach. While that remains debatable, it is aptly clear that the next gen games will have to leverage most out of multi-core processors.

    I am just a little bit worried about the licensing policy. They have released it under GPLv2 with a “runtime exception“. I am no legal eagle, but it sounds like Intel intends to make make some money with the library after all. I am also not sure how things will work out with AMD processors. In any case, it is one of the “must look into” things.

  • Nintendo “for” the garage developers

    Surprise surprise! Nintendo announced the availability of its platforms for small and independent developers. It’s some kind of service named WiiWare which will allow developers to sell their games and players to download them off this service. WiiWare titles are supposed to be launched next year.

    Read more about this here and here.

Are we falling into the “Uncanny valley”?

We are currently working out gameplay issues in the Doofus game and I am working on some serious tweaks to the A* algorithm used in the game. One of the feedback from beta testers was the movement of the enemies was somewhat robotic with very sharp turns. Fortunately all the enemies in the game are robots (smart move there), so the robotic nature of movement is kinda OK, still A* algorithm gives very sharp turns. I am working on some way to smoothen out these turns. (I hope it works out.)

Anyways, what the beta tester said, really got to me. He is right, you do get an uncanny feeling. So I decided to do some googling around to find out how other games were solving the same problem and why we got this sort of “uncanny feeling“. Before long I landed in the “Uncanny Valley”. The Uncanny valley is a hypothesis that was suggested by a Japanese roboticist Masahiro Mori [1]. The hypothesis states; As robots became more and more humanlike, people were attracted to them, but up to a certain point. As soon as a robot or an android passed a certain threshold and became too realistic, people were repelled or disgusted. So what does this have to do with game characters? As it turns out the very same thing can affect game characters too.

Another article on the Slate gives more details on the effects of the Uncanny valley on game characters. I had noticed this effect before, where game characters don’t seem lifelike and their faces seem a bit odd. I couldn’t quite nail what it was that seemed strange, but reading the article makes things more clear. I was playing Elder Scrolls IV: Oblivion a few weeks back and there too the characters speaking to you looked odd. Their mouths, speech and gestures did not coordinate correctly. I remember in Quake 4 the character of Voss seems to be very robot like when he spoke to you.

I nearly shrieked out loud at one point. And whenever other characters speak to you—particularly during cut-scenes, those supposedly “cinematic” narrative moments—they’re even more ghastly. Mouths and eyes don’t move in synch. It’s as if all the characters have been shot up with some ungodly amount of Botox and are no longer able to make Earthlike expressions. — Slate

According to me, the Slate article is a bit too harsh and a little bit old. Yes, it may be true that games do suffer from uncanny valley effects, but I am not so sure they are here to stay. In fact after reading the article I fired up Half-Life 2 to re look at the animation effects from the cut scenes and guess what, the Source engine designers have nailed it! I mean the characters may not be totally lifelike but I found the animation system to have, lets say, less of the valley effect. Besides, if you look at the recent animation technologies like the ones in Shrek, Happy Feet, Chicken Little you see no visible signs of the Valley effect, at least I couldn’t. The gaming industry has some of the most intelligent and talented people in the world. With hardware evolving at law defying speeds and demands for realism going up all the time, I am sure these technologies will find their way into games sooner rather than later. To make claims like “though, gaming’s Uncanny Valley could be here to stay”, doesn’t do justice to the industry which is well known for its innovations and breakthroughs.

Something good for your eyes.

Do you feel your eyes getting stressed out after staring at the computer screen for too long? If you answered “Yes” to the question, then this is for you.
No, it is not another eye exercise, it is a nifty tweak for your Windows XP system that I happened to run across. It will take about 2 minutes of your time. Linux users need not worry, your systems probably already has this technology. Just in case it doesn’t, you can install it. It’s called FreeType. This is for Windows XP, Vista already has the new ClearType engine installed.

Recently I read an article about the new ClearType and OpenType technologies. The article caught my attention because it said that it made “reading enjoyable and less stressful for the eyes”. Being a computer programmer, I stare at the computer screen all day so any help to the eyes is a big plus. Microsoft has made the technology available for Vista by default, but what about the older Windows versions? After googling around a bit I found out that you could do the same for your XP systems.

First download the ClearType engine itself. It can be found at http://www.microsoft.com/typography/ClearTypePowerToy.mspx

The instructions on how to install and run the application are on that very same page.

After running and enabling the ClearType engine you will notice your fonts look a little bit different. Watch closely, they seem to have increased in contrast and look more pleasing.

There, you have successfully installed the engine. Now comes the time to take full advantage of it. Well as it goes, Microsoft has released 6 new fonts specifically designed to better the viewing experience with the ClearType engine. They are Constantia, Corbel, Calibri, Cambria, Candara and Consolas. Each is designed for a specific purpose and usage. Refer to the above mentioned article for details.

So where do you get these fonts? Well if you have a friend who has Vista, ask him to copy them for you. Each font is a set of .ttf files in the fonts directory. Or, I found a place you can download them. Its here. Scroll down and click on the “download” link [1]. Unzip the zip file and copy all the font files .ttf to your WINDOWS/Fonts directory. That”s it.

I am using Consolas with my Visual Studio IDE for the past 4 months and I love it. I have also set the same font for my Notepad and other apps that use Monospaced fonts. One thing I would like to mention tough, the above mentioned Vista fonts look hopelessly bad if the ClearType engine is not installed.

References
ClearType information on Microsoft’s site.
ClearType PowerToy.
The FreeType Project.
Adobe”s OpenType Fonts.
Bitstream Vera Fonts.
Information on each of the new Vista Fonts.

The new fonts are a big hit with me, hope you find this information equally helpful.

Intricacies of cross-platform development.

Ah yes, so you want to make your new program/software cross-platform. Sure you can, just make sure you understand properly what it takes to write robust cross-platform software. If you haven’t written any cross-platform software thus far, then chances are you have no clue what is exactly needed. Writing truly scalable, robust and error-free cross-platform software with consistent behavior across platforms is difficult — and I have put an underline on that to emphasize just that. Go out and search for software that satisfies all the above points. I bet you won’t find more than a few. FireFox browser is one such project that comes to mind. It is a very good example of how cross-platform software should be created. Here I won’t go into the details on how cross-platform development is to be done, you can find plenty of that all over the net. Here I intend to point out (rant) about cross-platform development and it’s pitfalls.

Cross-platform development can be really easy or really difficult. There are several factors that come into play and everything really depends on the type of design, the quality of code and the tools/languages you choose. Cross-porting could add as little as 2% overhead to the entire development life-cycle, or things can be as bad having nearly 40-60% of your time trying to get things working the way you want them. Having said that, cross-platform compatibility does add overhead to any project and usually with experienced teams, it is about 10 to 20% of the entire development time (for non trivial projects). So the lesson is, if you don’t have to, don’t aim for cross-platform compatibility. If your project is never going to be executed on a platform, or if you are the one making decisions and are pretty sure there is no market for a particular platform, don’t get overzealous and try to port your design or code. Remember porting adds cost; and costs in everything from building to maintenance. ( Note: Design can be important while implementing cross platform compatibility, understand and use design patterns like Adapter and Facade).

So you still do want your project to be cross-platform? Fine! The first thing you have got to do is choose the right development language. Yes, you can write cross-platform C++ code. However different C++ compilers out there can be a nightmare to work with. You could save yourself a whole lot of trouble by choosing GCC for all platforms, but that can’t always be possible. In any case C++ programs can be tough to maintain for cross platform compatibility (, though I repeat, it is very much possible to do so). Another thing that can be a real pain in the a** to work with are build systems. Not all platforms will give you a cick and compile IDE for C++. In the worst case you will have to delve into the misty underworld of Makefiles. C++ is not a particularly good choice for cross platform development. Java or Python would be an ideal choice for a language. Both scale across platforms pretty well, but that doesn’t mean you have all the features of the language on all platforms. Read the docs carefully before implementing obscure functionality.

A good GUI can make all the difference between for an application. Making a correct choice for a cross-platform GUI is an equally daunting task. There are a lot of GUIs and a lot of libraries that claim to be cross-platform. Don’t be fooled, take them for a test ride and check the functionality yourself by making prototypes. Or save yourself the trouble by choosing a solution that is time tested. While choosing the GUI for cross platform development I have found that there is no easy answer. I worked on Qt some time back but wasn’t impressed with the moc-compiler thing. Also Qt uses obscure and redundant C++ coding practices to maintain compiler compatibility. Qt is a commercially available library and their support is, well I will put it at “OK”. wxWidgets has a huge community, but it builds on top of natively available widget libraries. It’s design mirrors MFC design, so it is a popular framework with MFC developers. I have developed using wxWidgets also and I would put it at good. I have found forum help (not kidding) to be better than Qt. My current favorite GUI is wxWidgets bindings for Python called wxPython. It is very easy to use and supports a ton of functionality (, and yes it is Python).

Another promising project is the Mono project. “Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix.” — The mono project. However some of the parts of the projects like the GUI are still in beta versions. Also one thing I have seen is Mono consistently lags behind Microsoft’s .NET framework. That is to be expected, since Microsoft will lead in .NET implementation and try and keep its version ahead of the competition. But nevertheless, Mono seems a serious contender for any cross-platform development. I haven’t give it a try though, maybe one of these days, when the game is shipped.

Blender Bender.

BlenderFor our entire game project the 3D modeling and animation package we have used is Blender. It was pretty much used to make the main character and all the mesh assets in the game excepting the world. We are using another software package for world creation and scene composition, but more on that later. I selected blender for variety of reasons. The most important is of course, it is free, but that was not the only reason for its selection. Don’t let the free thing fool you, blender is a mature piece software with features that can rival even the best 3D modelers out there. In fact some of the features like multires mesh modeling, UV unwrapping, multi UV unwrap and powerful animation system are are cutting edge and the very best.

The second most important reason why I selected blender is its amazing flexibility! OK, so if you have used blender then you might disagree with me. I said might, a veteran blender user might actually agree with me, but for some reason blender has got this nasty reputation of not having a very user friendly GUI. I tend to disagree with that view because it is biased. Yes blender has an unconventional interface that takes a little getting used to, but to say outright that it is bad just because of that, is judging a book by it’s cover. Anyways, that is an argument for other day.

As I said, I selected blender for its flexibility. Blender offers an amazing plug-in support. It supports a full Python plug-in system which is very easy to use. The plug-in system allows blender to be extended very very easily. In fact blender is fully written in Python and is open-source. That is an added bonus, it allows you to have a peek at the source if you want to or if you are stuck somewhere. I personally found blender to be very easy to extend via plug-ins. Python is one of my favorite languages because of its simplicity. No doubt my previous experience with Python also helped.

Since programming plug-ins for blender is easy, you can easily export blender assets into your custom formats. Blender already comes bundled with a lot of exporters and you can open the python code for one and have a look at it and maybe, modify one to suite your needs. However, to dabble with the code, you must have solid 3D graphics and 3D programming concepts. Blender offers very little help or documentation on its design, so you have to understand why certain things are the way they are.

The other thing that helps a lot is the huge blender community support. Help is always at hand, people are willing to help out. That is not to say that blender documentation is bad, it is really good, though I must say the plug-in system docs are a little bit cryptic. But on the whole using blender to create game assets has been a win-win situation for me thus far. I have included some screens of art assets created in blender and then used in the game.

blender1.jpg

Gem asset in Blender

Blender screenshot

Power-up asset in Blender

Game using the same assets.

Assets in the game

For any blender noob (, that is not to say I consider myself a pro,) the best way to get started is the blender video tutorials. They guide you through properly and allow you get you hands set on the blender interface. After doing that it’s just a matter of following the blender documentation. That is all you actually need to get started with the software. Yes, it will take a great deal more to master it, but this should be enough to get any newbie started.

Selecting a scripting engine – Part 1.

Last weekend I finally decided to look into a long standing issue. Integrating a scripting system into the engine. There is no denying scripting systems add immense flexibility to a game engine and I intend to provide one to the O2 Engine as well. A little bit of history into scripting system for the O2 Engine; we had decided to integrate a script system for the Doofus game very early on, in the design spec itself, but dropped it later when it was found that a lot more was needed than was initially planned. A simple scripting system is very easy to integrate into the engine, but such an effort would have offered limited functionality. Though it was initially planned to have a very basic system for the engine, it was quickly realized during implementation that such an endeavor would be a folly. The O2 engine is an Object-Oriented monster and to have a superficial scripting system would not provide any substancial value addition to any future game creation process using the engine.

The main aim of any scripting engine should be to allow rapid development and in some cases rapid prototyping of game and game design ideas. This is where the problem lies. Any game created with the engine needs not only to interface with the engine code but also interface with the engine design. Game engines often have modules that interact with one another in specific and predetermined ways. This is where an engine is different from a framework or a library. An engine offers a higher degree of design abstraction than even a framework would. Not only are most of the design decisions already made, some of the implementation decisions are also made for you. This not to say that an engine can’t be flexible, in fact it has to be. You will never be able to create a game with it if that were the case. Engines allow for explicit flexibility, meaning flexibility has to be designed into an engine. Parts that need flexibility need to be designed to provide such and parts that don’t have to be abstracted away or totally hidden. A scripting system must be able to expose not only flexible elements of the engine but also expose the design of the modules and the interaction between them. Ideally it should extend the engine.

The one engine that does this with amazing effect is the Unreal engine. It has its own scripting language called Unrealscript. There is little doubt that the Unreal engine is probably the best game authoring system out there and this is partly due to the fact that it has an amazing scripting language. Tim Sweeny has a nice article on how the scripting language was designed, and he addresses some of the issues I have pointed out here. It is a must read if you plan to make a scripting language one day. It is probably beyond me currently to create and maintain a dedicated scripting language like Unrealscript for the O2 engine (maybe in the future), but that is probably the best solution to the problem. My best bet is probably picking up an existing scripting language and integrating it with the engine. There are quite a few of them to choose from, each having their merits and demerits. The ones that I am interested in are Python, Lua, AngleScript, Squirrel, GameMonkey. I plan to evaluate each one before deciding on the language to be integrated.

Last weekend I tried to integrate (my favorite scripting language) Python. Unlike the other languages, Python was never designed to be an embeddable language. It is more of a heavy weight application development language and probably will have the largest memory footprint among the others. I have also heard that it is slower than Lua and Squirrel. (I have no data to actually prove that yet, this is just hear say I got from Googling around.) It is however extremely popular and very powerful language. To be honest, I have a long history with Python and it was almost 5 years ago when I first picked it up, I have been Python fan ever since. Anyways, integrating Python using SWIG was easy. I have thus far only tried as small example, but everything went smoothly. O2 Engine however is totally another ball game. The engine has heavily templatized classes, which I am sure are going to be a pain to integrate. I also tried Boost.Python and it seemed even simpler, but needed a little more glue code.

This weekend (or whenever I get time) I will continue the integration exercise with Python. Then maybe move on to Lua and others. More information about that in Part 2.

O2 Engine: Technology preview of lighting used in the Doofus game.

UPDATE: The O2 Engine has come a long way after this post. It is now is directly tied into content pipelines with modelers like Blender and is capable of achieving far better lighting than what is presented here. This post talks about lighting in a fixed function pipeline which is pretty old technology. The Doofus game is released and can be found at www.doofuslongears.com.

Some preview of the lighting technology used in the game. This is not an in-depth explanation of it, but is just a preview so don’t expect technical details here. Maybe sometime later, (I will fill in the details) or you can just ask and I will be glad to explain it.

The lighting in Doofus works on several levels, ie passes. The passes are then composited to give a final image. This technology is not revolutionary and I certainly haven’t invented anything new, but I have used in a clever way so that it can run even on old h/w without much difficulty. It also gives the scene a nice cartoon effect.

Basic lighting.

First the scene is rendered normally with the basic lighting of OpenGL or DirectX. The O2 engine abstracts over both APIs and can use any one. The results of basic lighting can be seen in this image. (Click on the images to see a larger version of that image.)

This type of lighting is pretty basic. The scene seems pretty bland and devoid of any real excitement. This lighting shown here is the default vertex based lighting given by the rendering APIs.

The real excitement comes to the scene when shadows get added to the scene. In case of the O2 engine and the Doofus game I am using Stencil Shadows. Stencil Shadows.Stencil shadows give hard crisp edges. That goes nicely with the cartoon theme of the game. In the next image you can see the shadows added to the scene. Along with shadows I have added a extra brightening pass i.e. Portions not in shadows are brightened up. That gives an illusion of soft sunlight (, the kinda sunlight you have very early in the morning).

Shadows add cohesion and drama to the scene. You can see a stark contrast between the two images, the one above without and the one on the right with shadow. The “drabness” of the scene is gone.

Lighting shadows plus a bloom filter.Things don’t end here. To have actual sunlit environments you have to have a super-bright component to the sunlight. Meaning, if you watch actual sunlight you will see that it is extremely bright with a halo like effect created at each shadow’s edge. For this, the engine does on more pass and applies a bloom filter to the scene to emulate sunlight.

The resulting scene looks actually sunlit, with the sunlight shining off bright surfaces. Watch the shadows boundaries closely, you will see what I mean. Now the scene looks correctly lit by sunlight.

Sun rendererFinally I want to show how the engine displays the sun. Observe the image on your right. You can see the sunlight bleeding through the edges of the roof just like an actual sun would when viewed across occluding geometry and notice the sun rays filtering through. The engine uses a similar variation of the multi render pass system explained earlier to achieve this effect. Just comes off looking great!

All images are actual game images captured while running the game in real-time. You can find more images of the game in the gallery section on my site.