Clojure libraries for generating random characters and star systems for Traveller, a popular ’80s-era science fiction role playing game (RPG) still being used today.
In Traveller, players create characters who explore, trade, build, and fight in a universe created by a “referee” or game master. Traveller has many versions; Classic Traveller was the first, and it remains many people’s favorite. It was produced in the 1980s as a series of “Little Black Books” (LBBs) – 3 core books, plus a series of rule expansions, playing scenarios, and related data.
The code here can be used (so far) for character generation; see Usage, below. Star system generation functionality is in progress!
For the moment, you’ll need to check out this repo.
- To experiment with using small DSLs (example) to represent RPG rules and tables. Though this code is not particularly idiomatic, readable micro-DSLs like this are something Clojure (or any Lisp) is very good at, and are hard to do in a similar way in more mainstream languages;
- To indulge my long-standing interests in
- simulation
- science fiction
- role playing games;
- To see what kind of complex behaviors emerge out of the fairly detailed rules provided by the game designers;
- To tune and refine my Markov-chain-based Character Name Generator;
- As a launching point for other game experiments;
- Because it’s fun!
This software is very alpha. APIs, namespaces, usage, etc. will probably all change.
- Character generation à la LBB #1.
- Name selection, using Namejen.
- Service determination
- Commissioning, promotion, reinlistment
- Survival/death, aging effects
- Skill awards
- Mustering out benefits (pay, gear, memberships, pension)
- Standard formatting, incl. UPPs and skills
- Preliminary work on system generation à la “Scouts” (LBB #6).
- Stellar type, subtype, and size determination
- Generation of available orbits in inner, outer and habitable zones
- Generation of captured planetary orbits
Finish star system generation.
- Monte Carlo questions:
- What is the average survival rate during character generation? (Ans.: 71%)
- Which skills are most common? (Ans.: Electronic)
- What is the averge number of credits received during mustering out? (Ans.: about 19,000)
- What strategies balance high survival rate + high skill levels?
- Starships
- Terrain
- Buildings / cities
- Random Encounters
- Interplanetary and interstellar travel
- Character equipment/possessions
- Narrated character histories using AI/machine writing
- Combat
- Character (1-1, armies)
- Ship (1-1, fleets)
- …
Pull requests welcome, but only for Classic Traveller, please. I’m trying to stay within the constraints of the original Little Black Books for now (Scouts, Mercenary and High Guard OK).
See the functions and examples in the trav.char
namespace. Or, roll
up a few characters on the command line:
$ clojure -A:chars 10 Ubin Traka Ramsey Berta (M), 22 yrs. old, navy, 6987A7 Cudgel-1 HighPsg, 0 CR Ms. Atria Chak Knapper (F), 22 yrs. old, 862374 Forgery-1, Electronic-1 0 CR Colonel Mardelisabelleena Alen (F), 38 yrs. old, army, 547994 FwdObsv-1, BodyPistol-1, Bayonet-1, SMG-1, Spear-2, ATV-2, Rifle-1 BodyPistol, LowPsg, 17000 CR (4000 CR annual) Von Hebe Tahsin (F), 22 yrs. old, scouts, C8A75C AirRaft-1, Pilot-1 20000 CR Assy Karen Rina Vicki Ctor, 22 yrs. old, 277935 Bribery-1, Gambling-1 10000 CR Mr. Josef Stefan Ilya Juri, I (M), 22 yrs. old, 469A86 Electronic-1 LowPsg, 0 CR Mr. Hmed Lius Brette, III (M), 22 yrs. old, navy, 49A8B6 Mechanical-1 5000 CR Mr. Darnest Hose Rrio, Jr. (M), 22 yrs. old, navy, 659C8A FwdObsv-1, BodyPistol-1 HighPsg, 0 CR FourthOffc Smael (M), 26 yrs. old, merchant, 94B749 Mechanical-1, Jack-o-T-1, Streetwise-1 LowPsg, LowPsg, Spear, 0 CR FirstOffc Azaleesa Oerles (F), 42 yrs. old, merchant, 8A5D64 Pilot-1, Jack-o-T-1, Medical-2, Gunnery-1, VaccSuit-1, Electronic-1, Brawling-2 Spear, 41000 CR (6000 CR annual) $
The main method takes an arbitrary integer number of characters to generate (default 50).
Example from the REPL:
;; Single character, w/ all metadata:
(def our-character (make-character))
our-character
;;=>
{:royal-form nil,
:reinlisting? false,
:actual-service :navy,
:generation "I",
:age 30,
:commissioned? true,
:pension-annual 0,
:living? true,
:rank 2,
:first-name "Nelius",
:surnames ["Eidi"],
:terms-reached 3,
:prefix "Mr.",
:drafted? true,
:rank-name "Lieutenant",
:skills {Electronic 2, Gunnery 1, Engnrng 1, Mechanical 1, Dagger 1},
:desired-service :navy,
:credits 55000,
:memberships #{},
:possessions (HighPsg Dagger),
:gender :male,
:attributes {:ss 10, :ed 5, :in 9, :en 7, :dx 9, :st 3}}
(format-name-map our-character)
;;=>
"Lieutenant Nelius Eidi, I (M), 30 yrs. old, navy, 39795A"
(format-skills our-character)
;;=>
"Electronic-2, Gunnery-1, Engnrng-1, Mechanical-1, Dagger-1"
(format-swag our-character)
;;=>
"Dagger, HighPsg, 55000 CR"
;; Age distributions for living characters after service:
(->> make-living-character
(repeatedly 10000)
(map :age)
frequencies
(map vec)
(sort-by first)
vec)
;;=>
[[22 4792]
[26 2401]
[30 1277]
[34 681]
[38 355]
[42 207]
[46 121]
[50 68]
[54 46]
[58 23]
[62 14]
[66 9]
[70 2]
[74 1]
[78 1]
[82 1]
[94 1]]
The Traveller game in all forms is owned by Far Future Enterprises. Copyright 1977 - 2008 Far Future Enterprises. Traveller is a registered trademark of Far Future Enterprises. Far Future permits web sites and fanzines for this game, provided it contains this notice, that Far Future is notified, and subject to a withdrawal of permission on 90 days notice. The contents of this site are for personal, non-commercial use only. Any use of Far Future Enterprises’s copyrighted material or trademarks anywhere on this web site and its files should not be viewed as a challenge to those copyrights or trademarks. In addition, any program/articles/file on this site cannot be republished or distributed without the consent of the author who contributed it.
The code in this repository is Copyright (C) 2012-2015 John Jacobsen, and distributed under the Eclipse Public License, the same as Clojure.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.