RPG Library: Introduction - ThePix/QuestJS GitHub Wiki

This is still under development to some extent.

In an RPG (Role-Playing Game) the user is generally given the opportunity to customise the protagonist to some degree, and that customisation will then impact how successfully the protagonist can perform tasks in the game, most notably in combat. There will often be opportunities to further upgrade the protagonist as the game continues.

This is not restricted to interactive fiction. Dungeons & Dragons is probably the most example, but computer games like Skyrim and Mass Effect are other examples.

RPGs are complex, and even with this starting point there will be a lot of work. By their nature they tend to be very big - it will take some time for the player to get to level 10, with many long adventures along the way. On the other hand there may be a low expectation in the level of detail required for each room and less need to implement everything, and you may be able to generate some areas procedurally.

Including in your game

Due to its size, the RPG module is split across several files, and it is convenient to keep it separate to the rest. It is therefore in its own folder. This works a little differently to the other optional library files; you need to tell Quest the folder, and then the files in there.

settings.customLibraries.push({
  folder:'rpg',
  files:["lang-en", "rpg", "skill", "attack", "item_templates", "npc_templates", "commands",],
})

If you are using a different language, you will need to include your own language file (and indeed create your own language file). There are other files in the folder you might also want to add.

Contents

The Player, NPCs and Monsters Use RPG_PLAYER and RPG_NPC for the player and NPCs (that includes any monsters), rather than the usual templates.

Items Use the WEAPON or SHIELD template. For armour, just use the WEARABLE template. You can also create amulets, scrolls, potions and spellbooks.

Templates for monsters Various templates are available (with a fantasy bias!).

Spawning How to spawn monsters and items

NPC Behavior: Attacking and guarding.

NPC Attributes

Skills and spells Special skills for warriors are handled much like spells, and there is a lot of scope!

Limiting Magic Adding power points/mana, Vancian magic, cooldown, etc.

Effects Spells can put special conditions - effects - on a character or item.

Attack Combat is handled by creating an Attack object, which gets processed by various stake-holders before being applied to the target. It all happens in the background, but an idea of how that works is useful.

Communication If the player attacks one guard, the rest should join the battle!

User Interface Under construction...

Extra functions Functions you may find useful.

Character Creation Dialog Let the user create their custom character.

A Note About Genre

This is geared towards a classic fantasy world. I think the world model used by parser-games lends itself to hand-to-hand combat, rather than ranged combat where the user might expect to shoot a target several locations away. However, the library can be readily adapted to any system.

If you are wondering how this would work for your preferred genre, I would suggest you start by writing out a couple of transcripts of how a possible combat might go. That will force you to think about what commands the user will type, and what sort of responses will be appropriate. If the transcripts work, then your game should work.

A Note about Multi-User Dungeons

Can you use QuestJS to create a multi-user game?

The answer is yes, but you will have to do some significant coding yourself. You will need a server that the game on the user's computer communicates with, and that may cost money, so is worth researching first. You will also need some kind of user authentication.

To my mind, a bigger issue is you need players. Is it worth taking two years to make your game multi-user if there are never more than six people on-line at one time and they rarely meet one another?

Further reading

See here for how to create a custom calendar.

One way to create a large game is to break it into parts, and actually create several games, each a part of the whole. You could add additional parts at a later date. See here.

There are a couple of interesting off-site articles on world building here and here.