Package: neighborly
NeighborlyNeighborly is an extensible agent-based settlement simulation. It was built to be a tool for emergent narrative storytelling research. Neighborly generates a virtual settlement and simulates the individual lives of its residents over multiple generations. It models the characters' traits, statuses, relationships, occupations, life events, and more. Neighborly tracks all the life events (starting a new job, falling in love, turning into a demon, etc.), and these become the building blocks for creating emergent stories about characters and their legacies. The entire history of the settlement and its generations of characters is then made available for data analysis or as content for other applications such as games.Neighborly's was inspiredTalk of the Town, another settlement simulation for emergent narrative storytelling research. It also draws inspiration from commercial world-simulation games likeCaves of Qud,Dwarf Fortress,Crusader Kings,RimWorld, andWorldBox. It aims to be an easily customizable simulation that can adapt to various narrative settings and support research or entertainment projects.If you use Neighborly in a project, pleasecite this repository. You can read a copy of
Neighborly's associatedpaperthat was published in the
proceedings of the 2022 IEEE Conference On Games. ⚠️Warning: Please note that Neighborly's current structure
differs greatly from the version the paper describes.Core Features🏙️ Procedurally generates a settlement and the history of its residents.🚀 Utilize a low-fidelity social simulation to simulate hundreds of years of world history within minutes.⚙️ Built using an entity-component system (ECS) architecture📦 Plugin system to load and share new content.👔 Characters can start businesses and hold jobs.️🧬 Characters have traits that modify their stats and relationships.❤️ Characters form and cultivate relationships based on romance and reputation.💥 Simulate random life events that spice up characters' lives.⚖️ Define Social Rules for how characters should feel about each other.🏬 Define location preference rules for what locations characters frequent.📈 UsesPolarsfor fast data analysis.📜 Export simulation data to JSON.System caveatsOnly simulates a single settlementCharacters can only hold one occupation at a time.Does not model the exact position of entities.Try Neighborly without installingNeighborly is available to use within thissample Google Colab notebook. It contains a basic walkthrough of how to define content for the simulation and inspect the generated data.InstallationThe latest official release of Neighborly is available to install fromPyPI.pipinstallneighborlyInstalling for local developmentIf you wish to download a Neighborly for local development or want to play around with
any of the samples, you need to clone or download this repository and install
using theeditableflag (-e). Please see the instructions below. This command will install
a Neighborly into the virtual environment along with all its dependencies and a few
additional development and testing dependencies such asblack,isort, andpytest.# Step 1: Clone Repository and change into project directorygitclonehttps://github.com/ShiJbey/neighborly.gitcdneighborly# Step 2 (MacOS/Linux): Create and activate a Python virtual environmentpython3-mvenvvenvsource./venv/bin/activate# Step 2 (Windows): Create and activate a Python virtual environmentpython-mvenvvenv
.\venv\Scripts\Activate# Step 3: Install local build and dependenciespython-mpipinstall-e".[development,testing]"UsageThe best way to learn how to use Neighborly is to explore the various samples in thesamplesdirectory
that demonstrate how to create custom simulations and collect and visualize data. Interactive samples with the.ipynbextension are meant to be run usingJupyter Lab. Please run the following command
to ensure all dependencies are installed for the samples. Make sure that you've activated your Python virtual
environment beforehand.python-mpipinstall-e".[samples]"Then, run the following commands to run the sample scripts or notebooks.# To run sample scripts, use:python./samples/<name_of_sample>.py# Explore IPython notebooks using Jupyter Lab:jupyter-labPluginsPlugins are importable Python modules or packages that add new content to a simulation. They allow users to change
a simulation's behavior without editing the core library code. All plugins should have a top-levelload_plugin(sim)function that gets called to load in the plugin content.As with any piece of software, always express caution when downloading third-party plugins. Ensure they come from a
source that you trust.To read more about plugins, visit thePluginssection of the
wiki.TestsNeighborly usesPyTestfor unit testing. All tests are located in thetests/directory. I
do my best to keep tests updated. However, some tests may need to be
added or updated due to constant breaking changes between releases. If you want to contribute unit tests, please refer
toCONTRIBUTING.md.# Step 1: Install additional dependencies for testspython-mpipinstall-e".[testing]"# Step 2: Run Pytestpytest# Step3 : (Optional) Generate a test coverage reportpytest--cov=neighborlytests/DocumentationThe best place to find examples of how to use Neighborly is actually in the./testsdirectory. There you will find examples of loading content from files, running a simulation, and saving the output to JSON. There is also theRead the Docs. However, the docs has a tendency to be out of date when new, potentially breaking changes are made to the framework. However, unit tests are updated almost every time a new feature is added.Getting help and submitting bug reportsIf you have any questions, feedback, or problems, please create a new Issue. I will do my best to answer as soon as I
can. Please be respectful, and I appreciate your patience.ContributingContributions are welcome. Please refer toCONTRIBUTING.mdfor more information about how to get
involved.LicenseThis project is licensed under theMIT License.DMCA StatementUpon receipt of a notice alleging copyright infringement, I will take whatever action it deems appropriate within its
sole discretion, including removal of the allegedly infringing materials.The repo image is something fun that I made. I loveThe Simpsons, and I couldn't think of anyone more neighborly than
Ned Flanders. If the copyright owner forThe Simpsonswould like me to take it down, please contact me. The same
takedown policy applies to code samples inspired by TV shows, movies, and games.