Skip to content

universalbit-dev/CityGenerator

 
 

Repository files navigation

CodeQL License: LGPL v3 NodeJS Hyperledger FreeCodeCamp

Web3


Description:
The CityGenerator project focuses on creating dynamic city models inspired by the principles outlined in the Fab City: The Mass Distribution of (Almost) Everything white paper. It aims to provide tools for simulating and visualizing sustainable, self-sufficient, and resilient urban environments.


Key Objectives:

  1. Sustainability: Promote local production and reduce dependency on external resources, aligning with the Fab City framework.
  2. Resilience: Envision cities capable of adapting to environmental, social, and economic changes.
  3. Collaboration: Create open-source tools and models to engage developers, urban planners, and researchers in building decentralized urban systems.

Clone the project

git clone https://github.com/universalbit-dev/CityGenerator.git
cd CityGenerator

Node.js Logo Node.js 22 LTS supported

Install packages with npm then generate your city model

npm i && npm audit fix
npm start

🧠 City Simulation Engine

This project features a smart city simulation powered by artificial intelligence and neural networks.

  • 🌱 Dynamic Growth: An AI agent learns to manage and expand your city—making decisions like building infrastructure or balancing resources.
  • ⏯️ Interactive Controls: Pause and resume the simulation at any time.
  • 🎓 Continuous Learning: The AI improves its strategies automatically as the simulation runs.

For details, see the simulation logic in src/js/index.js.


flowchart TD
    %% UI subgraph
    subgraph UI["User Interface"]
      UIControls["UI Controls (Pause/Resume, Manager Switch)"]
      ManagerInfo["Manager Info Display"]
      StateChart["State Chart (Chart.js)"]
      ActionLog["Action/Reward Log"]
      RewardLog["Reward Log"]
    end

    %% Managers subgraph
    subgraph Managers["City Managers (Modular)"]
      UrbanFabric["UrbanFabricManager"]
      CivicEco["CivicEcosystemManager"]
      Circular["CircularCityManager"]
      SmartCity["SmartCityStateManager"]
      Resilient["ResilientCityModelManager"]
      Commons["CommunityCommonsManager"]
      Permaculture["PermacultureDesignManager"]
      Cookieless["CookielessCityAgent"]
    end

    %% Engine subgraph
    subgraph Engine["Simulation Engine"]
      Init["Initialize City & Agent"]
      DeepQ["DeepQ Neural Agent (deepqlearn.js, convnet.js)"]
      SimStep["Simulate Step (Random/Agent Action)"]
      Update["Manager.update(action)"]
      Stagnation["Stagnation Detection"]
      AutoSwitch["Auto-Manager Switch"]
      RemoveCookies["Remove All Cookies"]
    end

    %% State subgraph
    subgraph State["Simulation State"]
      CityManager["Current CityManager"]
      IsPaused["isPaused"]
      ActionHistory["actionHistory"]
      RewardHistory["rewardHistory"]
    end

    %% UI triggers
    UIControls -- "User selects or triggers" --> Init
    UIControls -- "Switch Manager" --> CityManager
    UIControls -- "Pause/Resume" --> IsPaused

    %% Engine logic
    Init --> DeepQ
    Init --> CityManager
    CityManager --> UrbanFabric
    CityManager --> CivicEco
    CityManager --> Circular
    CityManager --> SmartCity
    CityManager --> Resilient
    CityManager --> Commons
    CityManager --> Permaculture
    CityManager --> Cookieless
    SimStep --> Update
    Update --> StateChart
    Update --> ActionLog
    Update --> RewardLog
    SimStep --> Stagnation
    Stagnation --> AutoSwitch
    AutoSwitch --> CityManager
    RemoveCookies --> UIControls

    %% State updates
    Update --> ActionHistory
    Update --> RewardHistory

    %% UI updates
    StateChart --> State
    ManagerInfo --> State
    ActionLog --> State
    RewardLog --> State

    %% Dependencies (dotted arrows)
    DeepQ -.-> convnet["convnet.js"]
    DeepQ -.-> deepqlearn["deepqlearn.js"]
    StateChart -.-> chartjs["chart.js"]
    UIControls -.-> bootstrap["bootstrap, CSS"]
    UIControls -.-> vis["vis.js"]
Loading

HTTPS Automated Certificate Generation:

  • To simplify the process for users, the project is set up to automatically generate the SSL/TLS certificate and private key required for HTTPS during the npm install process. This eliminates the need for manual certificate creation, streamlining the setup of the HTTPS server.

Fixing Issues:

  • If you encounter any issues with the HTTPS server or certificate generation, refer to the SSL README for detailed instructions and troubleshooting tips.

Draw City

CityGenerator Header

Note: generated using Google Gemini AI.

Resources

Related Resources

Build your Project:


"In a project like CityGenerator, which seems to involve complex features (e.g., blockchain-driven urban designs), managing bundle size is critical for ensuring good performance, especially for web-based applications. Using webpack-bundle-analyzer can help identify and reduce inefficiencies in the build output"

npm run build

About Author of City Map Generator: @probabletrain
Thanks!

Blockchain Integration: Information about integrating with DigiByte and other blockchain environments.

-- DigiByte Integration Guide -- -- Documentation and examples --

Blockchain Environment

-- Workers

Contributing: feel free to make something of amazing.

📢 Support the UniversalBit Project

Help us grow and continue innovating!


License

Distributed under the LGPL-3.0 License. See lgpl-3.0.txt

About

"Fab City and futuristic urban designs: advancing existing concepts with a blockchain-driven approach."

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages

  • JavaScript 72.7%
  • Assembly 9.2%
  • C 6.3%
  • Makefile 4.9%
  • TypeScript 4.5%
  • Shell 2.3%
  • Other 0.1%