Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
cant find a pattern to fit neatly - how to make a large number of monsters?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Chris Uppal, post: 598422"] I think you are heading in the direction of a fairly complicated and abstract bit of object modelling; I suggest that you take a step back and consider how much flexibility you actually /need/. Also I'd suggest that, whatever degree of flexibility you finally choose to implement, you try designing a version of the system (and doing a small trial implementation) /without/ considering the memory footprint -- you may find that you've gone up an over-abstract blind alley. It is one thing to able to mix and match different amounts of each of some pre-defined list of "abilities" to build new and terrible monsters. That's easy enough to do using classical OO. But wanting to be able to give monsters new /kinds/ of ability with the same ease, will require a higher level of abstraction; quite possibly your eventual system would look more like a knowledge-representation kit, or a Lisp interpreter. You might find that a hybrid approach would work. Most of your logic "knows" about hardwired abilities (speed for instance) which every monster has to some degree (possibly zero or even negative) and has specific code for handling those aspects (e.g. using strength(), currentLoad(), and currentNumberOfArms() to determine whether the monster can pick something up). In addition you have a (much) less flexible, but more data-driven extension mechanism for adding a little colour to your monsters. E.g. you could have Attack and Defence classes, where: class Attack { String name; float strength; int attackID; } class Defence { String name; float strength; int attackID; } and the idea is that you can add new Attack and Defence objects easily (representing intrinsic abilities or abilities conferred by objects/events), but your actual logic for dealing with them is very limited -- you just consider every Defence with the same attackID as each launched Attack, and add/subtract all the strengths before using that to change the victim's lifeForce(). Or you could generalise that a bit -- e.g. each Attack and Defence might have a defined effect on all of the victims pre-defined attributes (speed etc.). -- chris [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
cant find a pattern to fit neatly - how to make a large number of monsters?
Top