I want to do small simulation (similiar to games) where I have multiple 
objects that can move and spawn at map. What is the most efficient way to 
do that?

I was thinking about something like this:

@doc "I wont to be able to check for collision in constant time"
map = Array{Union{all objects...}(1000000, 100000)

@doc "I place each object into separate vector, so I can move with them 
with complexity N"
moveable_objects_1 = [MO1 for i = 1:1000] # and place them on map
moveable_objects_2 = .....
..._3 = ..
...


Is this the most efficient way?
Also, why do I have to specify the type of map array (Union..), when I will 
technically store there only pointers, which are all of the same size. If I 
use Array{Any}, will it be as fast as using Union{..} ?

Should I make map, moveable_objects_1-5 global variable, so I dont have to 
send it as parameter every time? (That will make my code unusable when 
imported by somebody else right?) Or should I pack them inside one type 
(f.e. type Data)? I am used to [this.](..) so this is kinda new to me.

Reply via email to