Sign in to follow this  
EduardoMoura

Programming a Game...

Recommended Posts

Well, I am not even sure if this is the place to post this, but still here it goes.

 

Right now I am messing around with a simple game concept, a 2D platformer. But one of those never ending games, think Robot Unicorn. WIth a few twists on it (more on that later).

 

For the first time, I am trying the approach build the game not a engine, but I find myself troubled. When I writting code (that does what it is supposed to do), I always find myself trying to code the a generic approach so that I could use to other games, this mostly applys to refactoring the working code, separating class creating managers for everything.

 

 

Is this the way its supposed to be? What your experiences with this, do you find yourself always trying to make the "perfect" code, or do you hack and slash to just get something to work.

 

Any pointers on which kind of methodology I should ensure in my coding habits?

 

Just a little background, I have created games before, and a lot of decent engines for me and other folks, so I like to think of myself of decently knowledgeable on this subject (Just as a hobby of course, got much to learn). So I am not asking how to start, but more on how should I proceed to improve.

Share this post


Link to post
Share on other sites

Wow !!  That is a tough question I believe most of us ask ourselves everyday.  I usually rely on 2 things.

1 - What I have done in the past that is reliable, I use to move forward and build on that. If I am working on a new game where I can utilize what I have done in the past and make some improvements on that, I do it.

2 - I tend to build on the game and let the game engine develop itself, unless I already have and established an good engine that could, with a little fixing here and there.

 If all is working well, I make a backup copy and store it where anything I do what effect that code. Then I review over my new code to see if there is any streamlining that can be done, Make my modifications and then run that code over again to see if the changes were effective.

Share this post


Link to post
Share on other sites

Yeah, but the godly advice we get when we ask "Where should I start with my Engine is" . Build Games not engines. 

The problem is , I am building a game, but I always have a build a Engine mentality, and always try to write the most performance/slick/General code. So I am not sure where I going wrong, but I tend to take alot of time to develop a game infrastructure, or the engine part of it. Some times I take too long and get bored and stop. Most of the times I go back and see my code and think, I could do this better and then redesign most of the code. Then its Rinse and repeat!

Share this post


Link to post
Share on other sites

Eric over at ElderGame once said that [your supposed to code perfectly the first 90%, so that when you realize you've made a terrible mistake you can screw up the last 10%, and it'll still work properly.]  Or something like that.

I'd say do whatever is comfortable for you.  If you want to waste a little time being generic, it might help you out later on.  Either in this project or another.  I don't think it matters, either way, because mostly the take away will be experience which you can always reuse.

If you picture yourself doing something similar in the future, especially a sequel, plan to reuse the code.  If you need to release ASAP, do it any way that it will work.

I'm not really a programmer though, so don't listen to me.  I'm studying so I got tons of theory but hardly any experience at all.

Share this post


Link to post
Share on other sites

It's hard to come up with the perfect design from the start when you are making up your game as you go. I would plan in time for refactoring your old code to accomodate for new ideas that you have included.

 

Do you use version control? Git for example is very useful because it is really easy to create branches to test out new ideas/prototypes and after refactoring, merging them into your master branch.

Share this post


Link to post
Share on other sites

For small project I usually don't use Version control. But I think that might be something considering. Create a main repository for my "engine code" and branchs for games, thats something that just came to my mind, maybe worth to try.

Share this post


Link to post
Share on other sites

How thorough is your design? I would code generically enough so that it fits the scope of just this specify game itself. Once your game is complete, you can integrate parts you like into what you currently have in your engine. I wouldn't add any features to an engine until that code's been used effectively in a game first. This way, you're not adding any guesswork for constant end-all solutions.

 

Even saying that, I get hang-ups about it, but those are signs of perfectionism and procrastination. Those are  common symptoms preluding the death of any project I've ever worked on and didn't finish.

 

 

Good luck!

Share this post


Link to post
Share on other sites
How thorough is your design? I would code generically enough so that it fits the scope of just this specify game itself. Once your game is complete, you can integrate parts you like into what you currently have in your engine. I wouldn't add any features to an engine until that code's been used effectively in a game first. This way, you're not adding any guesswork for constant end-all solutions.

 

This is a amazing sugestion, I think I am going to setup a environment like this for all my projects, I was looking at my design and I think my major problem is not having a strict feature set for the game, I put them on as I come along. This is wrong, completly wrong. and I think its holding me back.

Share this post


Link to post
Share on other sites
I'll be honest I still hack away and make something work first, then go back and improve the flow, break it up into functions, look for areas where I can cut out repetitions. It's much more fun to have something working and playable that's badly coded then the most amazing looking code that does nothing.

Share this post


Link to post
Share on other sites
I'll be honest I still hack away and make something work first, then go back and improve the flow, break it up into functions, look for areas where I can cut out repetitions. It's much more fun to have something working and playable that's badly coded then the most amazing looking code that does nothing.

I think it depends.

 

Do you want to learn? Try little hacks at the begining and when it's working, go back and make little improvements if you want.

Do you want to make a video game? Code like hell!

Share this post


Link to post
Share on other sites

I think motivation is the main concern when coding a video game, so I think I agree with your opinions of saying, hack first and then reformat later. This way we get something to look at, and at later stage we can fix, clean, and improve our old code.

 

 

Still I feel trouble by my "engine" mentality and my quest for the perfect piece of code, Its a never ending quest for me I guess. Heheheh

Share this post


Link to post
Share on other sites

Maybe hack out a bunch of concepts one by one, and then look at the best way to mix them??

Or hell man, just make everything reusable if thats how you roll.

The only benefit to not doing that is maybe readability?  I don't know.

Worry less.  Code more.  <3

Share this post


Link to post
Share on other sites

Yeah, I going with the just make it work, in the end reuse everything clean code etc. This way I do get things done and dont get bored with the game.

 

I guess I am going to change my work methodology just to make things faster. And then worry with doing then better :D

Share this post


Link to post
Share on other sites

I have a few code that can be used, I will write a article on it once I get it on a more decent state.

right now I am going to write a Indepth  article on SAT 2D discrete and swept methods, you might see it popping around sometime soon :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this