Skip to content

Conversation

@IgnatiusPang
Copy link

No description provided.

IgnatiusPang and others added 13 commits August 27, 2025 21:48
Documented a phased implementation plan for the simulation project, detailing core phases including Rust simulation, FFI API, Python UI development, and integration.
Added guidelines for Python coding standards, error handling, logging, and debugging.
Added comprehensive coding standards and best practices for Bash and R programming, including guidelines on readability, error handling, logging, and project organization.
This commit introduces the initial migration of the Micropolis simulation core from C to Rust, and sets up a Python FFI layer for a new UI.

The key changes include:
- A new Rust crate `micropolis-rs` with the basic structure of the simulation.
- The main simulation loop (`map_scan`) has been ported from C.
- Data structures have been moved to Rust, using `Vec`s instead of fixed-size arrays to enable serialization.
- A Python FFI layer has been created using `pyo3`, exposing the `Micropolis` class and its methods.
- Save/load functionality has been implemented using `serde` and `bincode`.
- A basic Python UI using the Arcade library has been set up in `micropolis-arcade-ui`.
- The Rust code is tested with unit and integration tests, and the FFI layer is tested with a Python script.
Feature: Initial Migration of Micropolis from C to Rust
feat: Continue migration of game to Rust and Python
feat: Continue migration of game to Rust and Python
This commit implements the core FFI bridge as described in Phase 2 of the project's plan of action.

The following changes were made:
- The `get_map_view` function in `micropolis-rs/src/lib.rs` was modified to accept x, y, width, and height parameters to return a partial view of the map.
- A new static method, `create_city`, was added to the `Micropolis` Python class to provide a consistent API endpoint for city creation.
- The verification script `micropolis-rs/test_wheel.py` was updated to use the new FFI functions and to import the correct `micropolis_engine` module instead of `micropolis_rs`.

All existing Rust tests and the Python verification script pass, confirming the FFI bridge is functional.
Implement FFI Bridge for Rust Engine
Added a reference to the micropolis-rs codebase for development guidance.
As requested, this change updates the `plan_of_action.md` file to include a detailed enumeration of the C files that need to be ported to Rust for Phase 1 of the project. This provides a clear roadmap for the migration work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant