Thursday, August 11, 2005

Truly cross-platform UI?

O.K., I still want to create some more games in my life. I have some ideas (more precisely "pre-ideas"). I don't have much time (more precisely, I don't have much time for things which won't bring me any money). But I want to try.

I have tried many, many, many programming languages, libraries and IDEs. However obscure they were, I at least TRIED them. Unfortunately, the languages that seemed most elegant and promising to me (namely Smalltalk and Eiffel) are actually used by so few people that I am basically unable to do anything more complex in them. Please note the use of "I am". The fact is that I PERSONALLY am unable to devote time to "grokking" the concepts that are undocumented and/or badly implemented and the respective user bases are so small, it's matter of pure luck how soon your questions are answered in mailing lists/newsgroups. Again note that I PERSONALLY am unable to work in this way. When I have three hours in a week to devote to my hobby, it's simply unacceptable for me to stop working after one hour, post a question to forum, and then wait several days for an answer.

Note that I am in no way bitching about the lack of support for these (and other languages). I think that both Smalltalk and Eiffel (more precisely: their free implementations) are great concepts and the fact that their user base is so small is a sad testament to the current status quo.

Speaking about status quo: Unless I will be paid very large sums of money, I will never voluntarily program in C/C++ or Java. It's out of question for me to develop my pet fun free project in these languages (with enormous user bases) which I consider aberrations. I know, I know, it's not a wise business decision or a wise decision at all - I am not necessarily businessman or wise person. I simply did not see any semblance of FUN in these languages. That doesn't mean I think you are stupid if you use them.

So, during my attempts to to strike balance between "language beauty" and "sufficiently large user base" factors (which seem to be mutually exclusive), I settled on Ruby which seems to me like a cross between Python and Smalltalk.

Now we are finally getting to the point...

With the language choice hopefully solved, I had to start thinking about the UI. First of all, the game will consist of text and simple (VERY SIMPLE) graphics (which will be put mostly to informative use - arrows, icons, simple tile-based diagrams). That's the necessary choice because I am not more of an artist today than I was 20 years ago:



(Hahahahaha!)

Secondly, the game will contain lots of text. In Czech. Everything is developed in UNICODE, thus the UI has to support it. (Surprising number of widely-used libraries don't.)

The game will be controlled mostly by clicking and "mousing over" (with text boxes popping up). There will be keyboard shortcuts and there will be some SIMPLE real-time interaction (press the required sequence of keys in the required time etc...). In any case, 99% of it will NOT BE REAL-TIME. Also, I think I don't need any sound, although some MOD/MP3 playing routines would be nice.

Now, another "problem" is that I am currently using Linux (Debian) and I am booting into Widows only once or twice each month, when I absolutely need to use FL Studio or other applications which have no Linux equivalents (there's much less of them than I initially thought, I am happy to report).

This means another problem: I am developing the game under Linux. (Using only free software.) Of course I am not ENTIRELY stupid and I want the finished game to be available to Windows users. However, I don't want to spend much time converting it. Or, rather, I don't want to spend almost ANY time converting it to Windows / other platforms. That means many supposedly "cross-platform" libraries like TK or SDL are also out of question. Furthermore, I need clear instructions for average non-stupid person to download required stuff and run my Linux game under Windows.

All of this led me to conclusion that might seem absurd at first, but the more I think about it the more sense it makes. I will use Firefox as the UI!

Now, think about it: Almost everyone either has installed or is able to install Firefox. Almost everyone is able to download and install Ruby (even the Mac guys, I think). The game itself will run its own simple webserver (Webrick is included in the default Ruby installation) which will be more than enough because it will only run locally and serve the single local player. There is no problem with Czech text and simple graphics in HTML. When I see the UIs at gmail.com or maps.google.com, I am pretty sure I can create pop-up infoboxes and keyboard interactivity exactly as I want. I think I won't even need to use AJAX but it brings even more interesting possibilities to the table.

Of course, I know most of the people would prefer single clickable .EXE file. Well, tough luck.

Anyway, all of this does not mean I will ever finish anything, of course. But it makes me feel warm and fuzzy to think about it.

12 comments:

Anonymous said...

If you were going to use C/C++, Pascal/Delphi or Python, I would suggest to use OpenGL for drawing graphics (in your case 2D) and use GLUT library for system dependent tasks. Then your application will be 100% portable (and what's more - it will be really neat, because GLUT handles OpenGL inicialization nicely).

I don't know how good support Ruby has for GLUT (I'm fairly sure that Ruby can work with OpenGL, it's very simple to port it). Check Ruby/FLTK, maybe that does the job.

The idea of using Firefox is really nice, but then I would forget about Ruby and do it all in Javascript/XUL (e.g. in the set of languages in which all extensions are written). Then the game could be installed really smoothly (no need for webserver and other stuff).

Blender is done in Python and yet it is distributed as one exe file.

Now I see that NeHe has at least one of his OpenGL tutorials (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02) ported to Ruby. I'm not sure whether there is tutorial covering GLUT (I believe that this guy likes better to set it up all himself), but you can take a look.

Anonymous said...

Hm, looks like the Ruby link is broken, sucks...

František Fuka said...

anonymous1: First of all, I did several middle-scale projects in Python but I like Ruby somehow better (for really subjective reasons). I realize Python has more and better libraries (and bigger user base).

I am almost afraid to say this, but I never used OpenGL in any form or shape, I know next to nothing about it and it seems overkill to me to learn it just because I need few small icons somewhere. Also, aren't there cross-platform problem with OpenGL and non-english fonts?

Re Javascript: I am not sure about the latest developments, but I always thought that Javascript is unsuitable for complex projects (and my game will certainly have VERY COMPLEX logic and dynamically-generated consistent world).

Blender (the 3d modeller) is written in Python? Really? Then I presume it must also have lots of compiled C libraries, I don't believe it could be as fast in pure Python. Also, I am aware you can distribute basically anything as single EXE file, but to do it, you must boot into Windows or at least know the EXE format pretty well, which I don't and don't want to :)

anonymous2: The link seems to work for me. Anyway, search for "Ruby language".

Anonymous said...

will that be multiplayer online game? or just classic singleplayer game that could be played online?

František Fuka said...

dusoft: It's not supposed to be online OR multiplayer! That's why the choice of it being played in browser might seem a little weird but it makes sense to me

Anonymous said...

I meant whether you need to be online to play it, or you could just download it in a gzip or whatever package and then just run in your browser as a local webpage?

František Fuka said...

Yes, it's completely local. You just start the game, it launches Firefox and its own server (running on some high port).

Eso said...

What about Flash?

František Fuka said...

What about it? If you mean Flash as an UI (communicating with the server), it's overly complex, I don't need the features it provides. If you mean writing everything completely in Flash, the game will be much too complex for that (and anyway, creating Flash files in Linux is not easy).

Anonymous said...

It's your game, so feel free to use what technology you prefer, but I don't think launching its own web server is without problems.

e.g. i do run my own server and server mostly waits at port 80 for incoming connections... I doubt two servers will be able to use it at once...

Just my two cents.

František Fuka said...

dusoft: Sorry, but that's nonsense. Why should it run on port 80? The server will run on some non-privileged high-numbered port like "54321" (and the number will probably be configurable).

Anonymous said...

-Tohle je na moji angličtinu složitější, takže anglofonní mají smůlu-
Mohl bys naťuknout svoje "pre-ideas"? Totiž jestli jsem to dobře pochopil, máš na mysli něco jako textovky (hodně textu~málo grafiky). Ve vývoji her se nevyznám, ale myslím, že tady existuje šance vytvořit dostatečně zábavnou hru s primitivní grafikou. Zjednodušeně řečeno ryze akční hru, kde by se děj odehrával v reálném čase, ale jen na úrovni příkazového řádku. (Hráč by měl možnost zobrazení slepé mapy a pouze by dával pokyny svým postavám podle aktuální situace.) To by myslím bylo účinné na procvičování paměti.