Before i dive deep into developing an engine, I would be wise to consider the issue of portability. The target systems in mind from the start would be: *nux, Mac, Windows. Branching out beyond that as time permits. I'm open to to any language for development
Recommended programming language and a comment as to why would be great if you can spare a moment, could save others time in the future too to see what everyone recommend. I'd like to do something crazy like Haskell but it's lacking in the Library area for something such as this I think (I could be wrong), I'm also not sure how difficult it would be to make it portable.
Anyways I am eagerly awaiting your comments :)
ConsistentCallsign at
Re: Portable Engine Coding
Use machine code if you want perfection. Fastest code there is :P
Edited by ConsistentCallsign at
Nepoc at
Gee, thanks :(
Next I'm sure you'll explain how "portable" machine code is.
I'm likely going to go with C or C++... I doubt i would have enough time to code an engine well enough in Java to get decent performance out of it. Never the less if someone has some useful comments I would like to hear them.
Cheers
0xC0DE at
Hey,
It’s indeed NOT wise to choose for assembly language. But C / C++ and Java are really good options. I think it depends on what kind of engine you would like to create.
Java is a really great language to work with. It almost 100% guarantees that it would run with exactly the same code on all 3 platforms. Java also comes with some awesome libraries that make your life easier.
C / C++ code is going to be faster then Java code, that’s for sure. But it’s also harder to get it run on all 3 platforms (it still is very doable, just not as easy as with java). You also need to do a lot more on yourself.
If you’re going to make a doom or quake like engine, I would suggest Java. It would be slower then C/C++ but it doesn’t really matter because it would still be extremely fast on today’s computers.
If you are going to write a software engine only (like I would suggest for a doom engine) in Java. You should know that even though Java has a build in libraries, you are still free to come up with better solutions. For example: In my 3D java engine, it didn’t use fillRect or drawLine from the java library. Instead I created an image object and I used it like you would normally use a video buffer in C. This was much faster.
If you want to create something more nextgen like doom3 (bumpmapping,etc) I would suggest C/C++ because the speed might be needed then.
Ñuño Martínez at
My personal preferences are to start with Object Pascal to create a kind of prototype, once it works then translate it to C (and I've said C, not C++).
Object Pascal is fast to write and to read, easy to understand, portable (Look for Free Pascal) and supports most common libraries (OpenGL, AGL, SDL, etc). This make it the best option for prototyping.
But C is better to build hight performance medium/low-level code. It's possible to program using object oriented techniques (OOP is more a philosophy) including inheritance and encapsulation (think about structs with pointers to functions, void pointers, and non-extern objects). May be it's harder but executables are smaller and faster than C++ and are much more easer to debug and profile.
At last, it's easy to translate from Pascal and Object Pascal to C (even easer than from Object Pascal to C++).
But I repeat: these are my personal preferences. ;)
Edited by Ñuño Martínez at
Levent at
i'm pretty comfortable with c and sdl. works nice with macosx, unices, windoze. allegro should be fine too, i've used it at dos days with djgpp.
you can find huge amounts of engine coding examples in c and pascal at dos and windows platform (programmersheaven, flipcode, thefreecountry) if you want to hack and learn on other people's work.
Nepoc at
Thank you all so far :)
I've heard some negative things concerning performance and SDL. Have you noticed anything as such?
Thanks for mentioning Object Pascal, I had not even thought of using it for anything. It does look like it would be fast to do some prototyping, I'll have to give it a shot.
I took a deeper look into Java as well, for educational reasons I'm considering developing in Java along side whichever programming language I choose (yes I know I'm crazy). In the end if it turns out to have decent enough performance I might make it the core of the project and optimize it.
Levent at
there shouldn't so much slowdown in sdl. they use assembly blitting routines (hermes) and such things to prevent slowdowns. but it can't be fast as using system resources directly with optimized assembly code.
Awesoken at
Since you guys are talking about a fast prototyping language, I thought I should mention Evaldraw. It uses C-like syntax and it compiles on every keystroke. Sure, it's missing some things.. like structures ; ), but keep in mind that it's still an active project.
jeffz at
Nepoc said at
I'd like to do something crazy like Haskell but it's lacking in the Library area for something such as this I think (I could be wrong), I'm also not sure how difficult it would be to make it portable.
There are plenty of portable libraries listed there and ghc is available for Mac, Linux and Windows.
GLUT for accessing OpenGL, OpenAL and ALUT, SDL for handling input, keyboard, mouse, joystick.
Plenty of options there =)
jeffz at
Nepoc said at
I've heard some negative things concerning performance and SDL. Have you noticed anything as such?
Probably largely baseless... the only negative thing I can say about SDL is the SDL-mixer library isn't good at looping short samples of music seamlessly on Windows.
If you use 2D, that is no OpenGL then you will be largely cpu bound, otherwise SDL is just there for providing a portable layer for handling input and setting up a window for OpenGL, so it's only really bound by your video drivers.
Ñuño Martínez at
jeffz said at
There are plenty of portable libraries listed there and ghc is available for Mac, Linux and Windows.
GLUT for accessing OpenGL, OpenAL and ALUT, SDL for handling input, keyboard, mouse, joystick.
Plenty of options there =)
And do not forget Allegro. ;)
jeffz at
Ñuño Martínez said at
jeffz said at
There are plenty of portable libraries listed there and ghc is available for Mac, Linux and Windows.
GLUT for accessing OpenGL, OpenAL and ALUT, SDL for handling input, keyboard, mouse, joystick.
Plenty of options there =)
And do not forget Allegro. ;)
I was talking about the Haskell bindings to those libraries, but yes Allegro is a cross platform library with C bindings.
Zelex at
I'm going to throw C# into the mix. I haven't tried using a graphics library on *nix, but it should work in Mono. Its a great language to work with when speed is not a serious concern.
Ñuño Martínez at
jeffz said at
I was talking about the Haskell bindings to those libraries, but yes Allegro is a cross platform library with C bindings.
The Allegro wiki says there's a Haskell interface for Allegro, but it isn't released. :-\
Zardalu at
If you want to make money, you code for Windows and forget about portability. Doesn't matter if other platforms are better then. If you want to code for the best platform, then it would probably be a UNIX/Linux flavour...