Skip to content

Initialize DAABBCC

selimanac edited this page Oct 8, 2024 · 11 revisions

All arrays are now pre-allocated, similar to how Defold handles them. Arrays will no longer grow dynamically, so it is your responsibility to set them up upfront. Initialization should only be done once.

Default allocations for arrays(results) and hashtable(groups):

max_group_count = 3
max_gameobject_count = 128
max_query_result_count = 32
max_raycast_result_count = 32

There are two ways to initialize DAABBCC

1 - Initialize using game.project file

Open your game.project file using a text editor, copy and paste the settings below, and adjust them as needed.

[daabbcc]
max_group_count = 3
max_gameobject_count = 128
max_query_result_count = 32
max_raycast_result_count = 32

2 - Initialize using daabbcc.init() function

daabbcc.init(max_group_count, max_gameobject_count, max_query_count, max_raycast_count, [update_frequency])

Parameters

  • max_group_count (uint8) - Maximum number of Groups. Default is 3.
  • max_gameobject_count (uint16) - The maximum number of gameobjects that can be added using daabbcc.insert_gameobject(). Default is 128.
  • max_query_count (uint16) - Maximum number of Query result for a single AABB. Default is 32.
  • max_raycast_count (uint16) - Maximum number of Raycast result for a a single raycast. Default is 32.
  • update_frequency (int32)[optional] - Update frequency for Gameobject update. More info.

Example

local max_group_count = 3
local max_gameobject_count = 1024
local max_query_result_count = 128
local max_raycast_result_count = 128

daabbcc.init(max_group_count, max_gameobject_count, max_query_count, max_raycast_count) 
Clone this wiki locally