OpenGL Longs Peak. Sooo Loong!

I am an avid follower of OpenGL news as it was the first graphics API (other being Direct3D) I ever picked up. So I must confess I have a little bit of a soft corner when it comes to OpenGL. I thoroughly dislike comparing the two APIs because I consider them equivalent in functionality. However, recent developments in DirectX have put it at a clear advantage as compared to OpenGL. Direct3D implementations (DirectX 10) already support SM 4 with cards like the 8800 (Geforce 8800 GTS from NVIDIA) already hitting the market. That in itself shows how far behind OpenGL is. I have been hearing Longs Peak for too long and either the ARB committee is sleeping or just too lazy off their a** to get anything done. Either way OpenGL has a lot of catching up to do, which is a pity since OpenGL was better designed initially.

The longs peak update does promise a few changes and improvements. For example the buffer objects finally have the necessary improvements like

  • mapping only a specified range of a buffer
  • strict write-only access
  • explicit flushing of altered/written regions
  • whole-buffer invalidation
  • partial-buffer invalidation
  • non-serialized access

most of which are a part of Direct3D implementation already and are available in Direct3D 9.0. These should have been done a long time back.

Longs peak has also introduced an object model. No its not a direct OO approach, but something of an OO approach wrapped inside an C API. While OpenGL can’t be convented directly into an Objec-Oriented library, the committee came to a conclusion that it was impossible to move further without having to work on some kind of object model. I can understand their concerns, but the object model thing looks kinda overly complicated. Whist the exact implementation details will only be known when longs peak is released and the drivers come out, we have to hope that we are not in for a any nasty surprises.

Thats not to say everything is bad. I mean, in the end this may just look like a rant in a couple of months, maybe the spec is really good. I just hope they release the spec soon.

Screen-shots are now reposted.

Sample screen-shotThe screen shots that had disappeared have now reappeared, i.e. I had to repost them on the site. The site is now at near 99% operational. Check out the screen-shots section for more images.

New website and new blog.

As you can guess from my earlier post, my old website was taken down rather mysteriously and I am not too happy about it. But there is nothing much I can do except mull over my loss. Anyways, things have to move on and so, this will be my new site from now on. There is one more change I have made, I am now blogging on wordpress instead of b2evolution. The switch is intentional, and I am already pretty happy about it. Most of my dev articles are still on the b2evolution database, which I plan to slowly by surely move to wordpress.

As far as the main site goes, it will be the cms site. There is no change to that. The site is not 100% up as yet. Some sections like the screen-shots are being worked on as I write this. But I don’t see any major problems over there. I am pretty happy with Joomla cms, so nothing changes on that front. I will continue a similar method of posting updates regarding game development (for those who have no clue, I am currently developing a 3D cartoon game called Doofus3D, and I blog all development) here as well as on the main page. I hope to finish migration of the site by tomorrow evening, since I am a little caught up in last week’s beta release.

Unlike the previous site however, I wont be having too many categories. I want to keep the ruckus to a minimum. Things like road-maps and progress will now on be under “Development” category. Anything specific about the O2 engine will come under “O2 Engine”. The one thing I miss however is the ability to categorize links. But I think I can always use my main site for that purpose. Joomla provides a much better links module and that should be the logical place where the links should be.

I just hope this site stays up longer than the previous. Keeping my fingers crossed.

Python: Taming the serpent.

Python is a high-level programming language created by Guido van Rossum, a dutch computer programmer. He started out with a set of design goals for Python that allowed Python to be easy, intuitive, easily understandable, open source and had a very short learning curve.

Python was born in 1991 and was conceived by Van Rossum in the late 80”s, so per say it is not a very new language. So what makes it so special and more importantly why all the ruckus? Well, because of its simplicity Python is quickly becoming one of the leading programming languages and language of choice among developers today.

I am a staunch believer that no one programming language is better than the other. Forget about the language shoot-outs and the bench-mark tests created by “so called” experts. They are at best inconclusive and most of the time, flawed. Each language is like a tool and each is designed to address a particular problem or sets of problems. As an experienced developer you must know the merits and demerits of every language (or at least most of the popular ones). Don’t be shy to learn a new language, you probably do yourself a world of good by learning three, four or even more languages.

While C++ and Java (and to some extent C#) are the unequivocal barons of the programming world, Python’s attitude is very different. Its likes to be the short sweet comedian with its unconventional syntax and ridiculously boyish code layout. Let the looks not fool you though, Python is a very powerful language and can easily go head to head with any of the above mentioned trio. Python has all the power the three can yield and yet allows you to be simple in every sense of the way.

Another very important aspect of Python is, it is very easy to learn as compared to C++ or Java. With a good resource, you can pick it up within a matter of days. The syntax is very easy to understand and almost seems natural. I have seen people, who have had no programming backgrounds earlier, pick up basic Python skills in 2 or 3 days. Compare to that, learning C++ could take many weeks. C++ is an old language and has some quirks like, poor (or nonexistant) memory management, pointers, undefined behaviour, no garbage collection and many more. Most modern languages including Python solve these and many other issues.

For me, coming from a C++ background, Python was like a blessing in disguise. Make no mistake about it, it is not a perfect language. No language is. But it has its place. Most C++ veterans I have worked with and who have used Python swear by its merits. One senior colleague of mine even went as far as saying that Python was like a C++ scripting language. Well, it is not, but he was speaking metaphorically. What he meant was, Python has most of the merits of C++ and almost none of its short-comings. I still work 90% of the time on C++ (or is it 95%), and I am not putting down C++ in any way. C++ will continue to be popular and I am sure I will be working in C++ for quite a while more (since I am an game engine programmer, and C++ will probably stick with me longer). As I said, each language has its merits and demerits.

Python offer higher productivity than C/C++, meaning you can write, debug, test programs faster in Python than you can in C++. It offers all the new programming language features like modules, classes, exceptions, very high level dynamic data types, dynamic typing and automatic garbage collection. Yes! Python is slower than C/C++ per say. But slow is a very relative term. A badly designed program in C can be slower than a correctly designed program in Python or any other language. Theoretically a program written in assembly/machine language should be faster than any program, even when compared to a compiled language program like C++. You don”t see many programmers (even game developers) write codes in assembly, do you? Why? Maintaining an assembly program is a nightmare. Case and point to C++. As programs get larger, complexity increases exponentially. Python by design has a very clear syntax which goes a long way in avoiding complexity.

So what do you require to get started with Python? Well first download and install Python. The 2 places that I recommend are The Python official site and Activestate. I am a little partial on Activestate because their distribution involves a complete package including comprehensive documentation and an IDE (under Windows). After that you need a place to type in Python code. I personally used only a notepad (under Windows) or emacs (when using under Linux) when I began. Today there are a myriad of tools/IDEs available. The Python community is large and had done an excellent job at coming up with some very good tools. Strictly, you don’t need any tools. However most IDEs do offer productivity boosts. My current favorite is PythonWin. Many people also prefer SPE. What you use is up to you really. As a beginner I would recommend Activestate’s distribution and directly using the command line and/or notepad/emacs.

The Python documentation comes in with all the tutorials you will ever need to get started with the language. Taking the tutorial one step at a time is all that you need to do. The Activestate’s distribution also has 2 excellent books bundled in plus some fair extra bit of Python goodies in the form of documentation. The Python tutorials found in the documentation are geared towards an absolute beginner. If you are already a programmer working on (insert your favorite language here), then picking up Python is just a matter of reading through the first few chapters. For beginners, it is recommended that you read through all the chapters one by one. Examples start with simple calculus and slowly move on to more advanced stuff like arrays, tuples, sequences. Within a short time you will be proficient in writing complex scripts rather easily.

Python is object-oriented, but in sprite a lot less complicated than C++ or Java. Python’s class mechanism adds classes to the language with a minimum of new syntax and semantics. Very easy for a newbie to pickup, and often appreciated by veterans. All class members (including the data members) are public, and all member functions are virtual. You could argue that this violates encapsulation and to some extent is an over utilization of polymorphism, you are correct, it is. What it does, is makes things much simpler. Instead of a newbie trying to figure out how polymorphism works or why his protected functions are not accessible, Python empowers him to concentrate on actual writing of his program. Maybe you don’t agree with me, but this is very much in line with Python philosophy, short and sweet.

Next we move on to GUIs. GUIs are the foundation of computer programs these days. A good GUI can make all the difference and can literally make or break your program, unless of course you are strictly writing server-side code or device drivers. Python comes bundled with Tkinter (Tk for short) and is Python’s de-facto standard GUI. Tkinter is Python’s interface to Tcl/Tk. It is a lightweight toolkit which offers basic functionality through a set of widgets. It is very easy to learn and understand, and if you are new to GUI programming, you will probably find Tkinter a lot easier to pick up than most other toolkits. Although tkinter is very easy to learn, it falls short for complex GUIs. Tkinter is by design small and lightweight (adhering to python philosophy), but if your GUI is complex, you end up writing horribly complex code to get in all the functionality. For more complex GUIs there is an excellent toolkit/framework called wxPython. wxPython is actually a Python binding for the popular (and comprehensive) GUI package calledwxWidgets. The package offers nearly complete functionality w.r.t modern GUI design. It has a huge collection of widgets and an equally large community behind it. There are also bindings to other toolkits please refer below.

Being a game developer, I just could not resist not having something related to game development in this blog. So here it is, Python has bindings for OpenGL, the defacto industry standard for 3D development called PyOpenGL. OpenGL itself is limited to 3D graphics, what most game developers or, rather game development needs is an access to complete game development system. That is exactly what is offered by pygame. pygame is actually a Python binding for SDL and OpenGL. It is mature enough to be used in game development, but still has some way to go before it can be considered main stream. To be fair, I have only played with it for a while and I am no expert with it. I encourage you to try, and if you are a budding game developer or a newbie to game development, then I strongly suggest you take a tour of the library.

Before I conclude this post there is one more aspect of Python that I want to talk about and that is Python as scripting language for your program. Python can offer strong extensibility features to your program/library written in C/C++. Even if your library itself is written in C/C++, having python bindings to it can boost productivity significantly. Even with game engines you don”t need to have all your code in C++. I fact doing so can be a real pain to deal with. C++ is not the friendliest of languages where as Python fills in the gaps left over by C++ nicely. To be fair, Python was never meant to be a embeddable scripting language. It is designed to be a high level language for rapid application development. There are other languages like Lua and/or AngelScript (also many more) that are more geared towards the embeddable language design philosophy. So go back a few sentences and read what I said; I said “Python offers strong extensibility features.” Meaning you can write the core of your program/library or parts of code that are time-critical in C/C++ and then have python bindings for them so that they can be accessed via python. You can write bindings for C/C++ code using SWIG or using Boost.Python.

As a parting note I would like to mention StacklessStackless is not a library or a module but a modified version of Python that allows the use of light-weight threads called microthreads. Microthreads allow for all benefits that threads have to offer at the same time avoiding complexity and overheads associated with conventional thread based programming. Using any kind of threading implementation in your program can be a challenge, so Stackless can find limited use with conventional programmers. Microthreads are mainly used in AI (Artificial Intelligence) systems for game engines to allow a more natural module design. They are similar to coroutines in Lua.

The truth is that there are many (many) ways to implement advanced functionality with Python. Though it is debatable whether Python offers a pure functional programming paradigm, it does allow for a “functional style” (for lack of a better word) program to be written. Another advanced concept is concurrency. Concurrency mechanisms are often difficult to implement with Object-Oriented style of programming. It involves a whole new set of design fundamentals and issues. Though my knowledge in these areas is limited, I have read a paper on this very topic a few years back. It can be found here. You are free to draw your own conclusions on these subjects.

Last, for some real world implementations and applications. It is no secret that Google uses Python extensively to power it’s engine and services. Another good example is an open source 3D modeling program called Blender. There are many more, but I leave it to you as an exercise.

SOME EXTRA GUI LIBRARIES FOR PYTHON.

PyQt
PyGTK

What are game Genres?

Genres or game genres is a term used for the classification of games. A genre of a game generally outlines what type of game it is, how it is going to play, what type of content it may carry. For example a FPS (First person shooter) game will always be associated with violence and violent content. The broad nature of the game will be one where you will have to shoot up a bunch of enemies to reach your objective or your intended goals. A FPS game could have a storyline where you could fight your way across alien worlds or engage enemy troops in combat in some war episode. Essentially the experience remains the same.

Classification of games

Classification of games is not always systematic and many individual games can easily fit into one, two or may be even more genres. Some types of games do not fit into any type of genre. Sometime there is no absolute way of saying which games belong to a genre, because genres are by necessity defined abstractly. The point of classifying a game to a particular genre has more to do with marketing than anything else. A first person shooter has a certain audience which the developers and the publishers want to reach out to. Genre classification helps them achieve that.

Game genres can”t be made too rigid, this is because of the fact that games are essentially an art form. Any piece of art can and should maintain some sort of ambiguity with regards to its form and nature allowing the artist to achieve a true unique piece of work. The other reason is that there are some truly amazing games out there which will find it difficult to place themselves in a rigid genre lineage. Such games may not get marketed and eventually not get made.

Sub-Genres

Like most taxonomic entities, genre is open to dispute. So much so there are continuous ramblings on forum posts on this very topic. Ultimately all of this has given rise to Sub-Genres. As the name would suggest, sub-genres are genres inside genres. As if genres themselves weren’t confusing enough, sub-genres can sometimes add fuel to the fire making matters even more complicated.

How are games classified

New games are classified based on already published games. If a game is similar to a game that is already classified into a genre, then the game gets that genre. So how were the very first genres made? How do new genres evolve? Well, the ihobo site say genres have been defined by the games that establish the new genre. When Wolfenstein was first distributed, it was considered to be a new sub-genre of the Shooter category – a first person (3D) shooter. There were games before Wolfenstein which comfortably fit into this genre, but it was the arrival of this particular game (and its successor), Doom which defined the new genre category, the FPS genre.

ihobo considers a true genre to be a particular unique category of games, and a sub-genre to be a division of that genre. For example, 2D scrolling shooters can be considered a sub-genre of Shooters.

In the ihobo taxonomy the highest level genre categories are considered Phyla, in parallel to the typical way animals are categorised. Each Phylum is then divided into Classes, Orders and Families. The use of these terms is explained in the taxonomy. Each Phylum is considered a Genre, and each sub-category of a Phylum is considered a Sub-genre. There are also Pseudo-genres, which describe a stylistic element of games, rather than the core of the game play (such as Survival Horror).

Types of Genres

Further reading

Conclusion and background

Most sources about this topic that I found were far form conclusive. Maybe this is because game genres is such an abstract topic. Every different website has a different genre classification. Personally, I think that game developers should concentrate on having a good game play for their games and leave the genre classification debates to the gamers and people that have too much time on their hands.