Best approach at creating Pen & Paper RPG style combat/character system

Hey everyone, newbie at Quest stuff here.
I've been wanting to create something RPG-ish for a while, so I started implementing simplified version of OpenD6 RPG system (the fantasy variant)

So far, I have written minor stuff like d6 dice rolling and character attributes, and I am wondering whether my approach at implementing attributes is good or perhaps this can be achieved in better, simpler way.

I would appreciate some feedback about the code I've written so far - the code is in repository here.

Ideally, I would like to create a library that would handle combat , various creatures (actual fighting, items like armor, magic scrolls and so on), skill checks and character creation.

Also, would appreciate any thoughts about this. How feasible is to create customizable and reusable library that would be useful not just to me but to others as well?


Hello.

Have you seen this?

https://github.com/ThePix/quest/wiki/CombatLib


Yeah, I've seen it - that library is what initially gave me the idea to perhaps create something that would closely resemble pen & paper RPG.
And yes, there is a chance that I am biting off more than I can chew, I am aware of that :)


We all bite off more than we can chew, it’s part of the learning process.


There's a lot of already built-in functionality, such as the 4 randomization Functions:

http://docs.textadventures.co.uk/quest/functions/ (categorical order)
http://docs.textadventures.co.uk/quest/functions/index_allfunctions.html (alphabetical order)

DiceRoll ()
GetRandomInt ()
GetRandomDouble ()
RandomChance ()


you can also take a look through this thread for resources:

http://textadventures.co.uk/forum/design


here's a thread I made to compile various rpg design resources, that may be useful for some ideas for you:

http://textadventures.co.uk/forum/design/topic/3876/rpg-elements-game-mechanics-and-game-design


Pixie has done a lot of combat/magic/equipment and etc rpg mechanics coding

KV and mrangel probably has done some as well

I've done some too

if you know basic scripting, doing rpg mechanics isn't too hard, but where my own limit is at is with doing good system/game-wide (scalable/editable/efficient-optimized/etc) coding of rpg mechanics


@Silver

We all bite off more than we can chew, it’s part of the learning process.

Yeah, and the learning process is the most fun part :)

@hegemonkhan
Thanks, that is seriously awesome compilation!
Currently I am following OpenD6/Fantasy reference, but I think some variation/deviation from them can't hurt.

if you know basic scripting, doing rpg mechanics isn't too hard, but where my own limit is at is with doing good system/game-wide (scalable/editable/efficient-optimized/etc) coding of rpg mechanics

It is not that hard, I agree. However, creating scalable and reusable Quest library for RPG mechanics is a challenge - I am used to doing things in OO programming languages like C++/C#, so currently I am learning proper ways of doing things with Quest scripting through experimentation.


What type of combat are you looking for?

This is something simple. player.health = player.health - roll
http://textadventures.co.uk/forum/quest/topic/0vqepklal0yde6bi13fz3q/how-to-change-a-counter

This is The Pixie's Zombie Apocalypse game. It unambiguously takes stats from D&D.
https://github.com/ThePix/quest/wiki/The-Zombie-Apocalypse-(on-the-web-version)

Please see my games to see the code in action.
http://textadventures.co.uk/games/view/xb0ge9kzbewhodrtmxnnqw/the-legend-of-the-secret-of-the-smelly-stinky-fish
http://textadventures.co.uk/games/view/fo9bej7z0kqiy_wxal2tcq/fing-game


ah, you know C++ and C#

I know C++ pretty well, some of Java (had a bit of trouble with doing the graphics stuff, though that was when I took the java class as one of my first programming classes at college, so I can probably understand it a bit better now), and know a little with Python too. And only very basic stuff with web/scripting languages (html, css, js, xml, etc). Still struggling with Data Management (linked lists, maps, dictionaries, trees, iterators, etc), Assembly Languages, and Computer Architecture programming classes, so I'm still a beginner/amateur in programming.

I played a lot of RPGs (love them), though never done D&D type of stuff, but they use similar mechanics/equations/formulas, lots of good ideas from rpgs and D&D stuff for references, hehe

In quest, it got 'Objects' already (the internal quest coding's 'OBJECTS' are known as the 'Elements' in Quest: http://docs.textadventures.co.uk/quest/elements/ , but there's the user-level's sub-Element 'Object' that we work with: http://docs.textadventures.co.uk/quest/elements/object.html ), which are the most powerful/useful things to work with, and you also got the 'Object Types' which work like user-level classes/groups as well that can be inherited to Objects and each other (nested layers of them), and then you got List/Dictionary Attributes (Attributes are Object data/members, including script attributes, that are also an Object's methods, as well) which can hold strings, objects, and/or scripts (only dictionaries can). Lastly, instead of using Functions, you can use Delegates, which basically act as 'Prototypes' for Script Attributes, allowing them to function just like Functions (input data/parameters/arguments and/or return values), so you can do full encapsulation, without using generalized Functions floating elsewhere in your game code.


Delegates:

http://docs.textadventures.co.uk/quest/types/using_delegates.html

you use 'rundelegate' if you do NOT return a value

you use 'RunDelegateFunction' if you DO return a value

<include ref="English.aslx" />
<include ref="Core.aslx" />

<game name="example_game">
  <attr name="start" type="script">
    create ("example_object")
    example_object.example_string_attribute = example_function ("hi")
    msg (example_object.example_string_attribute)
  </attr>
</game>

<function name="example_function" parameters="example_string_parameter" type="string">
  return (example_string_parameter)
</function>

// -------------------------------

<include ref="English.aslx" />
<include ref="Core.aslx" />

<delegate name="example_delegate" parameters="example_string_parameter" type="string" />

<game name="example_game">
  <attr name="start" type="script">
    example_object.example_string_attribute = RunDelegateFunction (example_object, "example_script_attribute", "hi")
    msg (example_object.example_string_attribute)
  </attr>
</game>

<object name="example_object">
  <attr name="example_script_attribute" type="example_delegate">
    return (example_string_parameter)
  </attr>
</object>

@jmnevil54

What type of combat are you looking for?

What I have in mind is kind of rule-based combat with multiple possible states that allow player s different possible actions to do in the middle of the combat.
For example (those are rough ideas, they are not set in stone):

  • Starting distance of the combat depends on context:
    • If a room (or enclosed space), it starts between 2 meters and 10 meters (randomly)
    • If player was sneaking to a monster (assassin style stabbing) - it would start at melee range
    • If outside of a building, combat starts between 25 and 100 meters (randomly)
    • All sorts of scenarios here could be possible - outside ambushes, initiate combat with NPCs that were not initially hostile etc
  • Different options to either close up the distance or use it to fire ranged weapons/cast spells and try to keep distance
  • For melee combat three possible states - attack, combine attack/spell cast with defense and only defense. Using skills and doing multiple things is possible in one turn but with a penalty to skill rolls (since I am looking at OpenD6 system, skill rolls are d6 dice rolls)
  • Special attacks and multiple combat stances that do buffs/debuffs
  • Secondary skills system that depend on primary properties - which affect combat and interactions with NPCs/environment (dodging, melee fighting, climbing, running etc) allowing things like skill based rolls to block and dodge attacks
  • Magic system with spells of different schools with bonus damage/resistances (fire elemental is immune to fire spells and gets bonus damage from frost spells)

To sum it up, I am looking something that complex enough to allow tactical approach to combat and resembles combat interactions of pen & paper RPG


@hegemonkhan
I am fairly proficient with programming (writing C# is my day job), so currently the goal I set before myself is exploring the limitations and quirks of Quest and creating/writing things in the most efficient way.

I played a lot of RPGs (love them), though never done D&D type of stuff, but they use similar mechanics/equations/formulas, lots of good ideas from rpgs and D&D stuff for references, hehe

I LOVE RPGs! Besides computer game RPGs, I played pen & paper for a some time in college, so I am somewhat familiar with how their mechanics work - they are different from computer game RPGs - they have more complex stats/character system and they allow more complex interactions with game world. (modeling complex interactions is much harder than simple ones, so computer game RPG mechanics are understandably much simpler)
So I agree, computer game RPGs are good examples to follow, since not all pen & paper RPG interactions can be modeled properly, and simplification is many times is warranted.

Also, huge thanks for the intro - I somehow missed that member methods are possible in Quest. OO encapsulation definitely makes things better! In code I wrote up until now (and I hadn't written much) I already had too much "global" functions to be comfortable with..


(filler for getting my edited post, updated/posted)


two main annoyances/limitations with quest that I can think of off hand:

the quest engine in made up of library files, so you can create your own quest engine, if you're good at programming and know how quest works. However... there's no 'ifdef/ifndef' functionality (as far as aware as I am) for the library files...

also, quest doesn't really allow for breaking/halting operations/scripting, so you got to be a bit creative with your scripting, when doing automatic looping and getting user inputs (typing via 'get input' or mouse-click menu popup selections via 'show menu, ask, etc'), though, generally tail-recursion/tail-looping works well, and/or using conditionals. For example, trying to use the 'while' function with getting user inputs, can be problematic, and you'll have to be a bit more creative in your scripting design/methods, and/or including in not use the 'while' function as well


and if you want to delve into the quest program/software itself:

Alex started it as a learning project like 10 years ago... so unfortunately... it's quite a bit of a hodgepodge of various programming things, which makes it really difficult for everyone else (poor pixie) trying to develop it... now that Alex has moved on with his life

here's two blog posts of it with some info on what quest is built-upon (this is an old blog post, we got a new team, not sure if they'll take on more people, they may or may not, no idea, if you would be interested in getting involved with it):

https://blog.textadventures.co.uk/2016/12/12/developers-needed/
and
https://blog.textadventures.co.uk/2016/12/07/looking-for-a-new-owner-for-textadventures-co-uk-and-quest/ (ah, this blog post has some good links, will put them at the bottom)

and here's the home page of the blog webpages: https://blog.textadventures.co.uk
(you can read the blogs to see the progress with quest development)

there's also a developer's webpage too, but I don't know/have a link to it off-hand (I'd have to search around for it)

Pixie and others have github pages for quest that have a lot of the resources for quest development and/or libraries they've made


I think this is quest's main/developer's github page:

https://github.com/textadventures/quest

and some other useful links too (QuestKit, aka quest v6.00, is Alex' unfinished project to convert quest fully over to JS, so that any platform/computer/mobile-device can use it, as JS uses browsers):

https://github.com/textadventures/quest
http://textadventures.co.uk/forum/questkit


Text only gets you so far for battle strategy...
Map a room with tiles and have the player and NPCs move on that map.
Then... you can see where everyone is and know who to attack...
And see what you can move behind to protect yourself from an attacker.


Alex started it as a learning project like 10 years ago... so unfortunately... it's quite a bit of a hodgepodge of various programming things, which makes it really difficult for everyone else (poor pixie) trying to develop it... now that Alex has moved on with his life

That is a bit unfair. Alex started 20 years ago, but completely redesigned it with Quest 5, so it is not a "hodgepodge". It is a complex, modern Visual Studio solution, which makes it difficult for me, because I have no background in that area.


I am fairly proficient with programming (writing C# is my day job), so currently the goal I set before myself is exploring the limitations and quirks of Quest and creating/writing things in the most efficient way.

With that background, I hope you will stick around and end up helping us!

Also, huge thanks for the intro - I somehow missed that member methods are possible in Quest. OO encapsulation definitely makes things better! In code I wrote up until now (and I hadn't written much) I already had too much "global" functions to be comfortable with..

Yeah, Quest is OO, but it is not great in that regard (note that classes are called types). Scripts are awkward, as they do not return values, and delegates require extra work (partly because there is no editor support). I know I use functions way more than I would with another language.


With that background, I hope you will stick around and end up helping us!

Scripts are awkward, as they do not return values, and delegates require extra work (partly because there is no editor support)

If I have enough time to look properly through Quest's code, I will definitely contribute :)
Currently, I am playing around with the idea of creating parser and interpreter for the scripting language that would allow to easily extend/modify the language, and also would allow creating Visual Studio style code editor textbox (with static code analysis, intellisense, red squigglies to underline syntax errors and so on).

Building the parser itself it is not that hard (I have a working prototype here) - the hard part is to integrate it properly so backward compatibility is not ruined. So far I didn't have time to look into how exactly Quest runs its scripts, just looked over ExpressionOwner class to get the general idea of how things work.


Log in to post a reply.

Support

Forums