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

Class Design for a Turn-Based Strategy Game

1 post in this topic

Hey All,

I've been working on my first semi-large scale game and find myself constantly questioning (and changing) my approach to the overall class design. So much so, that I think I feel like I'm actually getting dumber, for lack of a better way of putting it. [img]http://public.gamedev.net//public/style_emoticons/default/blink.png[/img]

I would really appreciate some feedback on the various approaches I've taken thus far.

The game is to be a "re-roll" (in C#, using XNA) of one of those old box-type strategy games that Victory Games (or Avalon Hill, etc) published back in the 80's - Ambush!, to be specific. I thought this would be a good approach, as having the rules already written would take a load off of the overall burden associated with starting my first weighty project. Also, this particular game was designed as a solitaire board game, thus eliminating the need to develop any AI code. So I felt pretty good about it, and I've spent a decent amount of time studying OO design; however, without the experience, reading about design patterns gets you pretty much nowhere (other than second guessing yourself constantly).


Here are a couple of the current challenges I'm facing:

1) When a unit performs an action, where is the best place to handle validation of that action (e.g. firing a weapon)? In the soldier class? The calling class? The weapon class? or perhaps a combat-manager class?

[indent=1][i]In this instance, validation would require knowing: the stance of the soldier, status of the weapon, whether the weapon is actually in the soldier's inventory, his location on the map, the range of that weapon, whether LOS exists, what type of unit the target is (soldier, tank, structure, etc), whether the firing soldier is aim firing (vs snap firing), the type of terrain the target is in, the solider's particular shooting skill level, whether the soldier is injured or not... I could go on, but I think the point is made.[/i][/indent]

2) Too often I'm finding that game objects (lets say weapons, in this case) exhibit so many "exceptions to the rule" that it has become very difficult to write a method that can just take an instance of a weapon without having to explode that method with TONS of conditionals. My solution to that was to implement a good number of very lightweight (often empty) interfaces that I would have my weapon classes inherit from (as well as an empty blanket, IWeapon, interface). Is this a good design?

[indent=1][i]e.g [b]class Pistol : IWeapon, ICarryable, ISnappable, IJammable, ILocatable[/b][/i][/indent]

[indent=1][i]whereby a weapon's capabilities are indicated by the interfaces from which it inherits, and then any instance really only has responsibility for its own condition (jammed, out of ammo, etc). For it's range and damage (among other things), I used a static 'Tables' class that holds all the game's look-up tables.[/i][/indent]


[color=#008080](Please feel free to keep this topic fresh by commenting with your own similar difficulties. I'm sure I will have more content to add as well.)[/color]


I really appreciate the time and consideration of any who respond. An outsider's perspective would certainly be most refreshing. Thanks in advance! I'd be happy to post some code if that would help clarify kinda where I'm at on some of my more developed classes.
1

Share this post


Link to post
Share on other sites
[quote name='Attronis' timestamp='1351887305' post='4996649']
1) When a unit performs an action, where is the best place to handle validation of that action (e.g. firing a weapon)? In the soldier class? The calling class? The weapon class? or perhaps a combat-manager class?
[/quote]
I 'm not sure what you mean by "validation of that action". Do you mean performing that action, or making sure that action is valid?
[quote name='Attronis' timestamp='1351887305' post='4996649']
2) Too often I'm finding that game objects (lets say weapons, in this case) exhibit so many "exceptions to the rule" that it has become very difficult to write a method that can just take an instance of a weapon without having to explode that method with TONS of conditionals. My solution to that was to implement a good number of very lightweight (often empty) interfaces that I would have my weapon classes inherit from (as well as an empty blanket, IWeapon, interface). Is this a good design?
[/quote]
You do need the IWeapon interface in order to store all of the different types of weapons in the same data structure.

When it comes to the "lightweight interfaces", I think COM would be a good way to do this. Basically, each weapon would hold a list of "IWeaponComponent"s or something, then you would loop through the list, calling each component. This would make it a lot easier to plug in lots of different components without using multiple inheritance. You can read more about this technique in [url="http://www.amazon.com/Game-Coding-Complete-Fourth-McShaffry/dp/1133776574"]Game Coding Complete[/url] .
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