• 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
Norman Barrows

C-E SYSs, L2 OPTs, and the big picture

2 posts in this topic

i've been thinking and researching about "game engines" recently. i know! bad me! i should be building games, not engines! <g>. but i have a number of titles in the works and am looking to streamline the development cycle.


i currently have a low level in-house "game parts" library that provides graphics, audio, timers, dice, etc.


i have a second library that implements an "entities list", movement, collision, and  AI which i'm redesigning for use in future titles.


i've been thinking of redesigning as a component entity system such as:


array of locations, array of rotations, array of world transform matrices, etc.


and a main loop like:







there would be lists of different entity types, such as players, enemies, missiles, dropped objects, etc.   terrain and static objects (buildings, etc) would be handled separately. objects used for scripting such as triggers would also be handled separately.


i suppose an entity would just be a list of indexes into the appropriate arrays.


nice and L2 friendly - so far so good.


but in the big picture, graphics will still be the bottleneck. 


i mean, the game with the most entities in the way of just players, enemies, missiles, etc. these days is probably the Total War series, with about 2000 combatants active at once.


which makes me think: 


for a _PC_ (consoles may be different), FLEXIBILITY ASIDE, the performance gain alone for a c-e system may not be worth the hassle, compared to say, an array of entity structs where each struct holds all components, and one array for each entity type.


i can understand its appeal when dealing with c++/oo syntax issues, but given that a typical game will have at most 2000 or so dynamic entities, with one or two basic types in all cases ("target" - a player or enemy, and "missile" for games with non-instant missile weapons), the performance gains don't seem worth it, especially compared to the performance overhead of drawing 2000 entities! <g>.


note that my current "entities library" uses arrays of entity structs with all components in a struct, has two lists of entities: static and dynamic, and is implemented with C code, so no c++ syntax issues. also, i don't really care about the flexibility of C-E systems (being able to add/ remove components from entities on the fly, letting non-coders define entities via tools, etc).  so i'm really only interested in c-e for the performance gain of L2 friendly data layout.


and from that standpoint, the c-e optimization seems like overkill. optimizing the iteration and processing of targets, when drawing targets is the bottleneck. time better spent on shaders i would think.


of course, once you've optimized all your drawing, and your "total war killer" that does 10,000 guys at once still runs too slow, then it might make sense as a desperate attempt to get a few more clock cycles and maybe therefore a couple more fps.


but until you reach that point, it doesn't seem to make sense to use it, EXCEPT as a way to deal with c++ syntax issues and to allow non-coders to edit entities.





thoughts? comments?















Share this post

Link to post
Share on other sites

the performance gain alone for a c-e system may not be worth the hassle

I've never heard of performance as the reason to go for a component/entity architecture. The two are really not overlapping concerns.


The general reason to move to a component/entity architecture is because you want to move to a data-driven model. A data-driven model can significantly speed up your development cycle, by allowing non-programmers to edit the game, and reducing the amount of time spent compiling...


Share this post

Link to post
Share on other sites

The general reason to move to a component/entity architecture is because you want to move to a data-driven model. A data-driven model can significantly speed up your development cycle, by allowing non-programmers to edit the game, and reducing the amount of time spent compiling...




my understanding was that the benefits were three-fold, depending on implementation:


1.for OO implementations:  

its a way to deal with the difficulties of oo/c++ syntax and game architecture  IE class hierarchy issues and such. this tended to be the primary emphasis.


2. if entity types are soft coded:

its a way to allow non-programmers to create entity types without coding (IE soft coding of data, or "data driven" software, not to be confused with data oriented / driven design). but this is more a soft coding than entity-component advantage.


3. if components are stored as arrays of data structures, and processed all at once with no branching:

you get a "data oriented" or "data driven" design (not to be confused with soft coded or data driven software), resulting in a cache friendly data layout that can run significantly faster (on the order of 400+ clock cycles per component faster).  this was only mentioned in some places. in many places they implemented components in a manner that was as or more cache unfriendly than traditional objects.



i'm dealing with c code, so no c++ syntax issues.


soft coding of entity types is really only required for a generic engine or a non-coder. for a single title and a single developer, the entity types will be determined early on, will change little, and can easily be changed if needed with a recompile. really its only needed for a generic engine like unity. in a title specific engine, again the entity types will be determined and declared early on and will change little over the course of development.


otoh, i'm constantly adding more variables to a player or enemy struct.  but that doesn't necessitate a c-e system.   for a c-e system, you have to declare and implement the the component types in code in the "game engine". then you can create entity types from the component types, either by hard coding or soft coding. soft coding smacks of generic engine (unity, unreal, etc). hard coding entity types would be about code organization (c++ syntax woes). i think only one source used cache optimization as the reason to do it. but the argument was MOST persuasive if you use traditional c++/oo architecture (which, thank god, i do not). 


well i definitely don't need to implement a c-e system just so i can soft code entity types. i have exclusive source code access in my case. sometimes it nice to be an army of one.   ; )


and so far, arrays of structs have been plenty fast.    so it looks like i don't really need a c-e system.


so just how many things like c-e systems in game development are really about letting non-programmers edit the game?


it strikes me that a lot of effort goes into things like that (which technically only non-programmers need), and stuff like checking for errors that won't occur once the game is completed and correct, and making the game reusable and easy to modify, when you don't have plans for a sequel. in general, over-engineering things. i'm not saying c-e is over engineering, but it may be for an indie.


i've been debating how to split up the list of game objects/entities, etc:  

static and dynamic entity lists,

component entity systems,

separate list for missiles,

separate list for emitters, 

one big list for everything,

and so on.


given that c-e is more about configurability and code organization than speed (although it can be a speedup if implemented correctly), and given that arrays of entity structs are running plenty fast for me right now, i may go with one big list for everything. it would definitely simplify the design.


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