View previous topic :: View next topic |
Author |
Message |
Feared

Joined: 11 Jun 2010 Posts: 17
|
Posted: Sun Jul 25, 2010 9:10 pm Post subject: Quake(one) to C++ |
|
|
Quote: | Okay, this is a unstable port of Quake (one) to C++, the code is based on FitzQuake and is just a quick port to the C++ compiler. At the moment it's nothing special but I am releasing this so I can hopefully get some feedback about the project.
This project is aimed for developers who want to work solely with C++, easier/cleaner code, and just a overall more updated Quake. Here is a list of what is changed and a list of thing's to possibly change in the future.
Changes:
Ported to C++ compiler (NOT MANAGED C++)
Future Changes:
Object Oriented code
Optimize/Speed
Updated OpenGL renderer
Known bugs:
Video menu not working
No confirmation on quitting the game
Weapon models seem to not render properly
Feel free to comment, submit bugs, or criticize. |
Quote: | Edit:
I forgot to mention, the port is also using Visual Studio 2010 project files |
http://bfeared.com/archives/22 |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Sun Jul 25, 2010 9:23 pm Post subject: |
|
|
if I were to port my engine to C++, the first thing I'd do with it is to change cvars to self-register at start!
Good luck with all the tweeking. _________________ What's a signature? |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Sun Jul 25, 2010 9:32 pm Post subject: |
|
|
Spike wrote: | if I were to port my engine to C++, the first thing I'd do with it is to change cvars to self-register at start!
Good luck with all the tweeking. |
First thing I did.
Second was commands.
Best of luck from here too. I'm not a major C++ fan - far too many people use it to write elaborate class hierarchies than to write useful programs - but it does have some advantages that are worthwhile exploiting. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
Feared

Joined: 11 Jun 2010 Posts: 17
|
|
Back to top |
|
 |
dreadlorde

Joined: 24 Nov 2009 Posts: 86
|
Posted: Tue Aug 10, 2010 8:05 pm Post subject: |
|
|
Eww. _________________
Ken Thompson wrote: | One of my most productive days was throwing away 1000 lines of code. |
Get off my lawn! |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
|
Back to top |
|
 |
dreadlorde

Joined: 24 Nov 2009 Posts: 86
|
Posted: Tue Aug 10, 2010 8:42 pm Post subject: |
|
|
mh wrote: |
Please elaborate. | Coders at work article, Some nice quotes by some of the best C hackers (not really proof of anything, but a fun read), and here is a quote by rob pike that isn't about C++, but applies to it. Rob Pike wrote: | object-oriented design is the roman numerals of computing. |
_________________
Ken Thompson wrote: | One of my most productive days was throwing away 1000 lines of code. |
Get off my lawn! |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Aug 10, 2010 9:06 pm Post subject: |
|
|
dreadlorde wrote: | mh wrote: |
Please elaborate. | Coders at work article, Some nice quotes by some of the best C hackers (not really proof of anything, but a fun read), and here is a quote by rob pike that isn't about C++, but applies to it. Rob Pike wrote: | object-oriented design is the roman numerals of computing. |
|
I wouldn't disagree. I've had my own experiences with D3D (specifically the D3DX library) where the designers wrote classes for things that would have been better (and more clearly) represented as procedural code. I've also written on my blog about what I call the "OOP zombies", and have had Real-Life encounters with programmers who can regurgitate OOP jargon so well that they could compete in it if it was an Olympic sport, but would crap themselves in horror if ever faced with some real code.
See also my previous comment about "far too many people use it to write elaborate class hierarchies than to write useful programs".
However, there are plenty of valid technical reasons for using C++ (even with some mild OOP) that don't involve going down the full OOP route. Self-registering cvars is one that both Spike and myself have already mentioned, and I actually believe that the stronger typing, lack of default-int, requirement to declare function prototypes (and requirement for them to actually match the real function) are all factors in it's favour and which lead to better and more robust code. Encapsulating (there I go!) functionality like sound and video inside classes is also a great way to make your subsystems more self-managing, as well as avoiding the "globals, globals everywhere" trap that Quake so often falls into.
Overall I think the "C goooooood, C++ baaaaaad" (or "procedural goooooood, OO baaaaaad" if you want to be more general) attitude is not a healthy one. Each camp has useful things to learn from the other, and shutting yourself entirely off from one will only limit the richness of your own experience.
Given the choice I would actually pick C++ over C any day. You can write C-like procedural code in C++ too, you don't have to use classes.
At the end of the day a programming language or design methodology is just a tool. OOP zombies who can't even write "Hello world" without designing a class hierarchy would do well to remember that, but so would the anti-OOP camp.
Anyway, I'm tootling off to read that link, it looks like good fun (I love me a good argument against those OOP zombies). _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Tue Aug 10, 2010 10:26 pm Post subject: |
|
|
dreadlorde, relaying quotes does not advance an argument! You even seem to favour the worst, the sassy, superficial jingoistic quotes that don't really convey any actual idea or criticism. They aren't even taken out of context: they were written without context in the first place! (Except for the time they were written, which for the majority of these quotes is decades ago...)
That said... I agree with your sentiment, of course. I don't think a game engine is the best application of OOP. I myself stick with C for that. For game code (entity implementations), or especially GUI coding, OOP is a plausible choice, but C++ is insufficient. Actually, especially when it comes to game code, OOP with its monolithic inheritance scheme (or convoluted multiple inheritance scheme) is archaic and limiting. I'm trying to figure out what would work better on that front...
To this day I haven't found a good use for C++. The real article you linked to is right when it talks about the necessity of "subsetting" C++'s features. Some of C++'s features which aren't related to OOP could be useful (e.g. a limited subset of templates).
I'm not saying C (C89) is the best language to use. It certainly is archaic. (For the record, I avoid even checking out C99 for poorly-thought-out reasons.) But I supposed I'm arguing for paradigms here, not individual languages. For the engine code, you want a low-level language with little or no data hiding, that compiles to efficient code. And for the gamecode, you want a high-level language that is simple and easy to understand, and isn't multi-paradigm, doesn't have features you don't need. For both, you (well, I) want a static-typed language with as many errors caught at compile-time as possible, ruling out the huge wave of dynamic languages in the last decade...
And C++ doesn't even come to mind when thinking about paradigms. It somehow exists outside of paradigms (splayed awkwardly and diagonally across the table of paradigms). In games programming, I don't think it has any place at all, it should drop off the face of the earth (though I can't speak for other types of applications), leaving something like C on the one hand and some sophisticated high-level language on the other.
mh wrote: | I actually believe that the stronger typing, lack of default-int, requirement to declare function prototypes (and requirement for them to actually match the real function) are all factors in it's favour and which lead to better and more robust code. |
These in particular are not so much strengths of C++ as they are deficiencies of C (because of backwards compatibility)... But when it comes to this I do like to periodically compile my C code as C++ code to see if any of these sort of errors will be caught.
But a real forward-looking language dispenses with function prototypes altogether. Header files in C++, whose only benefit is that they can be used as reference or documentation, are something of an atrocity, since all the private things (which in C would be static and only in the source file) must be in the header file, and because things have to be defined twice. A modern language would sever this ugly requirement, and if you wanted the "documentation", you would use a fancy IDE or, for the more primitive, a tool like Doxygen. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Last edited by Sajt on Tue Aug 10, 2010 10:36 pm; edited 1 time in total |
|
Back to top |
|
 |
dreadlorde

Joined: 24 Nov 2009 Posts: 86
|
Posted: Tue Aug 10, 2010 10:33 pm Post subject: |
|
|
Sajt wrote: | dreadlorde, relaying quotes does not advance an argument! You even seem to favour the worst, the sassy, superficial jingoistic quotes that don't really convey any actual idea or criticism. They aren't even taken out of context: they were written without context in the first place! (Except for the time they were written, which for the majority of these quotes is decades ago...)
| I did say they weren't really proof of anything, I merely linked to them for comedic value. _________________
Ken Thompson wrote: | One of my most productive days was throwing away 1000 lines of code. |
Get off my lawn! |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Tue Aug 10, 2010 10:36 pm Post subject: |
|
|
Okay. But I also took into account your signature. Aaand I confused you with someone else too, until I had halfway written my post... _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Aug 10, 2010 10:50 pm Post subject: |
|
|
Sajt wrote: | I confused you with someone else too |
...and actually so did I...!
Sajt wrote: | mh wrote: | I actually believe that the stronger typing, lack of default-int, requirement to declare function prototypes (and requirement for them to actually match the real function) are all factors in it's favour and which lead to better and more robust code. |
These in particular are not so much strengths of C++ as they are deficiencies of C (because of backwards compatibility)... But when it comes to this I do like to periodically compile my C code as C++ code to see if any of these sort of errors will be caught. |
Yes, you're correct and I should have noted that.
One thing I do like here is the combination of stronger typing with the ability to arbitraliy cast. Not necessarily C++ specific either, but C++ does have it all the same, and the lack of it is a major source of annoyance whenever I have to work with a strongly-typed language that lacks this ability.
But given a strict choice between C or C++, I do think there is enough reason to use C++ as the language-of-choice all the time, even when writing purely procedural code. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
dreadlorde

Joined: 24 Nov 2009 Posts: 86
|
Posted: Tue Aug 10, 2010 11:45 pm Post subject: |
|
|
Who was I being confused with? _________________
Ken Thompson wrote: | One of my most productive days was throwing away 1000 lines of code. |
Get off my lawn! |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Wed Aug 11, 2010 12:47 am Post subject: |
|
|
I always think it is cool when there is +1 engine coders.
Don't really have anything useful to say regarding the engine, I was gonna try it but I see no .exe to try. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Wed Aug 11, 2010 1:15 am Post subject: |
|
|
Sajt wrote: | I don't think a game engine is the best application of OOP. |
Huh... What about the Source engine ?  _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|