Skip to content

V0.1.0

Warning

The notes below are the contents of my Captain's Log private notion page until I switched back to using markdown logs like this. No substantive work was completed between February 9, 2024 and August 4, 2024.

February 9, 2024#

Summary#

Notes#

To Do#

  • [ ] Define my coordinate system for world space.
    • [ ] Choose a real coordinate frame
    • [ ] Illustrate the coordinate frame
  • [ ] Add UI to debug spatial settings
    • [ ] Embed a Coordinate Frame Gizmo to debug and visualize the home coordinate frame for the selected entity
    • [ ] Add UI to show the coordinates and other stats of the selected entity
  • [ ] Add UI for time controls.
    • [ ] Make time a Bevy resource
    • [ ] Make time scale with the space component?
    • [ ] Add controls for setting a specific timestamp and/or speeding up or slowing down time.
  • [ ] Implement big_space
    • [ ] Donā€™t forget to add debugging to see an entityā€™s gridcell frame gizmo and which gridcell is active

January 31, 2024#

Summary#

  • structure.Group

Notes#

Floating-Point Precision:Be aware of floating-point precision limitations for large coordinates.Consider using double-precision (f64) if higher precision is needed, but be cautious about potential performance impacts.Transform Hierarchy:Use Bevy's transform hierarchy to organize entities in a hierarchical structure.Group related entities under a parent entity to simplify transformations.Spatial Partitioning:Implement spatial partitioning techniques like octrees or BVH (Bounding Volume Hierarchy) to optimize collision checks and queries.Coordinate System Choice:Choose a coordinate system that suits your world.Consider using local coordinate systems for smaller regions within the world.

January 30, 2024#

Summary#

Notes#

https://youtu.be/dhYqflvJMXc?si=9HrypOeO9ZWxEaKL

Represent bodies as particles (like gpu particles). White means synced with ref. Redder for slower blue for faster green lines show comms connections.

January 28, 2024#

Summary#

Notes#

Glam for linear algebra: https://github.com/bitshifter/glam-rs

Bevy already includes glam for its backend.

I think I can use Barnes hut algorithm to have a dynamic mesh resolution forā€¦ something. I don't think it makes sense for the potential field.

https://youtu.be/MXs_vkc8hpY?si=FpgzSBaSqDlu1Xuh

January 25, 2024#

Summary#

Notes#

Use vulkan's normal use case for RGB arrays but where each channel is a float representing x y z potential field. Potentials are additive so most of the same logic applies right

https://youtu.be/GjbcvqEOIuE?si=s-hhpE3hlNsU4gUt

January 21, 2024#

Summary#

Notes#

I can animate rotating earth and moon with emojis šŸ˜®

https://youtu.be/neyIpnII-WQ?si=Dr3Vc6ri28-d7cSy

Use bevy_mod_debugdump to debug bevy schedule

January 19, 2024#

Summary#

  • https://github.com/philiplinden/clocss-abm/pull/15

Notes#

Making a few decisions that I might regret:

  • Iā€™m sold on using Rust. For that reason, Iā€™m going to cut back on bloat that was used to beautify documentation from the Python demos.
  • Instead of documented Python projects, just use iPy notebooks converted to HTML.
  • Move other Python project management fluff to a subdirectory to hide it from the root.

https://youtu.be/5zlfJW2VGLM

January 18, 2024#

Summary#

Notes#

The simulation itself should be a ā€œserverā€ that tracks the data of all entities, or at least the things that we want to measure or are needed to interact.

The UI should be basically a viewport that renders what is happening, but the simulation can be run ā€œheadlessā€ without the UI.

For example, the client will only spawn nearby entities. Spawned entities don't actually hold their physics and such, instead they just display those properties that are tracked by the server plus other fluff.

https://youtu.be/EFzFHrzIiz8?si=D1atEfadNlbkHV9s

January 17, 2024#

Summary#

Notes#

https://fyrox.rs/ might be easier to work with than Bevy. https://www.reddit.com/r/rust_gamedev/comments/v7svhg/bevy_or_fyrox_for_3d_game_development/

https://www.reddit.com/r/rust_gamedev/s/RNkEg0BA0N

January 15, 2024#

Summary#

  • https://github.com/philiplinden/clocss-abm/pull/13

Notes#

Spent some time reading through https://discovery.ucl.ac.uk/id/eprint/1464288/ The author accepted my linkedin connection request and message. I should talk to them.

The repo is getting cluttered with my stumblings through Bevy. I would really like to modify the particulars examples to include time dilation.

Right now the script tries to replicate the ring formation example and the ring debris just flies off into space. Ha, turns out that was just because i forgot to add the Particular plugin to the app.

I think Iā€™m going to play with building an asset server so I can make the central body look like Earth and the ā€œdebrisā€ to look like satellites.

Nevermind. Instead, I will try to simplify the crate so I can explain every element. So I will either delete or re-write every piece so thereā€™s no plagiarized code.

Eventually Iā€™ll have to deal with the physics scale. Itā€™s not meant to run at astronomical scales so Iā€™ll want to have some sort of scale factor in there. Rapier has this built-in, but Iā€™m not really sure how to use it. Itā€™s didnā€™t seem to do anything when I used the particular physics.

Iā€™m going to use pocket solar system as my base instead of ring formation now that Iā€™m more familiar with bevy.

I got the pocket solar system working, and reorganized things a little bit.

January 11, 2024#

Summary#

Notes#

I think I figured out the problem with my time dilation calculations.

Dt/DC = math right? So for every delta tc, math * delta tc happens .

Delta_t = delta_tc * sqrt(1 - v^2/c^2)

So what If v=0? Delta_t=delta_tc

But think about our question ā€œ for every 1 day of my time, how much different is their time?ā€

Gamma = sqrt(1 - v^2/c^2) ā†’ as ve approaches c, gamma approaches zero. This is why ā€œtime stops ā€œ at the event horizon where black hole ve = c, and also why time slows down as you approach c. So gamma is always POSITIVE to indicate SLOWER proper time.

We have dilation from gravity expressed in terms of speed (Gamma U) and dilation from speed (Gamma K) both acting on an object. So how do we combine them?

Let's be extra verbose so we can think in terms of delta_tc with some intuition

Let's say I'm on earth moving at earth rotation. Compared to some far away coord time my proper time is delta_tc * (gammaU1 + gamma k1)

For a satellite, there's less potential but maybe more speed. U1 > U2, K1 < K2. Satellite proper time is delta_tc * (gammaU2 + gammaK2)

What is the difference between earth time and satellite time?

Diff when earth observes sat = delta_tc * (gammaU1 + gammaK1) - delta_tc * (gammaU2 + gamma K2)

Diff = delta_tc * (earth relativistic factor - sat relativistic factor)

If sat on ground, diff = 0. If sat relativistic factor > earth, diff is negative (sat has slower time) if sat relativistic factor < earth, diff is positive (sat has faster time)

So the diff per unit tc is (self relativistic factor - other relativistic factor)

But the velocity is relative speed between them.

TDiff per unit c is [sqrt(1-2GM/c^2r_self) + sqrt(1-(vself - vframe)^2/c^2)] - [sqrt(1-2GM/c^2r_other) + sqrt(1-(vother - vframe)^2/c^2)], where vframe is the velocity of self vs reference frame

There is no gamma k for the observer if ref frame is same as observer body frame since Kinematic dilation is calculated relative to speed vs reference frame

If precision is an issue especially with unit conversion, try to separate order of mag

Example

1e-12 * 2e8 ā†’ (1*2) * 10^(-12+8)

January 9, 2024#

Summary#

Notes#

https://youtu.be/9lBvUr2wcdw?si=U4WhrDhKN7qBmYdV

https://youtu.be/G-IuH6R-yD8?si=5LLM_jhidtDOtVLh

Todo

  • [x] Write a dev diary summarizing all that I've learned in December, put it on obsidian.
  • [x] Try to recreTe Wikipedia plots using only these equations

January 7, 2024#

Summary#

Notes#

January 1, 2024#

Summary#

Notes#

5.3 Time Dilation - University Physics Volume 3 | OpenStax

Introduction | Meshtastic

Time and Relativity

December 31, 2023#

Summary#

Notes#

This paper was helpful in understanding the characteristics of clock noise and their relationship to allan variance, but wasnā€™t helpful in making my own model. https://iafastro.directory/iac/paper/id/77319/summary/

I friended the author of the 2023 paper on linkedin, cannot find any other method of contacting them.

This thesis looks interesting. Time to read more https://discovery.ucl.ac.uk/id/eprint/1464288/

https://youtu.be/ZdrZf4lQTSg?si=B9vzCB2VMHFsS8_F

https://www.figma.com/file/6G93vpzZWfPtWJvmbPw69m/coord-frames?type=whiteboard&node-id=0-1&t=eA9ZhtsP3bilCF4z-0

December 30, 2023#

Summary#

Notes#

I think I got distracted. Understatement of the year. Itā€™s time I focus myself on the real task at hand: modeling heterogeneous lunar networks. Forget bevy, nyx, krabmaga, egui, or any of that for now. I should be able to get by with just logging. Pull only the pieces I need, when I need them. For example, if I need to tick a simulation at a regular interval, I can use krabmaga. If I need to visualize something, egui plots are nice but honestly exporting to a CSV is just fine.

I wrote out a blueprint for the model and have not implemented any of it yet. Come on.

I stripped out (most of) the boilerplate, so all that remains is a struct to manage the simulation state, and a struct that manages each nodeā€™s state. This is all I should need to have a discrete-time simulation. Every step represents one time step.

Now to create components that belong to a node. Iā€™ll start with timing. Each node has a clock to make observations of the time. It is not perfect, and it has limited precision and drift. First Iā€™ll implement an ideal clock, then give it some Allan variance.

Clock Characterization

I am having a lot more trouble creating a virtual clock than I thought I wouldā€¦

December 29, 2023#

Summary#

Notes#

Iā€™m not procrastinating, I swear. Today I want to play with examples and try modding them.

  1. I want to mod the particular demo so that particles change their color upon colliding.
    1. Particles stick together when colliding as a rigid body to form a cluster. Angular and translational momentum is conserved.
    2. Under the hood, assemble an undirected graph between all particles in a cluster.
    3. The colliding particles should assume the color of the larger particle. If equally sized, assume the color of the particle with a higher rank in the graph of connected particles. If still equal, randomly choose one of the particles to use for color reference.
  2. Mod the virus on network krabmaga example to demonstrate emergent NTP stratified hierarchy.
    1. Designate one node as the Stratum 0.
    2. Display the stratum of each node using an emoji sprite (use number emojis instead of dots).

December 27, 2023#

Summary#

Notes#

How does NTP Clock Discipline work?

December 26, 2023#

Summary#

  • Updated docs about ECS and model arch.
  • Added comments and code to help me remember whats what.

Notes#

It clicked with me recently how and why krabmaga and bevy do what they do. This page really helped: https://krabmaga.github.io/#architecture

https://krabmaga.github.io/images/krabmaga-arch.jpg

December 19, 2023#

Summary#

Notes#

Ashley was able to follow the marcopolo rust demo and reproduce the results!

December 18, 2023#

Summary#

Notes#

https://youtu.be/zUvHkkkrmIY?si=8jr4noblga7eWj_F

https://youtu.be/1zucERQjg0Q?si=UH1s-E82WZs7XCkE

December 17, 2023#

Summary#

  • Got marco polo working in rust.

Notes#

Digging in to krABMaga (again) based on Concepting Round 2 based on the template. I am going to omit ALL visualizations for now, maybe except for TUI components.

Iā€™m starting with Marco Polo again, this time in Rust.

It works! https://github.com/philiplinden/clocss-abm/pull/8

Next stop: time dilation.

https://www.youtube.com/watch?v=G3LpgY3vckg

December 13, 2023#

Summary#

Notes#

https://www.researchgate.net/publication/280875893_Simulating_Dynamic_Time_Dilation_in_Relativistic_Virtual_Environment

https://github.com/build-trust/ockam

December 11, 2023#

Summary#

Notes#

This might be a good option for deploying a web demo: https://www.shuttle.rs/

This might be helpful too

https://github.com/evenfurther/pathfinding

Feedback from AeroRust

  1. https://cdn.discordapp.com/avatars/177527931755560960/49d1e5ab966a817a091910c4903b34d5.webp?size=80

    philDecember 8, 2023 6:04 PMDecember 8, 2023 6:04 PM#

    I want to do a simulation that progresses "tick by tick" as objects move around the solar system. I originally was looking at agent based models like krabmaga but bevy seems like a reasonable way to handle things using ECS. Is there any disadvantage to using Bevy as a simulation engine? Like are there caveats related to accuracy that might screw me over?

  2. December 8, 2023 6:04 PMDecember 8, 2023 6:04 PM*December 8, 2023 6:04 PM*

    In particular, I'm trying to simulate clocks drifting in orbit. The most basic example is GPS satellite clocks drifting from UTC due to time dilation and hardware precision.

  3. December 8, 2023 6:05 PMDecember 8, 2023 6:05 PM*December 8, 2023 6:05 PM*

    Any advice?

December 9, 2023

  1. Accuracy? That'd mostly be up to your implementation. There areas you're probably going to have trouble with Bevy:

    https://cdn.discordapp.com/avatars/260277767747272707/2c2418c6eaedc9b87b3798e2697f4c8d.webp?size=80

    mirashiiDecember 9, 2023 10:45 AMDecember 9, 2023 10:45 AM#

    • The whole system and rendering setup are really, really assuming that you're writing a game. That means running your simulation at a target tick rate per second, where usually you want simulations that can run as many ticks as possible per unit time. Unfortunately Bevy's frame rate control API is still kinda half baked.
    • Bevy's ECS does not support ordered iteration over ECS queries. That makes determinism a lot more difficult.
    • Bevy does not provide a good deterministic RNG, you'll need to manage that yourself.
    • There's generally a lot of down-configuration you'll need to do to disable features. Parallel system execution comes to mind. I'm sure there are others.

December 10, 2023#

https://media2.giphy.com/media/Tfx7OZvJqauaI/giphy.gif?cid=7941fdc6duiew7486d02va4i27xx1i9kwva43g8q2lt33vq2&ep=v1_gifs_search&rid=giphy.gif&ct=g

Summary#

  • Created a 3D scene with to-scale Earth, Luna, and a satellite in Bevy
  • Found and fixed a few bugs in my assets: https://github.com/philiplinden/clocss-abm/pull/7
  • Got comfortable with Bevy enough to know why it's not time to use it.

Notes#

Iā€™m following this excellent ā€œbevy basics in 0.12ā€. There are a few issues related to just adapting the downloaded assets to how I expect them to be, like the coordinate frames.

Iā€™m running into some basic 3D modeling snags, like the coordinate frames and scales of the models not being consistent. Iā€™ll deal with this eventuallyā€¦ https://github.com/philiplinden/clocss-abm/issues/4

Iā€™m a visual person, so I feel like I need something on-screen to tell me if things are working.

  • Camera coordinates:Ā 0.0, 1.0E5, 1.0E9
  • Satellite coordinates:Ā 0.0, 1.0E5, 0.999999E9Ā (right in front of the camera)
  • Earth coordinates:Ā 0,0,0
  • Luna coordinates:Ā 384_400.0E3, 0.0, 0.0

2023-12-11T01:59:56.229636Z INFO clocss_abm::cosmic: Spawning "Luna": Radius 1737400.0 m, Mass 7.342e22 kg 2023-12-11T01:59:56.229636Z INFO clocss_abm::cosmic:

Bevy isn't ready for astronomical scales unless we scale it. That and Bevy was making compile times way too bloated. I'm glad I played with Bevy enough to understand what's happening, but it's not the time to mess with it.

krABMaga is also an ECS framework so the high level concepts still apply. It was nice to learn from Bevy because there is such a rich ecosystem of documentation and plugins to lean on.

If I need spatial behavior, let's keep it small and mimic the Flockers or ant farm examples to attach the clock and radio components to. For fun we can use a Rover model so it doesn't look funny.

I'm saying this for the nth time but I need to step away from the spatial physics.

December 9, 2023#

Summary#

  • I asked ChatGPT for help. Helped a surprising amount.
  • Concepting Round 2
  • Found nice open source typefaces.
  • Implemented some hello world Bevy scenes, more or less from scratch.

Notes#

Hereā€™s where the chat started:

https://chat.openai.com/share/570a9388-9cae-42c9-95a2-23bb2a7021b6

Turns out ChatGPT doesnā€™t know Bevy very well. None of its code compiled. Itā€™s a useful reference, but not a cheat code.

I found some great open-sourced typefaces and added them to the repo.

Got an FPS counter working from an example. First UI!

Iā€™m not using Particular or Nyx (yet?) since itā€™s pretty simple to set up a hello world physics scene with Rapier. I think I might be able to borrow from Particular without actually implementing its higher level functions. I have a feeling Iā€™ll end up kit-bashing my own physics engine from Nyx, Particular, and Rapier.

Took 8 hours but I have a Rust prototype that compiles and renders a scene, interactive camera, and fps counter. Plus GitHub actions to build and test with cargo. šŸ˜Ž https://github.com/philiplinden/clocss-abm/pull/3

December 7, 2023#

Summary#

  • There's a lot I don't know, and I should stop wasting time on the orbits since that's a solved problem.

Notes#

I'm spinning my wheels worrying about orbits. I have two physics engines that can handle that (particular and nyx). But there are more problems I have to figure out:

  1. When does a node try to sync it's clock?
  2. How does PTP work?
  3. Given two stationary nodes, can I model a network of time appliances?
  4. Can I model Doppler shifted radio signals?
  5. Does nyx account for time dilation in different gravity wells and speeds or is the epoch always the "god observer" epoch, not a spacecraft's observed epoch? No
  6. Could I model time dilation? https://www.researchgate.net/publication/280875893_Simulating_Dynamic_Time_Dilation_in_Relativistic_Virtual_Environment
  7. Can I model the onboard clock of a fps sat?
  8. Can I model PNT to a ground target from GPS?

December 4, 2023#

Summary#

Notes#

An example of someone writing a ā€œcellular automatonā€ with Rust+Bevy

https://youtu.be/rOFlUvMfOHQ

I started working with bevy from scratch to learn. I expect things to be replaced as I learn.

https://www.youtube.com/playlist?list=PL2wAo2qwCxGDp9fzBOTy_kpUTSwM1iWWd

I have a good feeling about NICT as a possible partner on the STP project! šŸ”œ

Unfortunately I don't think I'll be able to use particular or nyx as ā€œbatteries includedā€ like they were intended. I worry that particular won't work in 3D, and I worry that I won't be able to run nyx as the physics engine. I'll have to get clever. For now, Iā€™ll stick to 2d with particular until I get the agents going. Fake physics to demo the behavior, like Kerbal Space Program is to the real solar system.

December 3, 2023#

Summary#

  • Started coding in rust.
  • Refined the Model Requirements.
  • Decided to keep working on a Nyx visualization as a Rust warm-up.
  • Changed my mind about Nyx as a warm up.
  • Moved some things from the requirements doc to Concepting Round 1

Notes#

At first I thought it would be relatively easy to wedge ABM agents into an n-body space at let them run wild. The problem is that krABMaga and particular both define physics and simulation updates, so itā€™s not obvious whether I should put a krabmaga agent in a particular nbody space, or if I should hack the nbody physics into a krabmaga example.

One drawback to krabmaga is that the crate only ships with 2D or network spaces, no 3D spaces. That said, I think I can use the implementations and traits of the 2D space to make it 3D (with the nyx physics backend) and then mix the network space on top, like an overlaid space.

Iā€™m still going to try to mix nbody physics with one of the krabamaga examples. Iā€™m thinking ants foraging in space would be fun to watch.

On second thought, Iā€™m going to focus on implementing Nyx types and physics in the krabmaga framework. I think that will save time later because Iā€™ll do less rewriting, but still move me forward. Besides, most of the traits of my agents assumes theyre in space right?

Hm, if Iā€™m just using Nyx for physics and making a bevy viewport, thatā€™s just a Nyx visualization. I guess with Model Requirements written up it would help to start the visualization to think things through and learn Rust, basically as a warmup.

Iā€™m too green to learn by modifying an example. I need to build something from scratch in order to learn. Iā€™m going to try to recreate the particular demo from scratch so I know whatā€™s going on. Then, when my version is shitty and barely works, Iā€™ll go back to the example and shim in my ideas.

This video really hits home, by the way.

https://youtu.be/OoJsPvmFixU?list=TLPQMDMxMjIwMjMCT2AN_8zlkQ

So starting from the bottom, I need to define an Agent, and a Field for it to live in or move around in. Right now thereā€™s only ā€œbatteries includedā€ for 2D fields and/or networks. I might need to implement my own ā€œspaceā€ by applying the Field trait to the nyx orbit space.

I really like the macros that krabmaga provides with respect to plotting and logging to the TUI that starts up when the simulation starts. Itā€™s a little cumbersome but a good source of inspiration.

Nyxā€™s focus on LEO and ā€œrealā€ orbits is really getting in the way. I want to just let the sandbox go. Iā€™ll relax my thinking a bit and chill. I like the idea of making a ā€œgameā€ that happens to show us what we want. So I think the best approach is to use krABMaga for instrumentation of the system, and to track the state. Thatā€™s what itā€™s good at, anyway. I think Particular as a plugin to Bevy is sufficient for the physics for now. I mean yeah nyx would be nice (and accurate) but idk right now i want the behaviors to manifest properly. Hopefully I can build it in a way that lets us swap physics engines easily. That would be nice.

I said I was going to spend more time in the ā€œdesignā€ phase so I should hold myself to it: Concepting Round 1 has some diagrams and other things. Iā€™m trying to apply the ā€œentity-component-systemā€ (ECS) way of thinking to the problem. This is how Bevy works but in general I think it suits the model and ABM too. For example, the only difference between a rover and a satellite is their trajectories, so they would just use different physics traits.

November 30, 2023#

Summary#

Notes#

I had a chat with Christopher Rabotin about his experience with Nyx and Rust and how it fits in with my goals for this model. The gist is that Rust works really well if you have a clear idea for what you want the system to do, but not well if youā€™re exploring how your system will work. Well, I already have like 4 pages of docs on how it should work. Check. The next thing is that we donā€™t have a hard time constraint. This benefits me because I want to learn. The last thing is that Nyx was built to solve the problem of modeling a link between LRO and CAPSTONEā€”that is the mvp mission profile Iā€™d want to simulate. Weā€™re doing it. LFG.

I copied the template project for krABMaga and it compiles and runs. When run without options, it has a really handy TUI, and it spawns a Bevy app if run with --features visualization. I added some assets from Rust Resources.

ā”‚ clocss-abm (oxidize)  via šŸ¦€ v1.74.0 
ā””> cargo run                                         
   Compiling clocss-abm v0.1.0 (/home/phil/repos/philiplinden/clocss-abm)
    Finished dev [unoptimized + debuginfo] target(s) in 1.96s
warning: the following packages contain code that will be rejected by a future version of Rust: nom v1.2.4
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
     Running `target/debug/clocss-abm`
ā”‚ clocss-abm (oxidize)  via šŸ¦€ v1.74.0 
ā””> cargo run --features visualization                
   Compiling clocss-abm v0.1.0 (/home/phil/repos/philiplinden/clocss-abm)
    Finished dev [unoptimized + debuginfo] target(s) in 12.63s
warning: the following packages contain code that will be rejected by a future version of Rust: nom v1.2.4
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
     Running `target/debug/clocss-abm`
2023-12-01T06:34:19.673737Z  INFO log: Guessed window scale factor: 1    
2023-12-01T06:34:19.803621Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) UHD Graphics 620 (KBL GT2)", vendor: 32902, device: 22807, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.2.1-1ubuntu3", backend: Vulkan }

November 28, 2023#

Summary#

  • Did yet another docs reorg to separate python code from future rust code.
  • Stole some code from another rust example.

Notes#

In preparation for exploring rust, Iā€™ve made the docs more explicit about what is the ā€œrealā€ model and other demos and learnings.

The next goal is to get the Particular solar system demo using Nyx as a trajectory backend.

  • Good news: All of the UI for the particular solar system ui demo is in one file.
  • Bad news: Holy shit this is hard. Not only is it rust but itā€™s someone elseā€™s rust code.

Anyway, I started porting the visualizer to Nyx. So far I just copied over some files from the example. I went through the files and commented most of it pretty well. Maybe Chris can take it from hereā€¦ https://github.com/philiplinden/nyx/tree/bevy/examples/bevy-visualizer

I need to choose how to spend my time. Do I try to make a visualization for nyx and contribute to the project? If I do, thatā€™s a huge distraction from the actual goal of designing the model. Yes, the visualization would be useful for displaying the model. Iā€™d need a model for that.

https://i.imgflip.com/87ldhv.jpg

November 27, 2023#

Summary#

Notes#

N-body physics in Rust with solar system visualizations (source code) in Bevy šŸ‘€Ā I donā€™t know the accuracy of the physics modeling so Iā€™ll stick to Nyx for trajectory propagation, but we can absolutely steal the visuals! Itā€™s a ready-made UI to show bodies, trajectories, control time step size and simulation speed, and more. :chefs-kiss:.

Oh my god. Itā€™s not ā€œcrab maguhā€ itā€™s ā€œkrahb Muhgahā€ as in ā€œkrav magaā€ šŸ¤Æ

November 26, 2023#

Summary#

  • Started Model Requirements.
  • Spent a lot of time learning Rust fundamentals.
  • Decided to dabble in Rust this week to feel it out.

Notes#

Before I decide to go an (re)write everything in Rust I should take a moment to identify the requirements here. This exercise will result in a design doc and double as an exercise in thinking about the problem from first principles. By the end I should be able to decide on what tools to use (Python+Mesa? Julia+Agents.jl? Rust+krABMaga? Rust+Bevy?) from examining the requirements. Iā€™m not going to try too hard to keep my emotions out of that decision since this project is, for better or worse, fueled by my passion and personal interest.

https://youtu.be/POFK_yLg1U4?si=VsgPVZKMXi0rkQMM

https://youtube.com/playlist?list=PLEIv4NBmh-GsWGE9mY3sF9c5lgh5Z_jLr&si=tEU9HqcPn2rEUfDE

https://youtu.be/4YU_r70yGjQ?si=gZzV7GhGJ6p6ebdO

https://youtu.be/7GzQArrek7A?si=mo2-MBlQf8zLJSR-

https://youtu.be/E9SzRc9HkOg?si=oyeq10nM9pkkMzWF

Christopher Rabotin ā€˜s advice:

  • My general hunch is that it's probably best to stick with python for as long as you can because you can iterate much faster on the code
  • I didn't know about krabmaga, now I'm rooting for you to switch to rust especially for the visualization of the constellation

Ha, turns out krABMagaā€™s visualization engine is based on Bevy (https://github.com/krABMaga/krABMaga#usage) ā†’ conference paper

November 25, 2023#

Summary#

  • Tinkered with mkdocs-material settings and plugins.
  • Created a new grids module in tools to group functions that deal with hex grids.
  • Implemented a very basic ā€œdetectionā€ system.
  • Implemented the model for square or hex grids.
  • Found a bunch of Rust resources that are very aligned with the needs of this project.

Notes#

The website is actually pretty hard to use as a code reference. I think this is because the default setup is too basic. Iā€™m going to skim through the themeā€™s features and other plugins to make it better.

Material is definitely the best looking and most feature-rich theme for MkDocs. I went crazy with the plugins and settings, but itā€™s so worth it.

Now that agent motion is working the agents should start interacting! (except for edge cases where forward motion is not possible, I still have to implement that.)

I noticed that much of the agent module was just written to deal with the agent existing on a hex grid. This isnā€™t inherent to the agent itself (an agent could exist on a square grid, 3d space, or continuous canvas) so I split it into a new grids module.

The canvas for hex grids only allows circles or hexagons to represent actors. In order to show heading, I need to have actors either be on a continuous space or a square grid. I spent a good while trying to make the model handle hex or square. It sort of works. Hex works like normal, but when using a square grid the sprites look like theyā€™re teleporting. I canā€™t tell if this is a rendering issue or an actual translation issue.

The detection system isnā€™t so bad except it is brute force all the way. I need to add some request-like functions to the model so an agent can ask for a list of other agents within a certain radius, or ask just for the agents of a certain role. Right now itā€™s like O(N^2).

Took me a bit to get the ā€œtaggingā€ working too. Iā€™m too tired to figure out what was confusing me about it. It works now, so Iā€™ll call that a win.

I'm seeing some flaws in the ABM framework already. Game engines are essentially ABMs and Bevy is an engine built in rust, so maybe it could integrate with Hifitime and Nyx. Game engines usually have raycasting built in and I think I'm going to be raycasting for other agents within view. I don't really care about the rendering tools, but maybe we can model some radio transmission/ reflection effects using light transport mechanics.

https://youtu.be/AirfWcVOEHw

https://youtu.be/B6ZFuYYZCSY

https://youtu.be/TBjmRmjr4JA

I need to spend some dedicated time doing lower level design work for a single agent and choose a framework that best suits it.

This is essentially the same as making requirements for a single clock component and host. Two for one.

https://github.com/facorread/rust-agent-based-models

https://krabmaga.github.io/

https://youtu.be/DL9LANLg5EA

https://youtu.be/r35cBkPRNMI