Jump to content
  • Advertisement
Sign in to follow this  
EmperorXYZ

Unity Any open source game that is a paragon of good programming?

This topic is 2687 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have searched the forum first and the impression I got was that most code is badly written, especially the Quake Engine. I'm just wondering, is there a consensus amount this community that would point out a particular game which would be a prime example of good software engineering? Preferably a fairly large project demonstrating several concepts such as path-finding, collision detection, asset management, game engine design, AI, etc...

Now, if there isn't, please tell me so that I can stop searching and concentrate on other ways of learning. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Learn through practice, don't get caught up in how people coded other games. You can take theories from how the overcame obstacles, but before you know what those obstacles are, you just looking in the dark.

Source code, is really only bad when it doesn't do what it was coded to accomplish. Also every game is unique, sure some might use the same engine, but internally they are all different. They all have code that specifically does what they were trying to achieve with the games features.

Basically you should just make games, or other apps. Overtime you'll learn better practices, from learning from your mistakes.

Share this post


Link to post
Share on other sites
I know I should learn from my own mistakes and I am doing that. I've been writing a 2D engine. I'm at a stage where I have implemented a number of gameplay features. For example, I have written the code for collision detection in a 2D map for an action RPG like character and it is working very well. I would like to see how other people implemented that function though to gain some new perspectives. I'm also ready to just write my own path-finding code, but after I do so, I would like to see if other people have implemented it in a more efficient manner.

Share this post


Link to post
Share on other sites

I know I should learn from my own mistakes and I am doing that. I've been writing a 2D engine. I'm at a stage where I have implemented a number of gameplay features. For example, I have written the code for collision detection in a 2D map for an action RPG like character and it is working very well. I would like to see how other people implemented that function though to gain some new perspectives. I'm also ready to just write my own path-finding code, but after I do so, I would like to see if other people have implemented it in a more efficient manner.


More than likely, yes they will have done it different than you. The problem I'm seeing with your post is you don't have a purpose for what you're doing. Do you have a game you're building this engine for? If you don't you'll never know how to efficiently write those portion of the engine.

Share this post


Link to post
Share on other sites
Then you should look for an article on writing path finding code. Any game source you look at might have an implementation thats full of bugs, or game-data dependent optimizations that would make no sense in any other program.

Share this post


Link to post
Share on other sites
would be a prime example of good software engineering?[/quote]
Yep:
Quake Engine.[/quote]

1) It was completed. Very important, 99% of software projects do not meet this goal.
2) It succeeded in market. Very important, most products perform poorly or mediocre.
3) It became a landmark achievement. People say: "quake engine", not ".... engine". So it's notable
4) It has been ported to everything digital, from calculators to distributed crays - ported, not rewritten


Unfortunately, books like to teach "software engineering" by showing fluffy little bunnies and ponies playing together. Quake is perfect example of "engineering". The code is merely a side product of that.

Share this post


Link to post
Share on other sites

Source code, is really only bad when it doesn't do what it was coded to accomplish.


As a professional software engineer, I disagree with this statement. I've been a part of many companies where the code "did what it was supposed to", but the design was so shitty and undocumented that the code was incredibly difficult to understand and maintain. Or sometimes the code was just so sloppy and inefficient that it just added to the code bloat of an already sketchy system. When I write code, I think of the long term needs of the code, not just hack out a short-term solution. If you keep designing your code with a short-term mindset, all those little messes and hacks balloon into a huge mess that someone (usually me) gets hired to come in and fix someone else's laziness/incompetence.

{end rant}


Back on topic, EmperorXYZ I'd actually recommend you take a look at the source code for my game, Hero of Allacrost. It has its own 2D C++ engine, GUI system, editor, and of course the game itself. I'm really a perfectionist when it comes to software design (both a blessing and a curse) so this code has undergone many "makeovers" to improve its design and enhance its flexibility over the years. We also have our code fairly well documented (both with comments and developer documentation on our wiki), much more than any other open source project that I'm aware of. We've got collision detection, path finding, and all those other things you mentioned.


When I started this project many years ago, like you I tried to look to an open source game to gain insight and serve as a base for my own code. And I was extremely disappointed to find the code to be a mess of spaghetti with almost no comments. One of my personal goals for my project was to write code that can be a helpful guide to others that follow, so that one day when someone looks at my code they don't have the same "gross" feeling I did when I looked at another project's code.


Subversion Repository (Click the "Code" tab)

Wiki Code Documentation

Share this post


Link to post
Share on other sites

Or sometimes the code was just so sloppy and inefficient that it just added to the code bloat of an already sketchy system.


unless the goal was to design an inefficient and slow system (which sounds like it was probably buggy aswell)... It doesn't sound like that code accomplished it's goal... right?

Share this post


Link to post
Share on other sites

[quote name='freeworld' timestamp='1304884484' post='4808222']
Source code, is really only bad when it doesn't do what it was coded to accomplish.


As a professional software engineer, I disagree with this statement. I've been a part of many companies where the code "did what it was supposed to", but the design was so shitty and undocumented that the code was incredibly difficult to understand and maintain. Or sometimes the code was just so sloppy and inefficient that it just added to the code bloat of an already sketchy system. When I write code, I think of the long term needs of the code, not just hack out a short-term solution. If you keep designing your code with a short-term mindset, all those little messes and hacks balloon into a huge mess that someone (usually me) gets hired to come in and fix someone else's laziness/incompetence.

{end rant}[/quote]

I think that statement was directly related to game development. Usually, games are meant to be the finished product in the last build (even when they might still have some bug around). They are not intended to need constant, intensive bug-fix production and mantainment over time. They provide a limited amount of functionality that will remain like that, in most cases, forever.

If you achieve to write a piece of game like Quake just as Mr. Carmack wrote it, with limited budget, in time, and make tens (hundreds?) of millions of dollars out of it you can easily manage to fund the sequel from scratch.

The point of writing a final commercial software product, in the end, isn't about how elegant your coding style is or how easy it makes life for code-monkeys to maintain it, but about where in your body you place it once it is done. :)

Share this post


Link to post
Share on other sites
Good point owl. Yeah the "long term" view of game software is a lot different than software in embedded systems, device drivers, etc., which is where I have had most of my experience. Although I would hope that for a game engine at least, this long term idealistic view I'm preaching is a more valid point, since ideally you want to be able to re-use this software throughout several projects and be able to continue improving it and adding new features.


I'm rather cynical about the state of "professional" software products, given that I've actually seen the code that goes into these things. They are so unstable and inefficient. I can't think of any other industry where you could get away with selling a product that is this shitty on the inside. :angry:

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!