Game Development Community

Procedural+Functional or OOP? Efficiency?

by Sean Brady · in General Discussion · 10/05/2011 (10:24 am) · 4 replies

I am making a small game. In terms of programming paradigms and styles (which this question is addressing), I found that using a combination of both procedural and functional workflow produced the game much better for myself than using oop while also keeping the possibilty of easy modification/expansion when needed. If someone else criticising the workflow deemed my method to be wrong or inappropriate would they be right or would their view be based on their own personal preference/bias?

NOTE: I understand the reasoning and implementation of the relative paradigms and styles mentioned.

You just can't help hearing so many differing opinions.

Considering it's a small complete game for portfolio, I feel the methods are justified as it represents how I program. I am working mainly using as simple logic/minimum code as possible. Not adding complexity that is not needed. There is repetition of code but... honestly I am confused on this issue also. It gets the game made quicker. Just looking for someone else's opinion. Preferably someone with more experience. Thank you in advance.

#1
10/06/2011 (2:27 am)
It all depends on your goals. If all you want to do is to display your game design skills on your portfolio then go with the methods you are more familiar with.

If you want to show your programming skills then I would suggest to show your OOP skills even if that takes you longer to accomplish the same functionality in your game. But hey, if you could also build a small game displaying your procedural or functional programming style with ease, why don't you do that also.

Don't be afraid that somebody else will critice you regarding a choosen programming style. If you have a solid explanation why you choose the method and why you find it appropriate it will never be a real problem.
#2
10/06/2011 (7:16 am)
Thank you for reply much appreciated... ;)
#3
10/11/2011 (11:15 am)
The majority of programming for the game industry is Object Orientated right now when you're building engines that contain hundreds of thousands of lines of code then the simplicity of being able to black box chunks of code as objects is a life saver.

Just to throw another thought in though and that's around DOP (Data Orientated Programming) and how it could really benefit the game industry. Have a read of gamesfromwithin.com/data-oriented-design for more info
#4
10/11/2011 (2:29 pm)
Mind blowing article... thanks. It broadens the mind alright.

Regarding oop in games industry point, absolutely. Just didn't click in the head tmeporarily ;)

One response from the article sums up the confusion (for myself) pretty solid;

"The bottom line is: if you’re programming with costrained resources (as in game programming, where the CPU is never enough, or in embedded devices, like on mobile phones) OOP becomes a luxury, and you have to shift back (or in your case, rediscover) Structured Programming.
If you have a server based application, it is cheaper to throw hardware at the problem to manage the complexity of the system with OOP and abstraction layering, than drown in the sea of data. It’s a matter of the right tool for the right job.

OOP has its place. This style of programming has its place. Other styles of programming (Functional, Logical, and other esoteric things) have their places. End of the story."

Every style has a certain job/place which is in support of the info you provided. All depends on what is being created more so than preference. Cheers. :)