evennia / ainneve

A full example game created in Evennia (under development, anyone can help!)
77 stars 52 forks source link

Design the ability system #31

Closed abbacode closed 8 years ago

abbacode commented 9 years ago

Hi all,

Creating this so we can have clarity around how the ability system will work.

Objectives from IRC discussion

If this is incorrect, please advise and I'll update this post.

Questions

Should we be introducing the basic concept of learning/unlearning skills as part of the initial Ainneve role out? Is it an important core feature that people who fork Ainneve in the future will likely use, i.e. allow players to learn a new skill via a 'trainer mob' or purchase new 'spellbooks' etc.

Decision Point 2: How to store abilities

How do we actual store skills and spells on a character? The logical conclusion would be to create a new attribute on the character class, i.e.

self.db.skills = {} self.db.spells ={}

New Skill and Spell classes can be created which inherit from a parent Ability Class. These objects can then be assigned for each ability and stored under the character class. The problem I can see with this system is how you maintain it moving forward. Each object that is initialized using this approach is a unique instances assigned to each player. There is no simple and clean method that allows us to make tweaks or modifications to skills or spells and have these propagate to all players.

Decision Point 3: Data driven vs de-centralised

How do we structure the code? The two options that have been discussed are data driven and decentralization.

Data driven implying that we have a skill and spell database where we store all the the core attributes. This would include things like descriptions, cast/use messages, modifiers, delay_on use settings etc. When coding new skills and spells, you can make reference back to the database to pull key information.

De-centralised:

A class is defined for each skill and spell and all the relevant attributes are hardcoded within the relevant python source file.

Other

Please post any other items that need to be discussed for abilities and I'll update the top post to reflect the current position.

Nadorrano commented 9 years ago

Hi, I have little time in this period and I didn't follow the IRC discussion. I apologize if this has already been discussed.

Point 2: This is a problem that has to be solved at a global (archetype) level, not just for skills and spells. Can't we make archetypes as properties? so that archetype data is stored in modules and not in database? In this way if, in the future, we want to add/remove skills we can do it in the archetype module and all characters will be affected automatically. This is also valid for race, we can add/remove slots/limbs without re-initialize all characters. Anyone has an idea of the compared efficency between: "load a class from db" and "reinitialize the class" (at every call)?

Point 3: I think we can use commands for skills, in order to mantain a good versatility (in parsing, for instance). For spells we can make a single cast command and a library of functions, something like: spell(caller, target, **kwargs).

My two cents.

ergodicbreak commented 9 years ago

I'll have time to comment on this later tonight but for now I want to drop this relevant link,

https://github.com/evennia/evennia/wiki/Typeclasses#updating-existing-typeclass-instances

which supports @abbacode's concerns.

ergodicbreak commented 9 years ago

I am still thinking about the central issue of data driven. @abbacode it would be helpful I think to lay out a few scenarios/use-cases, regarding the core game mechanics of archetypes, races, abilities, etc., that could guide us here. For example,

Scenario 1: every spell its own instance in Character.spells Fireball spell causes 10 damage. Devs raise it to 15. Need to loop through all Characters to update Fireball instances.

One note, in Open Adventure (OA) specifically, you don't learn abilities (abilities are more like proficiencies than skills), but spells are only available if your character level is the same or greater as the spell level (called spell tier actually).

abbacode commented 9 years ago

What if we only assigned attributes to the character database if the attribute is unique and specific to the character. Skills and spells are not unique, we're aiming to give characters access to ALL skills and spells as part of Ainneve.

It would make sense to have skills and spells defined as a global object that is not tied to any user. Any time a character needs to use a skill or cast a spell it would simply read key data from this object. It would allow us to make modifications on the fly which would impact all users right away.

These could include the following attributes:

Griatch commented 9 years ago

@abbacode

Just a request for word clarification here: What do you mean when you write "global skill database"? When I hear "database" I'm thinking an actual database table but is that really what you are suggesting for storing skill data? . Griatch

abbacode commented 9 years ago

Sorry Griatch, I should have been more explicit. I just mean some mechanism of storing attributes. Most likely a dictionary which references a class. The reason I use the term global database is that it's accessible from anywhere in the code because we can import it as a module.

Update: so technically, this information is just stored in memory every time the server is started, or re-initialize when the mud is reloaded. It is however hard coded and subject to normal version control. OR it could be stored as an Evennia Object, saved in the database, but either way, it's still not associated with a character, so changes would be global and impact all users immediately.

whitenoiseoss commented 9 years ago

Anything is accessible from anywhere, if it's in Python code or in a database. This does not actually fit the definition of "global" (nor should it) and it's not really a database, it's just an object. So you're just talking about an object that stores abilities.

Also, you're still not understanding how Attributes work. The changes will apply the same, whether you put them on a Character's attributes or not. The abilities a player has should be an attribute on the Character.

The idea of running init or at_object_creation again is an undesirable "feature" once a game is actually live. It's fine to go around doing it while you're developing and testing things, but your production launch should just be as close as you can make it to what you want it to be. If you have to change it, you will need do a sweeping alter on objects, and there is no way around this. Running init or at_object_creation again is undesirable because for instance on my more detailed Race implementation, you can add/remove limbs and slots from a race. What if this has occurred, and you just apply init to everyone again? All of the work that has been done on everyone's race objects is gone, just to update. Instead, you could just collect everyone and intelligently change the values, which is what the best practice would be, if you need to do a change.

ergodicbreak commented 9 years ago

@abbacode and @whitenoiseoss I think the goal is to, as the link https://github.com/evennia/evennia/wiki/Typeclasses#updating-existing-typeclass-instances mentions, "avoid having to retroactively update objects more than necessary". Not putting an instance of an ability in Character is how to achieve this. Of course Character still needs to hold the value/rank of the ability and any Character-specific mods.

So Character will need a reference to the collection of abilities.

feend78 commented 8 years ago

@ergodicbreak, this is the next step, as I see it, to getting character generation together. In looking at the OA rules for skills/abilities, and the listing of skills from the wiki, the skills seem like they could be represented by another set of Traits on the character. Then, individual action commands can be written later that do the actual skill checks against the characters' skills to determine outcomes.

I was thinking we should perhaps swap out the skills that provide direct bonuses to combat. If we were implementing a greater number of skills and could break Melee or Ranged into a wider range of categories, they'd be more worth it, but I think we enable a wider range of content if we swap Jump and Climb for Melee and Unarmed in the STR category, and swap Listen for Ranged in PER.

I would also like to swap Survival for Languages in INT. The way languages are described in OA, there is some complexity to it, and I think if we do implement languages, individual language allocations are handled separately. In the OA manual, the Languages skill only gives a player bonus language counters to allocate, rather than being a skill to check directly.

My focus on this will be narrow: to add this collection of skills and some module functions and classes that will be useful during chargen. I also plan to add a switch on the sheet command to display skills, as well as a stand-alone "skills" command.

I don't see any mention of spells during the chargen process in the OA manuals, so I'm leaving them for later. From what I can tell, spells may not need any separate module with info, but instead could be implemented as commands that get added to characters' cmdsets when they level up and new spells become available.

ergodicbreak commented 8 years ago

@feend78 your skill/spell representation sounds good.

We originally included melee/ranged to limit the scope of the project since they are simple to implement, and Ainneve is a three level game, but thinking about it now it would be useful to have the extra action skills. Survival however seems less useful given the size of the game world, I'll think about that.

feend78 commented 8 years ago

@ergodicbreak,

Yeah, I can see how Survival might be not so useful. The problem is that so many of the Intelligence abilities have a specific category associated with them, and I think the OA manual says that that means players can choose a different category for each adventure, in consultation with your GM so that it's applicable to that adventure. Given that, I feel like most of them would be hard to implement in a general way.

Even Survival has a category and therefore that problem, but I was kind of thinking that with Survival, we could perhaps implement the OA rations/morsels of food/hunger mechanic, so you could use it to search in nature for morsels, and perhaps we can make resting by a fire started with the Survival ability give enhanced HP regeneration since the OA rules for HP regeneration seem harsh at 0.5 HP per day for a level 0 character, not that we'd necessarily have to keep that base rate.

There is also a fair amount of variation in the types of wilderness areas of the Ainneve world in its current description. There would certainly be opportunities for creative builders to incorporate Survival checks into how characters navigate and interact with those areas.

feend78 commented 8 years ago

I would advocate for this issue being closed now that #52 has been merged. The remaining items that it discusses are more related to individual command/skill implementations than the overall Skills system, and I imagine each implementation might warrant its own issue/discussion.

ergodicbreak commented 8 years ago

Agreed, thanks @feend78 .