• 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.

Archived

This topic is now archived and is closed to further replies.

Spyder

OO Design Continuation

4 posts in this topic

quote:
int Character::GetTotalModifiersTo(String stat) const {
// Loop through all effects. If the stat matches this one, apply the
// difference to the running total. Return the final amount
int total_modifier = 0;
EffectList::const_iterator eli;
for (eli = effects.begin(); eli != effects.end(); ++eli)
total_modifier += (*eli)->GetModifiersTo(stat);
return total_modifier; }

Kylotan posted this in the earlier thread that kinda went off topic. The code above works great for attributes, but what is a good way to implement skills that operate on the attributes? Should every skill be each own class? Diff player and NPC types may share some skills etc. Any ideas?
0

Share this post


Link to post
Share on other sites
Stealing my code? I hope I get mentioned in the credits

To give an answer to your question, I''d need to know more about what you mean by "operate on". How about an example or two? In my system, skills tend to have little or no effect on attributes, so the 2 sub-systems are distinct and have little to no relationship with each other.

My skills are divided into several subclasses (Spell, Ability, Action, Language, etc) which are derived from a Skill interface. Each individual skill is an instance of one of the above, which are held in a master Skill Table. And each character who is capable of learning skills will have a structure that pairs up a reference to a skill to the degree that it is learned by that character.
0

Share this post


Link to post
Share on other sites
Well I''m not interested in stealing any code. What does interest me is the OO design and your example on character modifiers was a good example.

Your skills example also made sense. Skills in my game will prob use stats to modify the outcome. Does anyone else have any other design thoughts on skills as classes.
0

Share this post


Link to post
Share on other sites
I was just joking about the code theft.

What do you mean by ''the outcome'' of skills? Are skills things that affect a character permanently, or do they just have transient effects... do they affect existing attributes, or are there special attributes that just relate to skills? As far as I can tell, there''s no reason why a simple adaptation of the code of mine that you posted wouldn''t work for what you describe... each Skill type would store a list of the Attributes that it modifies, and each Character could contain a list of the Skills that the character knows. Then, when querying a Character for any Attribute, you can loop through the Character''s list of Skills, which is likely to be stored as pointers or IDNumbers to some central Skill table, and from that, find out any modifiers to the given attribute.

Of course, this is not necessarily the most efficient way of doing it. Why loop through everything each time? Instead, whenever you learn a skill, you could directly increment the attribute, so long as you have a well-defined system for decrementing the attributes if and when a skill ''goes away''. Or, as an intermediate solution, still have the looping as originally described, except (a) have an attribute cache, (b) whenever the character is queried for attributes, loop through every skill and populate the attribute cache. Next time you query the character, you can get the value from the cache instead of looping through everything again. And (c) Have a boolean variable which stores whether the cache is valid or not. Whenever a character''s skills change, the validity variable should become false, meaning that the next query will have to check the individual skills again, upon which it will revalidate the cache and set the validity variable to true. (Some kind of Proxy or Facade pattern at work here, depending on how you do it.)

Oh, and by the way... I decided to implement ''Action'' skills (that is, skills that you explicitly invoke, such as a kind of attack) as a single class, rather than subclassing Action for each type of Action. I figured that using function pointers rather than inheritance would not only reduce the number of classes I was using (and thus my system''s complexity), but also allow for greater flexibility (mainly, changing functions and skill details at run-time).
0

Share this post


Link to post
Share on other sites
quote:
My skills are divided into several subclasses (Spell, Ability, Action, Language, etc) which are derived from a Skill interface. Each
individual skill is an instance of one of the above, which are held in a master Skill Table. And each character who is capable of
learning skills will have a structure that pairs up a reference to a skill to the degree that it is learned by that character.


Examples of skills in my game would be: kick, trip, sneak, lockpick, backstab, read, write, gamble

Some skills would operate on attributes like Concentration would increase the attribute awareness, but like you say it''s easily done.

My major concerns are that every skill has somewhat unique functionality and I end up with billions of classes. Storing them all in a table sounds reasonable.
0

Share this post


Link to post
Share on other sites