Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm quite new to game development (not the site) and I'm currently just trying to educate myself about some certain things before I really begin working and a game.

anyway, I'd like to know what basic algorithm/outline of how a game would be coded effeciently with the implementation of user coded scripts for gameplay and levels that are written in python,

Is this even possible? would all the features of python be avalible? like say "multi-threading"?

share|improve this question
    
To be new to gamedev, you want to know the wrong things. Just start off by writing a small game like tetris or pac-man, in order to learn how to work with OpenGL. To understand the basics on how a game is made. Right now, you are asking for a good way to let people write mods for the game. –  Martijn Courteaux Jun 29 '13 at 11:53

1 Answer 1

up vote 2 down vote accepted

I can't tell you explicitly what to do as this is a high level question, but if you are indeed new to game development, then I can give you some advice.

Consider using a component system

I'm biased here as I almost exclusively use the component system in my own project, but it really is a great design pattern. It very easily allows you to create very complex functionality. You'll need to research this yourself if you haven't heard of it before, but here is a link to get you started if not:

http://stackoverflow.com/questions/1901251/component-based-game-engine-design

Decouple your scripting system from your C++ code as much as possible

This is somewhat related to using a component system. You're going to want to break your code into self contained units as much as possible, that will will eventually be referable from your python scripts.

If you implement your scripting system correctly, performance most likely won't be a problem

I'm treading on thin water here, but it needs to be said. If you're just making a simple game, then the performance penalty associated with using python or any other such interpreted language will not be a worry as long as you use it appropriately. What I mean by this is that your collision detection code etc should not be implemented using python. What you want to do is reference C++ code within your python files.

You will end up making extensive use of whatever event system you decide to implement, so don't overengineer it but make sure it is easy to maintain and consider what you actually need it to do. If necessary, get out some paper.

Honestly, don't worry about coding 'efficiently' to begin with. Just don't do anything silly like try to implement part of your rendering system in python, unless, of course, you can take that performance hit.

Above all

Get something working. You can very easily get bogged down in the specifics to begin with. What I would advise is to just get yourself to a scenario where you can confidently call functions from python, have that python script modify some of your internal object states in C++ and then see where you are.

Addressing your last point, multi-threading: optimise as and when you have to, not pre-emptively as you will waste time. If there are things you can do which will improve performance with little or no extra development time required then by all means do it, but generally, you will want to see whether you hit performance targets and then profile your code

share|improve this answer
    
Whoa! thank you! just what i needed –  Spencer Killen Jun 29 '13 at 17:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.