# Bore blasters

**URL:** <https://forum.defold.com/t/bore-blasters/73228>\
**Category:** Showcases\
**Created:** [May 9, 2023, 12:57pm UTC](https://forum.defold.com/t/bore-blasters/73228 "2023-05-09T12:57:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 9, 2023, 12:57pm UTC](https://forum.defold.com/t/bore-blasters/73228/1 "2023-05-09T12:57:46Z")

</div>

I am super excited to announce our next game - **BORE BLASTERS!**

 ![Bore Blasters_Steam Capsule Comm 1920x620_with_logo](https://forum-defold-uploads.b-cdn.net/original/3X/d/6/d604e26b7cbb71841511a855d8514eceecc688eb.jpeg)

Blast through rocks with your machine gun drill. Collect rare gems, ores and ancient artifacts, upgrade your ship and unlock new abilities. Uncover the mysteries of the deep and the dangers that lurk below.

![GIF_loot_noframe](https://forum-defold-uploads.b-cdn.net/original/3X/7/e/7ec5dc69ddbb6bb1ef84260e3b7039c0563d79ef.gif)

![GIF_blast_noframe](https://forum-defold-uploads.b-cdn.net/original/3X/6/f/6fc7713c79592afb112b3a6a2bcd1380c3efa0f8.gif)

![GIF_upgrade_noframe](https://forum-defold-uploads.b-cdn.net/original/3X/5/f/5fb33263ac1e74e6b41407fae16916cdc3ca6389.gif)

Wishlist it now to support us! 👇

> **[Save 50% on BORE BLASTERS on Steam](https://store.steampowered.com/app/2398170/BORE_BLASTERS/?utm_source=defold)**
>
> Blast through rocks with your machine gun drill. Collect rare gems, ores and ancient artefacts, upgrade your ship and unlock new abilities. Uncover the mysteries of the deep and the dangers that lurk below.

---

<div class="post-metadata">

**Author:** ![Pawel](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/pawel/32/24623_2.png) [@Pawel](https://forum.defold.com/u/Pawel)\
**Post date:** [May 9, 2023, 3:28pm UTC](https://forum.defold.com/t/bore-blasters/73228/2 "2023-05-09T15:28:37Z")

</div>

Wishlisted! ❤

---

<div class="post-metadata">

**Author:** ![selimanac](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/selimanac/32/6397_2.png) [@selimanac](https://forum.defold.com/u/selimanac)\
**Post date:** [May 9, 2023, 3:46pm UTC](https://forum.defold.com/t/bore-blasters/73228/3 "2023-05-09T15:46:34Z")

</div>

Looks great, wish you the best.  
no enemies to fight with? interesting 🙂

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 9, 2023, 4:03pm UTC](https://forum.defold.com/t/bore-blasters/73228/4 "2023-05-09T16:03:52Z")

</div>

Thanks for AABB again 😉

There will be some enemies, but none implemented yet. Enemies will be less of a focus than in Void Scrappers.

---

<div class="post-metadata">

**Author:** ![jhonny.goransson](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jhonny.goransson/32/3864_2.png) [@jhonny.goransson](https://forum.defold.com/u/jhonny.goransson)\
**Post date:** [May 10, 2023, 12:06am UTC](https://forum.defold.com/t/bore-blasters/73228/5 "2023-05-10T00:06:37Z")

</div>

Looks amazing!!

---

<div class="post-metadata">

**Author:** ![BunBunBun](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/bunbunbun/32/25691_2.png) [@BunBunBun](https://forum.defold.com/u/BunBunBun)\
**Post date:** [May 11, 2023, 6:21am UTC](https://forum.defold.com/t/bore-blasters/73228/6 "2023-05-11T06:21:29Z")

</div>

Wishlisted!

I wonder how you implemented the world, is it a tile map?

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 11, 2023, 7:04am UTC](https://forum.defold.com/t/bore-blasters/73228/7 "2023-05-11T07:04:03Z")

</div>

Thank you for the wishlist!

> [@BunBunBun](#):
>
> I wonder how you implemented the world, is it a tile map?

No!

Each block is a game object → sprite → tilesource. This is so that I can apply auto-tiling.

Here’s what a tilesource looks like:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/a/5/a5cf431d297cbf9bd565f64b9f7c837b21180ab9.png)

Each animation in the tilesource corresponds to a bitmask. I used [this excellent guide](https://gamedevelopment.tutsplus.com/tutorials/how-to-use-tile-bitmasking-to-auto-tile-your-level-layouts--cms-25673) to figure out how to use bitmasking for auto-tiling.

Happy to share more if people have any questions about the project.

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 11, 2023, 7:17am UTC](https://forum.defold.com/t/bore-blasters/73228/8 "2023-05-11T07:17:20Z")

</div>

One thing I was grappling with for a while was garbage collection. I frequently spawn/despawn lots of blocks as the player moves around in the world. This eventually triggers the garbage collector, which results in a really noticeable stutter.

I used the [discussion in this thread](https://forum.defold.com/t/solved-optimizing-frame-stability-avoiding-garbage-collector-related-hitches/70930/3) as a starting point for a solution. Thank you @cornedbeer - your thoughts were really useful and I would have struggled to realise that placing this script in the main collection would ensure it runs last.

The idea is that I run the garbage collector in tiny increments each frame, until I reach the time limit (e.g. 0.167 seconds for 60 fps). I have also implemented a flag which prevents the garbage collector from running on particularly intensive frames (e.g. if I despawn a chunk of blocks).

Simplified, it looks something like this:

```lua
	if garbage.intensive_frame then

		--Don't run the garbage collector during a particulary intensive frame
		--This flag can be set by any script and will prevent garbage collection from running that frame

		collectgarbage("stop")
		garbage.intensive_frame = false

	else

		--Run garbage collection steps until finished or we run out of time this frame
		-- https://forum.defold.com/t/solved-optimizing-frame-stability-avoiding-garbage-collector-related-hitches/70930/3

		frame_time_diff = socket.gettime() - frame_start_time

		garbage_finished = false
		while not garbage_finished and frame_time_diff < frame_time_target do

			garbage_finished = collectgarbage("step", 1)

			frame_time_diff = socket.gettime() - frame_start_time
		end

	end

	frame_start_time = socket.gettime()

```

A key component of making this work is setting a reasonable [step size](https://www.tutorialspoint.com/lua/lua_garbage_collection.htm) for the garbage collector. For me, this was 110:

```lua
collectgarbage("setstepmul", 110)

```

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [May 11, 2023, 9:28am UTC](https://forum.defold.com/t/bore-blasters/73228/9 "2023-05-11T09:28:34Z")

</div>

Thanks! These are really lots of very useful information.  
Maybe you can create a separate thread where you can discuss some of your solutions?

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 11, 2023, 9:32am UTC](https://forum.defold.com/t/bore-blasters/73228/10 "2023-05-11T09:32:11Z")

</div>

Thank you! I really don’t mind sharing a mix of general updates and technical stuff. If it becomes too cluttered though I’d be happy to start separate threads.

---

<div class="post-metadata">

**Author:** ![jhonny.goransson](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jhonny.goransson/32/3864_2.png) [@jhonny.goransson](https://forum.defold.com/u/jhonny.goransson)\
**Post date:** [May 11, 2023, 9:55am UTC](https://forum.defold.com/t/bore-blasters/73228/11 "2023-05-11T09:55:38Z")

</div>

Maybe a small blog post? It’s very interesting and helpful! 🙂

---

<div class="post-metadata">

**Author:** ![aglitchman](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/aglitchman/32/19432_2.png) [@aglitchman](https://forum.defold.com/u/aglitchman)\
**Post date:** [May 11, 2023, 1:43pm UTC](https://forum.defold.com/t/bore-blasters/73228/12 "2023-05-11T13:43:10Z")

</div>

> [@Alex\_8BitSkull](#):
>
> I frequently spawn/despawn lots of blocks as the player moves around in the world. This eventually triggers the garbage collector, which results in a really noticeable stutter.

Great tips! Personally, I love everything about code optimisation 🤩

Please tell us more details about why does spawning/despawning blocks stress GC? I assume it’s because a lot of tables are created and deleted, right? Are they created by collectionfactory?

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 11, 2023, 3:00pm UTC](https://forum.defold.com/t/bore-blasters/73228/13 "2023-05-11T15:00:57Z")

</div>

> [@aglitchman](#):
>
> Great tips! Personally, I love everything about code optimisation 🤩

Thanks! I am very proud about pulling off the garbage collection implementation (but of course it wasn’t my idea!). Otherwise I actually find code optimisation a bit stressful, but I keep making really intense games so I guess I have to learn some things 😅

> [@aglitchman](#):
>
> Are they created by collectionfactory?

Just regular factories actually.

> [@aglitchman](#):
>
> Please tell us more details about why does spawning/despawning blocks stress GC? I assume it’s because a lot of tables are created and deleted, right?

Each block has two tables associated with it - permanent data (such as what type it is, location, etc). It also has temporary data when it is spawned (game object reference, AABB id for collisions, etc). The table with temporary data is created/deleted when I perform culling.

I’m not entirely sure what exactly stresses out the garbace collector. What I found, surprisingly, is that **deletion** is much costlier than **creation**. I haven’t narrowed down whether that is go deletion or table splicing or something else.

When I have to spawn block “sectors” (sector is what I call a set of blocks that ~cover the player’s window), I batch them so that one sector is spawned each frame. When I have to remove sectors, I batch it so that **one row** of a sector is deleted each frame (so it takes about 20 frames to remove one sector). If I delete an entire sector in a frame, I get a stutter!

---

<div class="post-metadata">

**Author:** ![cornedbeer](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/cornedbeer/32/24457_2.png) [@cornedbeer](https://forum.defold.com/u/cornedbeer)\
**Post date:** [May 11, 2023, 4:40pm UTC](https://forum.defold.com/t/bore-blasters/73228/14 "2023-05-11T16:40:02Z")

</div>

Glad my thread was helpful! Since then I’ve actually discovered one very unfortunate issue with Lua’s GC that you may or may not run into depending on the scope of the project/how much you rely on pre-processing and storing data and how you structure that data.

Luckily the work-around isn’t too bad, but it’s something that might drive you crazy if you start running into issues and don’t know why. I’ll make a post about it in my original thread for anyone who’s interested.

Good luck with the new project, the destructible terrain looks really satisfying already!

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 11, 2023, 6:54pm UTC](https://forum.defold.com/t/bore-blasters/73228/15 "2023-05-11T18:54:37Z")

</div>

Thanks for the heads up! Very interesting, and you are correct in saying that would be very hard to debug. I think this project will manage to avoid hitting these large numbers, because I do end up doing a fair bit of table nesting + the mining shafts are finite in depth and width.

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 20, 2023, 7:28pm UTC](https://forum.defold.com/t/bore-blasters/73228/16 "2023-05-20T19:28:07Z")

</div>

I love destruction and chain reactions so this vein of explosive ores was a great idea (courtesy of wife)!

---

<div class="post-metadata">

**Author:** ![ahmedmaawy](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/ahmedmaawy/32/4351_2.png) [@ahmedmaawy](https://forum.defold.com/u/ahmedmaawy)\
**Post date:** [May 21, 2023, 12:44pm UTC](https://forum.defold.com/t/bore-blasters/73228/17 "2023-05-21T12:44:22Z")

</div>

@Alex_8BitSkull Wishlisted

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 21, 2023, 1:54pm UTC](https://forum.defold.com/t/bore-blasters/73228/18 "2023-05-21T13:54:32Z")

</div>

> [@ahmedmaawy](#):
>
> Wishlisted

Thank you! This helps us out a lot 💪

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [May 27, 2023, 11:03am UTC](https://forum.defold.com/t/bore-blasters/73228/19 "2023-05-27T11:03:18Z")

</div>

Infested caves! Been working on enemies a bit. I think this feels super satisfying (and the wriggly eggs are disgusting).

---

<div class="post-metadata">

**Author:** ![Alex\_8BitSkull](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/alex_8bitskull/32/5424_2.png) [@Alex\_8BitSkull](https://forum.defold.com/u/Alex_8BitSkull)\
**Post date:** [September 7, 2023, 4:19pm UTC](https://forum.defold.com/t/bore-blasters/73228/20 "2023-09-07T16:19:39Z")

</div>

We’ve got a fresh new trailer out! Would love to hear what you think. You can check it out here:

[https://twitter.com/8BitSkull/status/1699815459795664986](https://twitter.com/8BitSkull/status/1699815459795664986)

[Next page](https://forum.defold.com/t/bore-blasters/73228.md?page=2)
