As I have mentioned previously, I have started using Emacs recently as my main text editor recently – and it has slowly been creeping past that boundary to absorb more and more of my computing life. In fact, it’s fair to say that it has fundamentally changed how I interact with my computer.
As I’ve got more comfortable with the concepts of Emacs, I decided I needed to learn a bit more about how emacs-lisp works. So inline with my current interest in solo roleplaying, I decided my first project would be a Games Master Emulator:-
So v0.1 is now available over on my NotABug page, for a preliminary implementation. Read on for more details of what it currently does, and my plans for the future…
First off – this is my first every use of emacs-lisp, outside of my Emacs config files. With that in mind, it is probably not very “correct” – I’m sure I’m doing things backwards, using the wrong functions, and putting parentheses in all the wrong places. Please don’t crucify me for my coding style! Secondly, this is all coded in a literate programming style – this is made very easy with org-mode (Emacs killer app), and hopefully this means all the code I write has the logic and usage combined with the source code.
So, what does EmacsGME do?
In essence, it aims to be a selection of functions to enable solo roleplaying within a text file in Emacs, without having to change focus to a book or some tables to get dice rolls/oracle answers/etc. So here are the currently implemented functions:-
The dice roll function
egme-roll-dice can be called interactively, either via
M-x or by the default key-binding of
C-c g r. This will then ask for a dice roll from the user (in the minibuffer), where any normal dice roll can be input (with modifier) in standard RPG notation. So D10, 3D6+14, D66, 2D4-8, etc – all these will be parsed fine. It will then output this back to the player with the result of the roll, like the below examples:-
It can roll any type of dice, and if the dice is a multiple 6 dice (D66, D666, D6666+), then it will handle that with each individual D6 providing each digit as expected (so for a D66, a roll of 27 is impossible). All other dice sizes are treated as if they had that many sides, and added together as expected.
This keeps a history of the dice rolls asked for, and defaults to the previous roll, to save on user input.
The non-interactive function
egme-calculate-dice does the maths – it takes a dice roll as an argument and returns the result. This is used by several functions, and can be used by other projects as required.
This is the heart of the Games Master emulation, answering players questions about the scene. The function for this is
egme-y-n-oracle, which can be called interactively with
M-x or with the default keybind of
C-c g q. You’re then asked to input a question for the Games Master, then a probability of a positive response. The Games Master will then answer your question:-
The probability is presented as options in the minibuffer, from “+4 Near Certain” to “-4 Near Impossible”. This can guide the output, without over-complicating things. The default option is “0 Even Odds”, the equivalent of 50/50 chance of yes or no. The numbers guide the oracle’s mechanics, which will be explained later.
When first called though, EmacsGME will read the current line in the file to see if it ends in a question. If it finds one, it will try and pre-fill the minibuffer input with that text. To continue the above example:-
The question is entirely optional. If you just hit return with no input, it will drop the question line from the output. The probability is required however, but it defaults to Even Odds, which is the best option if you have no idea what the result is likely to be.
And here we see that the answer has been modified! There are 2 modifiers that might be added to the answer, and they are
- “and…” – representing extreme answers
- “but…” – representing partial answers.
In the above example, the question was “Is it a major issue?” – as the answer was “No, and…”, that says not only is it a minor issue, but it is a minor issue that can be repaired with parts already available. If it happened to be “No, but…”, that could mean that it is a minor issue, but they don’t have the correct tools for the job, leaving you to hunt out some equipment to get the ship back into space.
And now with another question, a random event occurs! There is an ever growing chance of a random event, and when one does crop up it will give a general focus and detail in the form of an action and a subject. The different possible focuses are:-
- Remote event
- NPC action
- New NPC appears
- Move towards thread
- Move away from thread
- PC positive
- PC negative
- NPC positive
- NPC negative
- Ambiguous event
Essentially the same as Mythic. This list will be user editable in future versions. The action & subject lists come from my Solo Sci-Fi Sidekick cards, but these are generic enough for any setting. These lists can be changed edited by the user, through the usual Emacs
customize menu (under
Applications/Games/egme, or you can find by searching
Output differs if being used in an org-mode buffer. In those cases, the Games Master output is wrapped inside of a quote block:-
This can help keep your adventure document cleaner – not only can you use all the other features of org-mode for organising your game, but the Games Master output can be “folded” away as shown above – and hopefully it should make it look better if exporting your game to HTML/PDF/LaTeX/[INSERT FORMAT HERE]
The System Mechanics
So how does this work if you were using dice? Each oracle roll is based on a D10 roll, with 6+ being a “Yes” answer, and anything 5 or below is “No” – this is the basic “Even Odds” option. The probability modifiers that the user can apply are:-
- Near Certain (+4)
- Extremely Likely (+3)
- Very Likely (+2)
- Likely (+1)
- Even Odds (0)
- Unlikely (-1)
- Very Unlikely (-2)
- Extremely Unlikely (-3)
- Near Impossible (-4)
With this breakdown, there is always a chance of a yes or no, even with probabilities at the extremes. For the answer modifier, a D6 is rolled alongside – if it rolls a 1, then “but…” is added. If it rolls a 2, then “and…” is added.
For random events, there is an ongoing counter – this starts at zero, and increases by 1 each time a question is asked. A D20 is rolled, and if this is lower than the current random event counter, then a random event is generated. Random events are just a random pick of focus/action/subject from the available lists. When an event is generated, the counter resets to zero. This is simpler to track than the Chaos system in Mythic, but it also means that random events are inevitable and the chances every increasing, like in CRGE.
I do have a few things planned to add/extend:-
- Saving variables between sessions – at preset restarting Emacs will reset the random event counter, dice roll history, etc
- Thread list handling
- NPC list handling
- Modifying above lists automatically when random events need it
- Implementing egme as a minor-mode, with a sidebar buffer showing current thread/NPC lists and other scene details
I’ll happily take any suggestions of what else can be added to this – but that’s not a promise I can implement them all!!!
I’ll keep tinkering though, until Emacs can play the whole game for me!