The World
A World is the central data store for any application that uses Ark.jl. It manages Entities, Components and Resources, and all these are always tied to a World.
Most applications will have exactly one world, but multiple worlds can exist at the same time.
World creation
When creating a new world, all Component types that can exist in it must be specified.
using Ark
struct Position
x::Float64
y::Float64
end
struct Velocity
dx::Float64
dy::Float64
end
world = World(Position, Velocity)
; # Suppress print outputThis may seem unusual, but it allows Ark to leverage Julia's compile-time programming features for the best performance.
World reset
Ark's primary goal is to empower high-performance simulation models. In this domain, it is common to run large numbers of simulations, whether to explore model stochasticity, perform calibration, or for optimization purposes.
To maximize efficiency, Ark provides a reset! function that resets a simulation world for subsequent reuse. This significantly accelerates model initialization by reusing already allocated memory and avoiding costly reallocation.
World functionality
You will see that almost all methods in Ark's API take a World as their first argument. These methods are explained in the following chapters.