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

fourvector

Members
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

120 Neutral

About fourvector

  • Rank
    Newbie
  1. I'm finding myself running into the same kind of problem over and over again, and I'm wondering if there's a pattern I should be using for it. It started with my rendering system. I'm using a component based architecture, and naturally my GameObjects would possess renderable components, such as a sprite. In order to render these components in an appropriate order, I had made a renderer object which would sort the renderable components and call render() on them in order. So when I construct a given GameObject, and it will have a renderable component, I pass a renderer to the constructor which the renderable is then added to. The rub is that I'd like to be able to clone my GameObject, so all my components have to be cloneable. I'd like any renderables that I clone to end up registered to the same renderer as the renderable they were cloned from. To do this, my renderables keep track of which renderers they've been added to, and when they clone themselves, they can add the cloned renderable to the appropriate renderers. It seemed like a good way of doing it at first, but now I'm beginning to wonder. I've now got an Actor component that needs to be registered to a Time object that manages which Actor takes their turn next (it's a turn based game). By the same reasoning as used for the renderable, the Actor will have to keep track of which Time object it's been added to. But now I'm adding more code to the actor, just to allow it to keep track of which Time object it was added to, than I've got describing the functionality of the Actor. I'm being tempted by singletons for these object managers, but they make me feel dirty. Has anyone encountered similar issues?
  2. Hi ApochPiQ. I've taken your very last piece of advice and decided to do away with a generalized action framework. I've realized it's more important to write a specific piece of code to handle picking things up than a framework for doing EVERYTHING. At least for now, maybe when I've written some specific pieces of code for different actions I might more easily be able to recognize a common theme among the various actions.
  3. I'm still mulling over and playing with what you've said, ApochPiQ. I believe I understand and agree with what you've said about Data: turn CanPickUp into a piece of data instead of an interface, and you can move it around and use its functionality in a more versatile way. I also like the idea of having Nouns as being a fundamental sort of object for storing these pieces of Data, because it closely mirrors the Entity-Component architecture. I'm a bit confused about the distinction between a capability and a verb. It seems to me that in defining a capability, what you're really doing is implicitly defining a verb. This is how I understand what you're saying: A capability has a perform() function, in which it does the thing which it is capable of doing, and a canPerform() function, in which it determines if it can do the thing it is capable of doing. In your example you include three capabilities: PickUp, ContainerCapability, and ItemCapability. In addition to their perform() and canPerform() functions, ContainerCapability and ItemCapability also have functions which are related to our understanding of how Containers and Items operate, such as Container.canFit(Item) or Item.getContainer(). I'll call functions of this type "the meat", they are what make the actual game behave in a specific fashion, as opposed to the bones, which is the scaffolding, like perform(). So capabilities hold the meat. This makes sense to me. After the meat has been defined in the capabilities, you can then construct a phrase list, with verbs being the linking up of two different capabilities. This linking defines the verb itself. I attempted to implement this structure, but got stuck at what exactly the Container.perform() function should do. It seems as though the functionality of this function had been preempted by the PickUp.perform() function. It seems to me that Container.perform() should do what PickUp.perform() does, namely, cause an item to be contained by it. Here is where I realized that Container, in this scheme, implicitly defines a verb, namely "contain", through its perform() function. I would assume then that Item.perform() would do the exact same thing as Container.perform(), only maybe in a sort of converse way. We could really rename container and item to CanContain and CanBeContained, and the perform function on both of them does the same thing. This implies that when we make our list of acceptable phrases, there's a natural verb that should be defined, namely contain, with the acceptable triplet being [CanContain contain CanBeContained] Which, when executed, does this: CanContain.perform(CanContain, CanBeContained), or CanBeContained.perform(CanContain, CanBeContained). I suppose I'm stuck at this point. How might I define other verbs in my phrase list besides the natural verb implied by the perform() function? For instance, it makes sense that I should be able to remove an item from a container. But no combination of perform() calls from the two capabilities would implement that functionality. Do I create a CanRemove capability, with a perform() function that deals with the CanContain and CanBeContained capabilities, in a similar way to how the PickUp capability did before I subsumed it into my CanContain (Container) and CanBeContained (item) capabilities. Isn't this verging too closely on precisely what I was doing before? I don't mean to be difficult, but I feel like I'm running around in circles in my head. As an aside, I've been giving some thought to the kinds of functions I'd like to call on a general subject-verb-object structure. There are three groups: [CODE] Group A boolean CanVerbNow(verb, subject, object); boolean CanBeVerbedNow(verb, object, subject); void do(verb, subject, object); Group B boolean CanVerb(verb, subject); booean CanBeVerbed(verb,object); Group C set<Noun> getVerbed(verb, subject); set<Noun> getVerbedBy(verb, object); boolean isVerbed(verb, object); boolean isVerbedBy(verb, subject) [/CODE] Group A contains the meat, these are the functions that actually care about what the verb DOES Group B only really care about what the verb does on a conceptual design level, but not on an actual functional programming level. They guarantee that the noun does these things, but they don't care what these things are. Group C don't care at all what the verb does, but instead only care about semantic relationships. I've realized group C are actually questions about the topology of a directed graph, where nodes are nouns, and verbs are edges. I think it's a very interesting observation with bearing on how I should engineer my code. A little bit of googling indicates that this problem is being though about, but maybe not much for game programming: [url="http://en.wikipedia.org/wiki/Semantic_network"]http://en.wikipedia.org/wiki/Semantic_network[/url]
  4. ApochPiQ, Perhaps I am confused about what you mean by data. Data wouldn't have any functionality besides getters and setters and such. I would imagine here that the noun data would just be an enum, : {CanPickUp, CanBePickedUp, etc...}. But then in the example you've given, we have a function like subject.CanReach(object). How are these functions defined? Additionally, does every Noun need to have a CanReach(object) function, shouldn't only the ones that CanPickUp? I appreciate your help, I just feel like I must not be understanding something that you're trying to say.
  5. ApochPiQ I considered implementing it as data, but I wanted different CanAct and CanBeActedUpon objects to be able to modify the Action. So for instance this is PickUp: [CODE] public class PickUp implements Action{ CanPickUp subject; CanBePickedUp object; public PickUp(CanPickUp subject,CanBePickedUp object){ this.object=object; this.subject=subject; } public void Act(){ //iff the subject can pickup if(subject.isInReach(object) && subject.add(object)){ //remove the object from the region object.removeFromWorld(); } } public String getName(){ return "Pick Up "+object.getGameObject().name; } } [/CODE] With the CanPickUp and CanBePickedUp interfaces having the functions implied here. Now different components can implement these interfaces in different ways. For instance a land mine, when it is "removeFromWorld()" might, in addition to leaving the world, also do a test to see if it explodes, or something to that effect. In general it makes sense to me that different nouns should modify the action. With a data implementation, I'd have to construct some kind of huge case structure to account for different functionality. 6510 Is using instanceof expensive, or is it just considered bad form? To me it seems like the right thing to do. I use it frequently for my event distribution system to my components, since it seems more type safe than having some kind of string as an ID, which could be tricked, for instance, I could send a RegionChanged event, any component listening for RegionChanged events would check the type and respond in the right way.
  6. I'm writing a roguelike in Java, using an entity-component architecture I put together. I want to develop a framework for defining game actions that entities can take, and can be taken on, for instance "pick up", "attack", "eat" etc. My design followed from the premise that the definition of every action can be thought of as a triplet consisting of a subject, verb, and object. So for instance, Hand - pick up - item. So I defined three interfaces: [CODE]Action[/CODE], [CODE]CanAct<type extends Action>[/CODE], [CODE]CanBeActedUpon<type extends Action>[/CODE]. Then what I would do would be to define a new action class, such as [CODE]Class PickUp implements Action{ PickUp(CanPickUp, CanBePickedUp){..} }[/CODE], with two interfaces [CODE]CanPickUp extends CanAct<PickUp>[/CODE] and [CODE]CanBePickedUp extends CanBeActedUpon<PickUp>[/CODE] The idea was that with this framework I could assign different components different CanAct interfaces, and then if an entity lost the component, for instance your hands are cut off, they would lose the ability to take actions, unless of course they had other components which also performed those actions. In addition, I could create menus of possible actions on the fly, since all I'd have to do was take the main entity, compile a list of all it's possible actions (for component in entity, if component instanceof CanAct, component.getType()), then look at it's surroundings for other entities with components that have CanBeActedUpon of that type. Meanwhile the action would provide it's own name, so the menu code could be completely oblivious. The problem is that Java won't allow an object to inherit two interfaces from the same base interface. So for instance, if I add Hands, I want them to be able to PickUp, Equip, Attack, and Open. CanPickUp extends CanAct<PickUp>,CanEquip extends CanAct<Equip>. My Hands object can't implement both. Additionally, it gets very messy for some reason. Because everything that handles these actions has to be type agnostic, I end up doing a lot of strange typecasting that I don't fully understand. For example: [CODE] public static CanAct<?> canActor(GameObject g, Class<? extends Action> actionType){ for(Part p : g.allParts){ if(p instanceof CanAct<?>){ CanAct<?> CA=(CanAct<?>)p; if(CA.actionType()==actionType){ return CA; } } } return null; } [/CODE] Where for this code I should point out that both the CanAct and CanBeActedUpon interface have the function actionType() which returns a Class<? extends Action>, and then CanPickUp for instance would return PickUp.class . I haven't been able to figure out how to do this in a more elegant way... Not to mention having to iterate through all the parts in the Entity. I suppose my question is, does anyone have any suggestions for me? Am I over engineering my problem? Is there an easier approach? Is there a pattern I've not tried here? Or am I on the right track, and if so, what is my work around for implementing two of the same interfaces with different types?