• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Puyover

Design patterns and game development

9 posts in this topic

Hi there,

 

I'm currently returning to game development from my traditional software development, but years ago when I started with C and SDL I didn't care about design patterns at all, so now I found myself surrounded with their chaos and can't simply code without standing with one of them.

 

I don't understand which one fits better into game dev (MVC? Components? ... ), and indeed, I don't know many of them however.

 

So my question is, where to start in design patterns? I'm studying the library SFML with C++ right now, which is a language I had forgotten (And I hated) but industry right now almost force you to know C++, and I was very lazy with Java, so I need that change.

 

Thanks in advance.

0

Share this post


Link to post
Share on other sites

Hi Puyover,

 

In my opinion, componentization has been a very good architecture design decision for games as it provides a lot of reusability as well as elegance. In games, try to prefer components over inheritance. I'll leave this references here:

 

http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

http://www.richardlord.net/blog/what-is-an-entity-framework

http://www.richardlord.net/blog/why-use-an-entity-framework

 

Hope this helps!

Thank you skullfire, nice to know there is a pattern at least which is well established into game development tongue.png

I will give that articles a read.

Edited by Puyover
0

Share this post


Link to post
Share on other sites

If you are building your code by trying to put together a few design patterns you are doing it wrong.

 

You should reason about your application, design it to fit your goals. If some of your design turns out to be a exact or very similar version of an existing design pattern, you name that code after the design pattern to make it easier to recognize this familiar pattern.

 

I have encountered a few people out there (very smart people) that have done some coding and when reading it, I discover a design pattern hidden by custom names. The very idea of design patterns is that they other developers should recognize them and thus having design pattern, but not organizing your code after it misses the very idea.

 

For example, if you are rolling a MVC architecture, split the application into one model, view and controller layer named just that. Don't create a bunch of files named x, y, z and make them behave as a design pattern. Of course this applies to class names/functions etc.

 

So my suggestion is to first think about the design from a bird's eye perspective, figure out what layers you want, often de-coupling / few dependencies is a goal for a well designed application.

Once you have that down, you can start to look if your solution would be or close to be a design pattern and make sure it is clear in your code.

 

For example, you might decide that you want 3 tier system that decouples the rendering, the logic and the data (http://en.wikipedia.org/wiki/Multitier_architecture).

 

For the rendering you decide a data-oriented component based system would fit best, while you roll a chain of command structure to handle the logic in the logic layer.

Also looking into the model you might decide to make it a more standard OO design of those since those are not run in an update loop and cause cache misses.

 

For communication between those layers you might find that the observer pattern is close to the design of the logic->data layer, while producer/consumer is more close to the rendering->logic layer.

 

This is pretty hard to get right from the start, it requires a lot of experience, which you only get by doing it. Good luck :)

2

Share this post


Link to post
Share on other sites

Hi there,
years ago when I started with C and SDL I didn't care about design patterns at all, so now I found myself surrounded with their chaos and can't simply code without standing with one of them.
 ...
So my question is, where to start in design patterns?

Design patterns are simply patterns that are frequently observed in good (or bad) software.

People say "I did this thing lots of times", and name it, and talk about it publicly, and then it gets called a pattern.

You can read books or web pages on design patterns all you want, they will help teach you things you can do, and things that are not recommended.

The thing about the patterns is that they are useful in discussing what is going on.

Patterns are not some magical thing that you must use; they are just designs that people noticed were frequently found in code.

There are various wikis filled up with thousands of design patterns. If you don't have a design pattern that fits your goals, write a design of your own.

Yeah but naming something a pattern also allows a community to refine it to its purest and most robust form. like boost did with smart pointers for example. or iterators, optional, variants, destruction closures and wtf you name it...

 

Entities/components, seriously, this is not a pattern. a pattern is a factory, or a visitor. it is a part of the code. (a very small part)

entity/component however, is the paradigm you choose to code with. so instead of functional, or object oriented, or procedural, you will choose entity/component.

It is much higher over patterns for me, it is a paradigm. It encompasses your whole program, and you code into it, not the other way around.

 

though, same property, naming it will allow community to refine it.

 

I see one big issue, that was covered by some of the 3 links : adoption by peers in the same company. hem; the guy of tony hawks had an ONLY 3 year old code base, and very very understanding coworkers to finally go along with the adoption. Frankly, in my company, the chance of adoption is zero, yeah, the Kelvin absolute cold 0.

2

Share this post


Link to post
Share on other sites

Design patterns are not chaos.  They clean up the chaos.

 

As far as your question, the series on Pattern Oriented Software Architecture (5 volumes), Design Patterns, and Game Engine Architecture are good resources.

0

Share this post


Link to post
Share on other sites

Entities/components, seriously, this is not a pattern. a pattern is a factory, or a visitor.

 

I disagree. Entity-Component-System is a behavioral pattern that can be seen as an extension of the Strategy pattern, which is one of the early design patterns (found in "Design patterns").

0

Share this post


Link to post
Share on other sites

Well. after all, I cannot deny that this is a design. On another hand, I can't deny that this has been seen and documented many times either, so it is a pattern. Therefore, in the end, it is a "design pattern" when you put the two words together.

However, I disagree with the comparison with Strategy, or maybe a reversed strategy then. Because strategy uses modular code. ECS uses modular data. So somewhat its the reverse. And I repeat why I don't like the comparison with any design pattern, because existing patterns until now don't concern the whole code base. ECS is one of a kind.

 

ps: Isn't it off topic ?

0

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  
Followers 0