Civsim is a basic civilisation simulation and modelling system built in Python 3.8.

Related tags

Deep Learningcivsim
Overview

Civsim

Introduction

Civsim is a basic civilisation simulation and modelling system built in Python 3.8. It requires the following packages:

perlin_noise==1.7
termcolor==1.1.0

Features

Currently civsim supports the following features:

  • Terrain generation using Perlin noise (including biomes)
  • Civilisation generation with different priorities and favoured terrain etc
  • Civilisation growth, expansion, stabilisation, destabilisation, collapse, and death
  • Successor states and breakaway states

Todo

  • Diplomacy between nations
  • Possibly some sort of ruler system to see national priorities change over time
  • Playing as a civ?
  • Expanding over water (Independent agents?)

Demo image

Comments
  • Civsim reworked

    Civsim reworked

    Modularized the game to be easier to expand and maintain Fixed bugs Added scsm for versioning Added setup.py with scripts to launch the game

    Changes:

    • Deleted unused conditions from .gitignore
    • Restructured folders as follow:
      • civsim main file removed to create a project structure oriented folder( civsim is the name of the project):
        • setup.py: inits game, loads config file and starts game_master instance)
        • game_master: controls world generation, civilization generation, game loop and display
        • scmversion: for automatic versioning (not finished configuring yet)
        • version: it takes the version from scmversion which is automatically generated when you run setup and install the project
        • config: game configuration parameters, logo, log url (in the future I plan to create a configuration class)
        • module civ:
          • civ: class with the class method born_civ, class variables civ_ptr (pointer) and the instance methods actions (previous name execute), registry(previous name update (reasoning kingdom do an annual registry so it's kinda a better name looking into what update does)) expand, collapse, disslove. Renamed symbol to emblem as kingdom, countries have emblems
          • constants
          • utils: scan method was not necessary anymore (scan functionality without delete was never used as you can check if something is inside a list directly so I renamed it to sweep the land and not it is only used for delete), updated findciv and renamed to find_civ
        • module world:
          • world: class with all the world and civilization grid stuff
          • constants
          • utils: messy_noice method
        • third rpgtools library was moved here and the .gitmodule command updated to point here
        • scripts
          • version: returns game version
          • run: runs the game (it support parameters like --debug, --seed and --age (--seed and --age are a proof of concept yet, looking into expanding debug and adding a profiler to measure times))
          • utils: argument parser class for commands
    • In order to install the game you only need to clone the repository and in the root folder GitHub\civsim just use the command pip install -e . . the game will proceed to install the directory package and submodules and all the needed third party libraries from the requirements.txt file. If the game is already installed it will uninstall the old version first and update dependencies if any. It is recommended to install the game inside a virtual env with the commands $python3 -m venv . $ . bin/activate or Scripts\activate.bat(window). This approach allows to use effectively absolute imports and it allows to upload civsim to pip in the future. Finally run the game with civsim-run.
    • Renamed readme.md to README.md following conventions (LICENSE and CONTRIBUTION are missing btw I can create an issue requesting that later)
    • Added game_master class which instantiate world and civilisation class, saving the instances into dictionaries, after seeding the first civilisations it continues with the while loop game until year is equal to age.
    • Improved player initialization concept with cpu=True variable by default
    • Images moved to docs so all the project information is together. CHANGELOG.md added (there is a program which creates automatic changelogs but I need to tune in yet)
    • Changes on civ class:
      • make_civ renamed to born_civ
      • renamed civletter to civ emblems
      • Fixed bugs on collapse, expand and dissolve methods (I can explain this in further details tomorrow) but random.choice was replaced by sample to avoid taking the same tile in the foor loop and there was inconsistencies with dead civilisations (collapse takes all the territories of a civilization but dissolve method was not called until the next iteration), finally civilisation was trying to be created (collapse and dissolve) but failing because no more civ emblems were available (for example if only emblems ZX are availables and civ A collapses with 5 territories and the 5 of them try to create a civ only the 3 first can do it, this could creates phantom expand method calls crashing the game)
    • Added reason why civ is collapsing for a nature disaster (placeholder I plan to expand it to a weather class and checking the biome before hand to avoid drought on snow biomes unless we have global warming ofc)
    • Optimized _priorities array generation: (in general two for loops should be avoided complexity O(n2) but same times is not possible) for priority array I could improve the performance using only one loop and a bit of magic

    This is a first draft I didn't have time to polish all the methods and optimize then but I tested the two game modes and I believe no bugs were left, the game was tested 20 or 30 times. Logs over all the game were improved to be more helpful and some try catch added for debugging. BTW I recommend using ipdb; ipdb.set_trace() for execution time debugging you just need to install it with pip.

    There seems to be lot of changes but mostly the code it the same just structured to be project friendly, added setup so people can just use pip install, optimizations and bugs related with the class oriented approach or legacy bugs. The project folder update was the most important thing to do as the project would quickly grows unmanageable without it and the class oriented concept is desired for games.

    I have a trello with ideas I can share with you, I think you have plenty of good ideas with they way you are developing the game, can't wait to see what you do with language. One of the first thing I would like to do is optimizing probably adding numpy, adding automatic testing, improve debug mode, finish automatic versioning, update README.md

    Name for all the method classes can be discussed if you prefer one over another

    I added your last changes to the civilisation class (language and name) but I disabled them (commented) because I got an error OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory. in the file github\civsim\civsim\third\rpgtools\subject_verb_object_extract.py maybe you can point out to me if this is a bug or I did something wrong.

    Sorry for the long post feel free to check all the files and discuss doubts or improvements!

    opened by kafkaphoenix 6
  • Add a Makefile for convienience

    Add a Makefile for convienience

    Changes:

    Add Makefile

    • Easier to interact with project

    Modify Readme

    • Include instructions for using Makefile
    • Edit list of dependecies

    Add .gitignore

    • Force git to ignore virtual environment and unwanted python files
    opened by ghost 4
  • Restructured folder project and fixed imports

    Restructured folder project and fixed imports

    Restructured project to git standard imports should load only the method they are using powerbase -> base_power added missing license, contributing and changelog files Added constants for COMMONS_WORLD_PATH, LANG_STRUCT_PATH Simplified planet init logic

    opened by kafkaphoenix 1
  • Bug fixes, optimization and miscellanea

    Bug fixes, optimization and miscellanea

    • Added rpgtools to git ignore
    • Added spacy requirement to requirements.txt
    • Removed rpgtools.py as civsim.py is using the submodule now
    • Added ignore=dirty to .gitsubmodule to avoid submodule noise
    • Removed unused gitignore options
    • Optimized civilisation priorities generation
    • Moved in the update method scan method inside if territory check to avoid unnecessary calls
    • Added :.2f in the execute method for strings power, technology level and instability to avoid lot of decimals
    • make_civ now returns the instance
    • Fixed bug: collapse and dissolve methods were creating civilisations in the same spot overwriting previous one (choice(can repeat) > sample (can't repeat))
    • Fixed bug: dissolve was creating civilisations and expanding at the same time but sometimes it would crash when calling expand as the civ could not be created (max civ limit)
    • Fixed bug: all civ created by dissolve method will expand at the end to avoid one civ expanding over other candidate before being created
    opened by kafkaphoenix 1
  • Improvements

    Improvements

    Hi I think you should move civilization and world to their own classes using a "manager" class to store the instances and execute the actions you are currently doing in the main method, that way it would be easier to modularize the code and improve readability. I can help with that if you are interested. Cheers

    opened by kafkaphoenix 1
Releases(v0.8)
  • v0.8(May 24, 2021)

    Civilisations, settlements, history, and most of the modelling behaviour have been completed. Any further improvements will be strictly to improve the fidelity of the simulation (for example: sea-based expansion, diplomacy) rather than to improve the base output of the simulation itself.

    Source code(tar.gz)
    Source code(zip)
  • v0.1(May 9, 2021)

Towards Interpretable Deep Metric Learning with Structural Matching

DIML Created by Wenliang Zhao*, Yongming Rao*, Ziyi Wang, Jiwen Lu, Jie Zhou This repository contains PyTorch implementation for paper Towards Interpr

Wenliang Zhao 75 Nov 11, 2022
RealFormer-Pytorch Implementation of RealFormer using pytorch

RealFormer-Pytorch Implementation of RealFormer using pytorch. Includes comparison with classical Transformer on image classification task (ViT) wrt C

Simo Ryu 90 Dec 08, 2022
CDGAN: Cyclic Discriminative Generative Adversarial Networks for Image-to-Image Transformation

CDGAN CDGAN: Cyclic Discriminative Generative Adversarial Networks for Image-to-Image Transformation CDGAN Implementation in PyTorch This is the imple

Kancharagunta Kishan Babu 6 Apr 19, 2022
Clockwork Variational Autoencoder

Clockwork Variational Autoencoders (CW-VAE) Vaibhav Saxena, Jimmy Ba, Danijar Hafner If you find this code useful, please reference in your paper: @ar

Vaibhav Saxena 35 Nov 06, 2022
Deep Reinforced Attention Regression for Partial Sketch Based Image Retrieval.

DARP-SBIR Intro This repository contains the source code implementation for ICDM submission paper Deep Reinforced Attention Regression for Partial Ske

2 Jan 09, 2022
Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt)

Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt) Task Training huge unsupervised deep neural networks yields to strong progress in

2 Aug 05, 2022
Unofficial reimplementation of ECAPA-TDNN for speaker recognition (EER=0.86 for Vox1_O when train only in Vox2)

Introduction This repository contains my unofficial reimplementation of the standard ECAPA-TDNN, which is the speaker recognition in VoxCeleb2 dataset

Tao Ruijie 277 Dec 31, 2022
EqGAN - Improving GAN Equilibrium by Raising Spatial Awareness

EqGAN - Improving GAN Equilibrium by Raising Spatial Awareness Improving GAN Equilibrium by Raising Spatial Awareness Jianyuan Wang, Ceyuan Yang, Ying

GenForce: May Generative Force Be with You 149 Dec 19, 2022
Multi-Scale Aligned Distillation for Low-Resolution Detection (CVPR2021)

MSAD Multi-Scale Aligned Distillation for Low-Resolution Detection Lu Qi*, Jason Kuen*, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya J

Jia Research Lab 115 Dec 23, 2022
Paddle implementation for "Cross-Lingual Word Embedding Refinement by ℓ1 Norm Optimisation" (NAACL 2021)

L1-Refinement Paddle implementation for "Cross-Lingual Word Embedding Refinement by ℓ1 Norm Optimisation" (NAACL 2021) 🙈 A more detailed readme is co

Lincedo Lab 4 Jun 09, 2021
Code for "Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search"

Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search This is an implementation for our paper Contextual Non-Loca

Tencent YouTu Research 50 Dec 03, 2022
Cross-Document Coreference Resolution

Cross-Document Coreference Resolution This repository contains code and models for end-to-end cross-document coreference resolution, as decribed in ou

Arie Cattan 29 Nov 28, 2022
Online Multi-Granularity Distillation for GAN Compression (ICCV2021)

Online Multi-Granularity Distillation for GAN Compression (ICCV2021) This repository contains the pytorch codes and trained models described in the IC

Bytedance Inc. 299 Dec 16, 2022
Using pretrained language models for biomedical knowledge graph completion.

LMs for biomedical KG completion This repository contains code to run the experiments described in: Scientific Language Models for Biomedical Knowledg

Rahul Nadkarni 41 Nov 30, 2022
This game was designed to encourage young people not to gamble on lotteries, as the probablity of correctly guessing the number is infinitesimal!

Lottery Simulator 2022 for Web Launch Application Developed by John Seong in Ontario. This game was designed to encourage young people not to gamble o

John Seong 2 Sep 02, 2022
Training PSPNet in Tensorflow. Reproduce the performance from the paper.

Training Reproduce of PSPNet. (Updated 2021/04/09. Authors of PSPNet have provided a Pytorch implementation for PSPNet and their new work with support

Li Xuhong 126 Jul 13, 2022
Zero-shot Learning by Generating Task-specific Adapters

Code for "Zero-shot Learning by Generating Task-specific Adapters" This is the repository containing code for "Zero-shot Learning by Generating Task-s

INK Lab @ USC 11 Dec 17, 2021
Building Ellee — A GPT-3 and Computer Vision Powered Talking Robotic Teddy Bear With Human Level Conversation Intelligence

Using an object detection and facial recognition system built on MobileNetSSDV2 and Dlib and running on an NVIDIA Jetson Nano, a GPT-3 model, Google Speech Recognition, Amazon Polly and servo motors,

24 Oct 26, 2022
WHENet - ONNX, OpenVINO, TFLite, TensorRT, EdgeTPU, CoreML, TFJS, YOLOv4/YOLOv4-tiny-3L

HeadPoseEstimation-WHENet-yolov4-onnx-openvino ONNX, OpenVINO, TFLite, TensorRT, EdgeTPU, CoreML, TFJS, YOLOv4/YOLOv4-tiny-3L 1. Usage $ git clone htt

Katsuya Hyodo 49 Sep 21, 2022
This repo contains the code for the paper "Efficient hierarchical Bayesian inference for spatio-temporal regression models in neuroimaging" that has been accepted to NeurIPS 2021.

Dugh-NeurIPS-2021 This repo contains the code for the paper "Efficient hierarchical Bayesian inference for spatio-temporal regression models in neuroi

Ali Hashemi 5 Jul 12, 2022