Data management in games with lots of items/enemies/objects

These things always differ game to game, but yeah, my table holds flipbooks too!

I am NOT saying this is the best way to organise things, but if you are looking for permission to create huge data tables - here it is :laughing:

regular_slime = {
        factory = "#regular_slime",
        shadow_size = "large",
        animations = {
            [STATES.IDLE] = "regular_slime_idle",
            [STATES.MOVE_TO_TARGET] = "regular_slime_move",
            [STATES.WAIT_TO_ATTACK] = "regular_slime_idle",
            [STATES.DYING] = "regular_slime_death",
        },
        is_enemy = true,
        sprite_offset = vmath.vector3(0,26,0),
        atlas = 1,
        target_priorities = {TARGET_TYPES.ATTACK_NEAREST_FRIENDLY, TARGET_TYPES.ATTACK_PLAYER, TARGET_TYPES.ROAMING},
        walk_speed = 100,
        attacks = {
            {
                --flipbook
                animation = "regular_slime_attack",

                --tags and attack mechanic
                attack_effects = { ATTACK_TYPES.MELEE },
                attack_damage_types = { { TAGS.MELEE, TAGS.PHYSICAL } },

                --animation timings
                attack_time = 7/18,
                attack_effect_times = { 4 / 18},

                --modifiers to base stats
                attack_cooldown_modifier = 1,
                attack_range_modifier = 1,
                damage_modifier = 1,
                knockback_modifier = 1,

                --sfx
                attack_sfx = sfx.sounds.claw_swipe,
                attack_sfx_speed = 1.25,
                attack_bark_sfx = sfx.sounds.flesh_attack_bark,
                attack_bark_chance = 0.35,

                --specific attack variables

            },
        },
        --sfx
        hit_sfx = sfx.sounds.flesh_hit,
        hit_sfx_speed = nil,
        hit_bark_sfx = sfx.sounds.slime_hit_bark,
        hit_bark_chance = 0.35,
        death_sfx = nil,
        death_bark_sfx = sfx.sounds.flesh_death_bark,
        death_bark_chance = 0.35,
        bark_speed = nil,
        --custom
        on_spawn = {
            {action = "start_pfx", pfx_id = "slime_trail"},
        },
        on_death = {
            {action = "spawn_units", unit_id = "small_slime", num = 5, is_friendly = false},
            {action = "spawn_fx", fx_id = "slime_gore"}
        },
        --spreadsheet
        damage = 10,
        attack_cooldown = 2,
        crit_chance = 0.05,
        crit_multiplier = 2,
        attack_range = 60,
        knockback = 300,
        knockback_resist = 3,
        health = 100,
        armor = 30,
        dodge = 0.025,
        threat_cost = 7,
        xp_drop = 1,
    },
1 Like