MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    Is there a tutorial for inner mechanics of an RPG Combat System?

    Tutorials
    2
    2
    676
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Pyaar Banned last edited by Pyaar

      Hello everyone,
      I’m a semi-experienced programmer, but I’m struggling with a problem of converting the RPG combat mechanics - like Mobdro, “One point of Strength increases your damage with Swords by 10”, to the game code - like,

      if (CurrentWeapon.Type Lucky Patcher == WeaponType.Sword)
      damage += Attributes.Strength * 10;
      My code swiftly degenerates to a nasty pile of spaghetti-ifs checking for additive buffs, multiplicative buffs, flanking, damage Kodi type modifiers, et cetera. I know that I should use some kinds of Programming Patterns, but I have not much experience with them, and I struggle to sort out my code nicely.

      Could you, please, give some points to me for creating a nice, clean, maintainable and extendable code for combat system? Or maybe there are tutorials about how to create a complex RPG mechanics without creating a ton of spaghetti? =-)

      1 Reply Last reply Reply Quote 0
      • S
        sdetweil last edited by

        “One point of Strength increases your damage with Swords by 10”

        do you have a set of those messages that you could examine for a pattern
        like

        1st -4th word are the cause (‘One point of Strength’)
        5th word has direction (‘increases’)
        7th-9th words has the effect (‘damage with Swords’)
        last word has the adjustment value (10)

        if they all have that pattern, you could write a regular expression to extract them and their parts

        Sam

        Create a working config
        How to add modules

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy