Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 486515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:30:40+00:00 2026-05-13T01:30:40+00:00

I’m working on a RPG using django and am considering different options for implementing

  • 0

I’m working on a RPG using django and am considering different options for implementing part of the skill system.

Say I have a base skill class ie, something like:

class Skill (models.Model):
      name = models.CharField()
      cost = models.PositiveIntegerField()
      blah blah blah

What would be some approaches to implementing specific skills? The first option that comes to mind is:

1) Each skill extends Skill class and
overrides specific functions:

Not sure how this would work in django. Seems like having a db table for each skill would be overkill. Could the child class be abstract while the Skill class have an entry? Doesn’t sound right. How about using a proxy class?

What are some other options. I’d like to avoid a scripted approach for a pure django approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:30:40+00:00Added an answer on May 13, 2026 at 1:30 am

    Perhaps you might consider separating a skill and it’s associated effect. More that likely, skills will end up having one or more effect associated with them, and that effect could potentially be used by multiple skills.

    For example, an effect could be “Does N frost damage to current target”. That effect could be used by the skills “Blizzard Bolt”, “Frost Blast”, and “Icy Nova”.

    models.py

    class Skill(models.Model):
        name = models.CharField()
        cost = models.PositiveIntegerField()
        effects = models.ManyToManyField(Effect)
    
    class Effect(models.Model):
        description = models.CharField()
        action = models.CharField()
    
        # Each Django model has a ContentType.  So you could store the contenttypes of
        # the Player, Enemy, and Breakable model for example
        objects_usable_on = models.ManyToManyField(ContentType)
    
        def do_effect(self, **kwargs):
            // self.action contains the python module to execute
            // for example self.action = 'effects.spells.frost_damage'
            // So when called it would look like this:
            // Effect.do_effect(damage=50, target=target)
            // 'damage=50' gets passed to actions.spells.frost_damage as
            // a keyword argument    
    
            action = __import__(self.action)
            action(**kwargs)
    

    effects\spells.py

    def frost_damage(**kwargs):
        if 'damage' in kwargs:
            target.life -= kwargs['damage']
    
            if target.left <= 0:
                # etc. etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 422k
  • Answers 422k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer have your search button on the home page be <h:commandButton… May 15, 2026 at 11:18 am
  • Editorial Team
    Editorial Team added an answer Its becasue you are using dataReader instead of this use… May 15, 2026 at 11:18 am
  • Editorial Team
    Editorial Team added an answer Tool windows don't use icons. For a similar style, you… May 15, 2026 at 11:18 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.