Blog > Blog > Languages, so many languages

Languages, so many languages

Posted by Hamcha on October 23, 2011


As I talk about project Luna to more people I often get questions, some of them are recurrent so I would like to address one of them today.

The question is "Why did you choose C++ and not [INSERT LANGUAGE/TOOL HERE]?"

In many cases, I knew about that language/tool, and don't think that I chose C++ without considering other alternatives, it took me a long way and many tries before I finally decided to stick with C++, so I'll try to explain how I got there and why I didn't choose something else.

...


So, just to clear things up, I have NEVER used C++ for something not-school-related (that were stupid things like string manipulation) before, so it's really my first big project with it, I used to be a C#/Python fanboy (while now I'm a C++ fanboy) and my opinion will always be:


Different purposes call for different languages

What I'm trying to say is that this big internet is full of different languages and each one of these has good and bad things.

For example:

  • Saying "C++" is like shouting "SO MUCH PERFORMANCE!" but when it comes to ease of use, it really kicks you in the neck (never tried that, but it looks so painful..);
  • Java may be slow and everything, but you are guaranteed to write something one time and it will work fine everywhere;
  • Python is even slower but.. have you ever tried to write something in python? Is like Programmers' heaven.

 

Sure, some languages may just suck or have no reason to exist at all (or were made to be hard to use) but I think that nobody should stick to only one language.

Some languages are easier to use and justify the more memory they use and seriously, do you REALLY need 100% CPU performance on a text editor? Sometimes it would be easier to use something like C#, pay some CPU and avoid every possible memory leak. To me it's a fair deal.


About Project Luna

What I wanted for project Luna were: Enough Performance, Mod support and Cross Platforming (on OS X I can't use XNA or UDK)
What I was ready to sacrifice were: Development Time and Ease of use.

On those requisites I excluded beforehand:

  • Python - for lack of performance;
  • Java - good for cross platforming but I hate it.. and again: lack of performance;
  • UDK / XNA / Everything Windows only - not cross platform;
  • Stencyl / Flash - once again: lack of performance;

 

But wait a moment Hamcha.. didn't you say "do you really need 100% CPU performance" like a minute ago? Project Luna doesn't seem so CPU hungry to me.

I'd say that the fact that Project Luna is a GAME is enough to require performance. Especially if you care about slower PCs like me.
I have a netbook and I would like to be able to play my game on it too. 


The journey begins...

Since the development of Project Luna has been affected by the development of "Holidays in Ponyville" (my previous project) I think I should also talk about that one, so here's what languages and tools I used for Holidays in Ponyville, why I switched to them and why I left them.

A quick overview about Holidays in Ponyville

My Little Pony: Holidays in Ponyville initially was just the mix between two things I always wanted to do.
I always wanted to do a home-brew for the Nintendo DS since I got it and I always wanted to do something Pony-related since I started watching MLP:FiM, so an home-brew game about ponies for the Nintendo DS was perfect.

C++ and PAlib

I started with C++ and PAlib (that were made to make NDS development easier) and did some concepts beforehand. I called the person who introduced me to ponies and I asked him if he could have helped me (he's the one who is still helping me with Project Luna).

The project was going fine until I hit two problems:

First the fact that, with PAlib, I couldn't have done something bigger than 4MB since PAlib loads everything into memory (and doesn't support dynamic loading of resources.. that sucks) and then the fact that I needed 3D sprites and PAlib doesn't have an easy way to access them.

So I gave up on the DS platform but my desire for something pony-related was still flaming inside me, so I decided to move to the PC platform.

Unity3D

So, You may think I'm going to talk dirty of Unity3D. I'm not.

Unity3D is a great and impressive tools with an active community and everything.. if you need to make 3D games.

2D Games in Unity are just too difficult to make.
There are things like the Sprite manager that costs money but since I couldn't ever sell a game about ponies I wouldn't even think on spending money on a project like that.

I tried to make something by myself.. and I failed.

Construct

Construct is a tool inspired by Multimedia Fusion 2 aimed to make high performance HWA 2D Games using DirectX 9.
Some paragraphs earlier I said I wanted cross platforming so let me clarify this:
Back then I was a Windows user, Windows fanboy and anyway the project was initially going to be a DS homebrew, so you can imagine how much I cared about having my game on multiple platforms.

Still, Construct has inherited flaws from the Multimedia Fusion 2 workflow like the lack of a decent instance management system.
This stopped Bounce Rivals 4 a year ago and stopped also Holidays in Ponyville. But I didn't give up... yet.

Stencyl

For the people who don't know Stencyl: It's a tool like Game Maker that generates and compiles Actionscript code using the free FLEX sdk (and using the Flixel and Box2D libs to make things easier).

Bad news about Stencyl: It's flash with autogenerated code, so get ready to sacrifice performance.

I did some things here but I finally gave up on doing the project for many reasons.


The comeback

One day on the bus toward school I wondered "How cool would it be to play a game as Celestia?", that's how Project Luna began.

The implementation problem was the first thing I decided to address this time.
Since the idea for Project Luna came when I was already an OS X user I excluded C#/XNA immediately.

Talking on teamspeak with some friends the decision of C++ was pretty much clear from the beginning.
The second decision to make was what lib/framework/engine would I have used to develop the game.

I did try SDL before and I didn't quite like it (mainly because it was made more for C than C++) and I heard many good things about SFML, being OOP and everything, so I chose it over old stuff like Allegro that never interested me.

For the scripting the LUA API didn't quite convince me since it doesn't support OOP so I searched for other scripting languages like Squirrel or Angelscript, and about that you can read this other article I wrote.

So, this is how I'm coding right now, C++ and SFML, using SLB (Simple Lua Binder) to wrap C++ classes into LUA.


That's the end

Wow, I though I'd do a comparison about languages and why I chose this thing and not that, but looks like it has become an article about the evolution of my projects and how I switched from one tool to another.

So, before just hitting SAVE, I would like to thank CottonRage for restlessly* helping me even now and not killing me when I said to him that I cancelled Holidays in Ponyville just after he did some dialogues and ideas.

And to Tachikoma/Togusa for helping me with C++ when I don't know how to do something. I really wouldn't know how to handle pointers properly if it weren't for you.

* RESTLESSLY - Really? That's a real word? I love english (even though I do mistakes all the time.)

See you next time!

Grammar Nazis are welcome

English is not my native language and I'm looking forward to improve so if you happen to find some mistakes please point them out!

Comments:

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.