From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d32116f6f91c319f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: "Luke A. Guest" Newsgroups: comp.lang.ada Subject: Re: Ada suitablity as a game dev language Date: Mon, 22 Nov 2004 16:04:07 +0000 Message-ID: References: <41a152c2$1@x-privat.org> NNTP-Posting-Host: abyss2.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1101139448 28182 62.49.62.197 (22 Nov 2004 16:04:08 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 22 Nov 2004 16:04:08 +0000 (UTC) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Xref: g2news1.google.com comp.lang.ada:6327 Date: 2004-11-22T16:04:07+00:00 List-Id: 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.