neighborly

A narrative-focused agent-based settlement simulation framework.

https://github.com/shijbey/neighborly

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

agent-based-simulation emergent-behavior games procedural-generation python settlement-simulation simulation social-simulation
Last synced: 6 months ago · JSON representation ·

Repository

A narrative-focused agent-based settlement simulation framework.

Basic Info
Statistics
  • Stars: 67
  • Watchers: 5
  • Forks: 2
  • Open Issues: 0
  • Releases: 11
Topics
agent-based-simulation emergent-behavior games procedural-generation python settlement-simulation simulation social-simulation
Created about 4 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md


Neighborly

Neighborly 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 inspired Talk of the Town, another settlement simulation for emergent narrative storytelling research. It also draws inspiration from commercial world-simulation games like Caves of Qud, Dwarf Fortress, Crusader Kings, RimWorld, and WorldBox. 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, please cite this repository. You can read a copy of Neighborly's associated paper that 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.
  • 📈 Uses Polars for fast data analysis.
  • 📜 Export simulation data to JSON.

System caveats

  • Only simulates a single settlement
  • Characters can only hold one occupation at a time.
  • Does not model the exact position of entities.

Try Neighborly without installing

Neighborly is available to use within this sample Google Colab notebook. It contains a basic walkthrough of how to define content for the simulation and inspect the generated data.

Installation

The latest official release of Neighborly is available to install from PyPI.

bash pip install neighborly

Installing for local development

If 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 the editable flag (-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 as black, isort, and pytest.

```bash

Step 1: Clone Repository and change into project directory

git clone https://github.com/ShiJbey/neighborly.git cd neighborly

Step 2 (MacOS/Linux): Create and activate a Python virtual environment

python3 -m venv venv source ./venv/bin/activate

Step 2 (Windows): Create and activate a Python virtual environment

python -m venv venv .\venv\Scripts\Activate

Step 3: Install local build and dependencies

python -m pip install -e ".[development]" ```

Usage

The best way to learn how to use Neighborly is to explore the various samples in the samples directory that demonstrate how to create custom simulations and collect and visualize data. Interactive samples with the .ipynb extension are meant to be run using Jupyter 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.

bash python -m pip install -e ".[samples]"

Then, run the following commands to run the sample scripts or notebooks.

```bash

To run sample scripts, use:

python ./samples/.py

Explore IPython notebooks using Jupyter Lab:

jupyter-lab ```

Plugins

Plugins 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-level load_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 the Plugins section of the wiki.

Tests

Neighborly uses PyTest for unit testing. All tests are located in the tests/ 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 to CONTRIBUTING.md.

```bash

Step 1: Install additional dependencies for tests

python -m pip install -e ".[development]"

Step 2: Run Pytest

pytest

Step3 : (Optional) Generate a test coverage report

pytest --cov=neighborly tests/ ```

Documentation

The best place to find examples of how to use Neighborly is actually in the ./tests directory. There you will find examples of loading content from files, running a simulation, and saving the output to JSON. There is also the Read 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 reports

If 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.

Contributing

Contributions are welcome. Please refer to CONTRIBUTING.md for more information about how to get involved.

License

This project is licensed under the MIT License.

DMCA Statement

Upon 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 love The Simpsons, and I couldn't think of anyone more neighborly than Ned Flanders. If the copyright owner for The Simpsons would like me to take it down, please contact me. The same takedown policy applies to code samples inspired by TV shows, movies, and games.

Owner

  • Name: Shi Johnson-Bey
  • Login: ShiJbey
  • Kind: user
  • Location: Greater SF Bay Area, CA
  • Company: UC Santa Cruz

Ph.D. Candidate in Computational Media at the University of California, Santa Cruz.

Citation (CITATION.bib)

@inproceedings{johnsonbey2022neighborly,
    title = {Neighborly: A Sandbox for Simulation-based Emergent Narrative},
    author = {Johnson-Bey, Shi and Nelson, Mark J and Mateas, Michael},
    booktitle = {2022 IEEE Conference on Games (CoG)},
    pages = {425--432},
    year = {2022},
    organization = {IEEE}
}

GitHub Events

Total
  • Issues event: 7
  • Watch event: 10
  • Push event: 1
Last Year
  • Issues event: 7
  • Watch event: 10
  • Push event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 222
  • Total Committers: 2
  • Avg Commits per committer: 111.0
  • Development Distribution Score (DDS): 0.005
Past Year
  • Commits: 35
  • Committers: 2
  • Avg Commits per committer: 17.5
  • Development Distribution Score (DDS): 0.029
Top Committers
Name Email Commits
Shi Johnson-Bey s****y@g****m 221
Acer Cristea a****a@u****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 16
  • Total pull requests: 29
  • Average time to close issues: 7 months
  • Average time to close pull requests: 15 minutes
  • Total issue authors: 4
  • Total pull request authors: 3
  • Average comments per issue: 0.94
  • Average comments per pull request: 0.0
  • Merged pull requests: 29
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ShiJbey (9)
  • Lucas-Armand (2)
  • jas-ho (2)
Pull Request Authors
  • ShiJbey (24)
  • AcerCristea (4)
  • Acer-Cristea (2)
Top Labels
Issue Labels
enhancement (4) bug (3) help wanted (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 48 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 20
  • Total maintainers: 1
pypi.org: neighborly

A narrative-focused agent-based settlement simulation framework.

  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 48 Last month
Rankings
Downloads: 8.3%
Dependent packages count: 10.1%
Stargazers count: 10.7%
Average: 16.1%
Dependent repos count: 21.6%
Forks count: 29.8%
Maintainers (1)
Last synced: 6 months ago