comp.lang.ada
 help / color / mirror / Atom feed
From: "Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk>
Subject: Re: Ada suitablity as a game dev language
Date: Mon, 22 Nov 2004 16:04:07 +0000
Date: 2004-11-22T16:04:07+00:00	[thread overview]
Message-ID: <pan.2004.11.22.16.04.07.137467@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> (raw)
In-Reply-To: 41a152c2$1@x-privat.org

On Mon, 22 Nov 2004 03:45:22 +0100, Jeff Houck wrote:

> Greetings Ada NG,
> I'm new to Ada but have 15+ years background in C/C++ and x86
> assembly. I skipped Pascal and Java(yuk)and have used the usual 
> scripting languages, Perl, Python, Tcl/Tk, etc...
> 
> I'm bored with coding C/C++ and would like to try something new... 8^)

Tell me about it.

> Anyway, I'm really intrigued by Ada and I'd like to "go out on a
> limb" and see how Ada measures up to C/C++ for game development. I'm
> thinking about both the 2D and 3D regimes, such as an isometric style
> game in 2D and a FPS for 3D.

Well, like the others have said, Ada is a multipurpose programming
language, much like C and C++ are. Anything that can be done in C or C++
can also be done in Ada.

The problems you'll find are bindings. These you *can* do yourself with a
little bit of work, it's not that difficult to do, just a bit confusing in
certain areas, like data types and getting something more Ada like (a
thick binding compared to a thin binding), i.e. there is the Interfaces.C
package which gives you basic C types like int, etc. You would then later
prefer thick bindings which use the native Ada types, or your own
(preferable) this can produce a lot of code due to all of the conversions
necessary to get the data into the correct data types.

Now concerning types, In C/C++ you normally define your own types which
are platform independent, e.g. a 32-bit signed int, a 16-bit unsigned int.
Now a question that was raised in another thread concerned me about this,
a lot of people suggested that you should let the compiler decide what
type to use for a value, which is not what you want in games, you really
need to have something that is portable, especially for data formats, i.e.
I have a field which specifies how many vertices I have in a model, I've
decided that that needs to be a 32-bit type, therefore over all platforms
it needs to be a 32-bit type. Now you can use representation clauses to
specify the size, but surely you need to specify the type also?

Anyway, any C libs can be imported no problems into Ada, C++ is not
defined and probably won't be.

As for platforms, GCC exists for practically all platforms, yes even PS2,
Sony provide the source to it if you're a registered developer. According
to Robert Dewar, the GCC-3.4.x MIPS code generation needs work, so porting
it to PS2 could be tricky. Also, as Sony have had the brilliant idea of
combining all of the GNU source (binutils, gcc, gdb, newlib, etc.) all
into one directory, and they've modified the build scripts, it's not
possible to extract diffs for different packages (easily). It's also not
possible to drop in GNAT-3.3 (I think that's the latest version they
support) into the gcc/gcc/ directory and expect an Ada compiler to pop
out, it won't, I've tried it.

Another problem will be porting the runtime, there's practically no
documentation on it, so that'll be difficult.

For a game, you really need to conserve space, so another thing you'll
want to do is to stop the compiler from generating elaboration code for a
lot of stuff (if not all of it). GNAT can be told not to produce any and
everything seems to work ok, yes I've even tried array's with strange
boundaries. You'll also need to do this if you decide to use a very basic
Ada comiler without a runtime, also doable - especially on a console. But
it'd be better with one.

Another problem that games programmers hear is "don't use exceptions,
it'll slow down the game!!" Well, this might have been true a long time
ago, but GNAT does provide a new exception mechanism "zero-cost" which
provides tables rather than setjmp()/longjmp() calls. I haven't tried it.

But for desktop platforms, it's a piece of piss really. OpenGL bindings do
exist, I've been modifying them - haven't touched them for a while, but
they do work. They're a combination of two sets of bindings, although a
generator really needs to be written to take the opengl.spec files and
convert them to packages:
http://www.abyss2.demon.co.uk/projects/ada/index.html

Believe me, there's nothing I'd rather do than do develop in Ada, but for
games, it's just not viable...yet. Until other companies start to realise
that programming massive games in C/C++ is really a waste of time (and a
lot of time at that, because they have such stupid schedules) it's just
not going to happen.

My latest project (a game engine) is being written in C++ basically,
because I will be able to sell it if it's written in a language that other
developers can use straight away. If it's written in Ada, I won't be able
to sell it.

> You don't see Ada mentioned anywhere (that I know of) in game
> development circles. Is there a specific reason why?

And you won't, a lot of games programmers haven't been to uni, and if they
have, they didn't do computer science, or they did but it's before Ada was
being hyped (~1990's), so they wouldn't have heard of it. They still have
the mentality of "everyone else uses C/C++, so it must be great."

I thought about writing an article for Gamasutra, but it ended up being a
bit of a rant (like this ;-)), so I didn't finish it. Maybe I will when
I leave this company ;-D

> I'd like to hear from any in this NG with an opinion or insight on the
> subject. Thx!

Nay problems,
Luke.




  parent reply	other threads:[~2004-11-22 16:04 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22  2:45 Ada suitablity as a game dev language Jeff Houck
2004-11-22  3:00 ` John B. Matthews
2004-11-22 23:10   ` David Botton
2004-11-23 13:10     ` Manuel Collado
2004-11-24  2:22       ` David Botton
2004-11-24  2:55         ` Jeff Houck
2004-11-24  8:53           ` Martin Krischik
2004-11-24  9:50           ` Manuel Collado
2004-11-25  1:00             ` David Botton
2004-11-22  3:23 ` stephane richard
2004-11-22  4:25 ` Jeffrey Carter
2004-11-22  8:15 ` Martin Krischik
2004-11-23 21:39   ` Nick Roberts
2004-11-24 17:59   ` Sandro Magi
2004-11-25  1:26     ` Jeffrey Carter
2004-11-25  8:47     ` Martin Krischik
2004-11-22  8:36 ` Dmitry A. Kazakov
2004-11-22  9:31   ` Dale Stanbrough
2004-11-22 11:02     ` Dmitry A. Kazakov
2004-11-22 11:44       ` Dale Stanbrough
2004-11-22 14:15         ` Dmitry A. Kazakov
2004-11-22 23:12     ` David Botton
2004-11-23  8:20       ` Luke A. Guest
2004-11-22 10:19 ` Alex R. Mosteo
2004-11-22 23:14   ` David Botton
2004-11-22 16:04 ` Luke A. Guest [this message]
2004-11-22 16:49   ` Alex R. Mosteo
2004-11-22 17:43     ` Luke A. Guest
2004-11-23  0:28       ` Dani
2004-11-22 23:08 ` David Botton
2004-11-24  1:05 ` Jeff Houck
2004-11-24  8:33   ` Luke A. Guest
2004-11-24 15:11     ` Jeff Houck
2004-11-24 19:26   ` Ludovic Brenta
2004-11-24 19:57     ` Jeff Houck
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox