Share your repls and programming experiences

← Back to all posts
SortaBomber - Explosion Physics
tussiez (1508)

SortaBomber

Blow up stuff.

This is my replica of Roblox's "welds" system. This groups static objects together, e.g buildings, but when hit above a set speed, the building will break.

Controls

  • (RIGHT) click and drag to look around.
  • (LEFT) click to fire explosives.

Improvements

I modified Physijs to work with the WASM version of Ammo, which has improved performance by.. a lot. It's now possible to simulate a few hundred blocks now without any lag. I would update the car physics game with this, but there are a few underlying problems with Physijs itself and Ammo (I spent a few hours getting collisions to work correctly), which means more bug fixing :/

How it works

Objects are first added to a parent object. This makes them a compound shape. Explosions are calculated by their position and force. The overall group has a set "strength", and this is reduced by repeated explosions, amplifying the damage done. The velocity of an object is reduced by the distance it is from the explosion, and increased by the explosion force. Objects farther away from the bomb move slower, and vice versa. Because objects cannot move independently from their parent, the ones nearest to the explosion are orphaned and made dynamic. Simply removing the object from the parent and adding it to the scene doesn't work, so I clone the object (probably a bad idea) instead.

Enjoy!

Play it!

Not working?

This Repl uses experimental technology that may not yet be supported across all platforms and browsers. For the best experience, use the following:

  • A home desktop/laptop computer, some schools may block some files
  • Chrome 89 or as recent as possible

What may be the issue:

  • WASM
  • Module Web Workers
  • WebGL
  • ES6 (Don't use Internet Explorer :sob:)
Comments
hotnewtop
Bookie0 (5965)

I have found....the unbreakable thingy:

Behold in all it's grandeur:

Still here!

So many explosions I've made the other orchid blocks go away!

Now it's all alone! :(

tussiez (1508)

@Bookie0 Behold...

the parent object!

mollthecoder (19)

@Bookie0 I see you use ChromeOS. It seems everyone on replit does.

Bookie0 (5965)

@mollthecoder i uh don't. I use macOS what makes you say that?

mollthecoder (19)

@Bookie0 My mistake. I said that cause the cursor was the same as Chrome OS's cursor. It seems they have the same cursor.

FlaminHotValdez (437)

@mollthecoder I'm on Ubuntu 20.04 and I also have the same cursor

personmandude (0)

@mollthecoder I am on a school chromebook for coding in school and a bunch of other people probably are

LaneMartin (69)

Let's honor the people who play this without a mouse.

LaneMartin (69)

@LaneMartin This is how the Germans bombed London:

tussiez (1508)

@LaneMartin

"Can you see where it's going to land?"
"No."
"Just spam it ig"

AryyanVineeth (11)

@LaneMartin I played this without a mouse.

Soccer135246 (7)

I like how you can launch bombs from the top, change the angle, and view it like a 3D bombing simulation

Soccer135246 (7)

@Soccer135246 oh wow I can hit them from under and they still move...

EliasTheGreat (45)

This is really cool, with nice physics, the only citicism about it I have is the update ing of physics, it looks like a bomb only updates blocks around it and dosn't account for physisics that was not in the radious of the blocks

LaneMartin (69)

@notTussiez lol notTussiez lol funny name

notTussiez (1)

@LaneMartin Trust me, he's not the real one

OldWizard209 (1093)

Wait, firstly, it says:

Assuming it is "Physics" with a "C", How in the "PHYSICS WORLD" does this make sense?:

Oh or probably it is just the subject of "Physijs" not "Physics".

novaflippers (55)

Which library was this built with?

tussiez (1508)

@novaflippers Threejs (WebGL) and Physijs (physics, using Ammo --> pybullet)

PyCoder01 (71)

this is basically roblox 2007

PyCoder01 (71)

the ball is from crossroads roblox lol.

FlaminHotValdez (437)

*throws a literal bomb at the tower*
*blocks explode*
*top of the tower doesn't fall down*
Ah yes, physics.

Or is it fisix?

tussiez (1508)

@FlaminHotValdez This is normal Roblox behavior

FlaminHotValdez (437)

solid proof that green is better than purple. Time to spraypaint my room

LaneMartin (69)

COME ON @tussiez ONLY 4 MORE TO GO:

FlaminHotValdez (437)

@LaneMartin boi...why do you care about cycles? they are useless internet points. Also that is weekly...In the long run, RayhanADev is more than 500 cycles ahead of tussiez anyway

alpha2442 (2)

Neither the window in this repl or another tab will load... How long should I wait?

alpha2442 (2)

@tussiez even if I press run it doesn't work bruh

tussiez (1508)

@alpha2442 Are you using a personal not school, desktop computer and Chrome? A lot of my Repls use experimental technology

alpha2442 (2)

@tussiez yeah I'm using a PC and also chrome

tussiez (1508)

@alpha2442 Latest version? Huh, send me a screenshot of DevTools' console and Network tab

alpha2442 (2)

@tussiez i restarted my tab and also closed all of my tasks i don't need in windows task manager and it seems to be working now because the program needs quite a bit of power to run apparently

tussiez (1508)

@alpha2442 True - it's a 3D physics engine

FallenAngel6 (17)

tower gravity when?

SudhanshuMishra (202)

The dust clears

It still stands

SudhanshuMishra (202)

What are you doing here you should be in mojang

LaneMartin (69)

You should add an option where you can have more than 1 tower but the maximum in 10 so it feels like bombing an entire city and not just a puny building.

RahulChoubey1 (136)

the second slider's snap is 1, not .5, which makes the bomb explosion numbers funni

RishabhRanjit (3)

Physics at its finest...

RishabhRanjit (3)

@tussiez Now that u told me that, this makes so much sense.

LaneMartin (69)

OMG THIS IS SO GOOD

LaneMartin (69)

@tussiez This is much better than your car physics thing

noway15 (60)

@tussiez you should make a site called

sortastuff.sortagames.oof
tussiez (1508)

@noway15 hmm yes
I got sortagames.tk but just started writing the homepage

noway15 (60)

@tussiez noice

especially the .oof part lol
Soccer135246 (7)

I sent an orchid block flying from one side to another, and then it fell off, along with 3 more...

Soccer135246 (7)

@Soccer135246 Wha?? when I tried to launch a bomb it exploded in my face!!