Open Source game to help me learn code arhitecture

Started by
6 comments, last by Kingston Creations 7 years, 10 months ago

Hello everyone!

I've been playing around with SFML lately and I would like to start working on a simple game(probably space invaders clone) for start. However I would like to know how the proper game arhitecture should look like. For that I would like to take a look at finished game and its source to to see kinda in what direction I should go. The game doesn't have to be anything complicated, simpler is even better, but I would like to have as much as game dev patterns as possible(If that makes sense). Also doesn't really matter the language, I would prefer C++ but I can just translate if it is something else.

Cheers!

Advertisement

I'd advise caution here. Since you don't know what you're doing, you're not likely to be able to tell if a game's architecture is good or not. Almost any non-trivial game that you could find out there is going to have some good architecture and some bad architecture mixed in there, and you're not really going to be able to tell one from the other. That means you could very easily spend a bunch of time learning some terrible practice or some ugly hack that somebody put in that game, assuming it was the "right way" to do things, and be very wrong.

Also, writing any kind of software is this constant balance of tradeoffs. Every step of the way you have to make decisions that usually involves trading pros in one area for cons in another. The areas you will need pros in and the areas some other game needs pros in aren't always the same -- often, in fact. Source code generally lacks the contextual information to identify that such a trade-off has been made, and not knowing that when you read it can negatively color your education.

If you're going to look at other games' code for pedagogical reasons, I'd suggest that you do so after you have written your version of whatever it is you're trying to write. That is, set up your own main loop first and then look at other implementations. Set up your own sprite rendering first, then look at other implementations.

First, this helps you stretch your critical thinking and problem solving skills. It helps you learn how to approach tasks you've never tackled before. Second, this gives you some context about the problem space you can use to make more educated guesses about why other people's code is written the way it was. You may run into a problem in your implementation, solve it, and then see in other code how they solved that problem a different way (where before you might just see some code you didn't understand because you weren't aware of the problem it was addressing) or ignored the problem altogether because it wasn't relevant to the project, or because it was addressed elsewhere in a way it could never be a problem for the code in question.

Stay way from "patterns." Patterns are about vocabulary and having a common parlance. They're not about super-boilerplate solutions you try to shove at every problem you encounter.

Cheers for the answer! So would you think it would be wise to just ignore that for now and roll with my own intitution, and then after I am done just let someone do the quick code review?

Yes. You can certainly post in this forum if you want people to review any aspect of your code.

Thank you for your answers mate!

Cheers for the answer! So would you think it would be wise to just ignore that for now and roll with my own intitution, and then after I am done just let someone do the quick code review?

What you can do is either just go ahead and write the game/engine and then look for advice, or come up with whatever ideas you think are reasonable and then post them here to get feedback before you start implementing it. This way you can get a better understanding of what the pros/cons of that approach are, plus you might be some additional insight into how you might do it better, before you commit to it and then find out it was tragically flawed.

And I agree that looking at source code is not that useful. What you need is some basic understanding of how things work and then you can use that to judge different approaches. You gain this by practice and experience, but some advice before you start can lead you to gain experience that's more valuable rather than possibly just getting frustrated.

Cheers for the answer! So would you think it would be wise to just ignore that for now and roll with my own intitution, and then after I am done just let someone do the quick code review?

What you can do is either just go ahead and write the game/engine and then look for advice, or come up with whatever ideas you think are reasonable and then post them here to get feedback before you start implementing it. This way you can get a better understanding of what the pros/cons of that approach are, plus you might be some additional insight into how you might do it better, before you commit to it and then find out it was tragically flawed.

And I agree that looking at source code is not that useful. What you need is some basic understanding of how things work and then you can use that to judge different approaches. You gain this by practice and experience, but some advice before you start can lead you to gain experience that's more valuable rather than possibly just getting frustrated.

I started working on a simple pong game and so far it is actually easier than I thought. I will definitely post the source code once I am done to see what people think on what should be changed/improved and change that before moving on the next game and then actually hopefully use that advices straight away in next project.

I would love to see that. Maybe I should start out basic sort of like that. It seems like I am trying to get to much done to fast. The world now days has our minds set on the triple a games and not looking at what we are doing. Think in a mindset like it was the 1980s and you will see how cool your game is. Even if someone beat you to it. It is still an accomplishment that you got it done. You made it. Yourself maybe with a bit of help but still you learned next time you can go bigger. Until you can make your own game.

WOW I can't believe I just typed and inspirational speech when I needed it myself.

This topic is closed to new replies.

Advertisement