Community Challenge #5: Break It! ⛓️‍💥

Wow! Did your kids play it? I’m amazed! Thank you! Do you think if I put in more time and polish this could be accepted by Poki?

2 Likes

Break It: Holey Moly

Made this small game when I was trying to learn Defold’s joints and collision shapes. It’s reminiscent of those funny Japanese hole-in-the-wall TV variety games. The goal is to rearrange the stick figure’s limbs to match the incoming hole shape by clicking and dragging the designated touch points.

Happy playing! :blush:

Game: Holey Moly by Kuyi Mobile

Github: GitHub - kuyimobile/Defold-Physics-Challenge: Defold Challenge #5 (Physics) · GitHub

6 Likes

Always! They’re the best playtesters :sweat_smile: :ok_hand:
And believe me, amount of fun they have is astonishing, they’re laughing all the time :rofl:

10 Likes

The game area is cropped for me:

Me too on mobile

Oops, sorry! @britzl @Mathias Can you please try again?

4 Likes

So cool to see your kids playing the games!! :blush:

2 Likes

very insteresting ! I love to play it.

2 Likes

Thanks it works fine now! Really nice game, I’ll check the code never used joints before

3 Likes

Tentacle Thing

Hi! tried to do a Carrion-like project, I always wondered how it was done with all the tentacles and particles going through walls. I am pretty sure that it was built using a custom engine so they might have control of every pixel and that’s why even sections of the tentacles are able to collide with walls, tried a lot of ways, static tentacles, tentacle composed by multiple game objects doing some kind of ropes with fixed joints (this crashed many times so I just dropped it). Lastly I just asked an AI if there was a different way and that’s how I ended up with the mesh generated tentacles.

Repo: GitHub - jeanstkng/def-carrion-physics: A Defold Project where I try to mimic Carrion Game Physics with tentacle movement. · GitHub

Game: Tentacle Thing by jeanstkng

physics_carryon

15 Likes

Wow I really love it! Have a “Life” SF movie feel :sweat_smile: and the bleeding effect is really cool! Need to see the code, is it a shader effect or tile(map) changing? (EDIT: OK I just need to read the readme :laughing:)

This creature could be a freaking enemy in an action game :grinning_face_with_smiling_eyes: if you change the sphere to a space-octopus head

I wanted to make a game where the female character use her hair to grab things and hang on the ceil, this could be a good starting point!

2 Likes

I pushed a small update to the “my wagon thing”. Now there is turbo with W and you eventualy can hit the finish. My best score is 10.923 10.859 sec :chequered_flag::automobile:

3 Likes

Thank you very much for all your submissions! :orange_heart:

This time the competition was though and it was very hard for us to decide on the winners (1 vote decided in each category!), so congratulations! :partying_face:

  • :rocket: Best Technical: Tentacle Thing by @jeanstkng

  • :artist_palette: Best Visual: Wooden Wagon by @Sam

  • :hatching_chick: Best First-time: Flip-Flop Football by @Ivan

Each of you will receive a 25 EUR Steam gift card! :wrapped_gift:
I will contact you via DM here, so please answer :wink:

15 Likes

Thank you so much for the award!

I had a blast putting this together.

3 Likes
When should the next Community Challenge be?
  • April
  • May
  • June
  • July
  • Later
0 voters
3 Likes

Alright, so expect the next challenge pretty soon! :smiley:

4 Likes

Hi everybody!

I know this challenge is over since a long time, but I wanted to share the thing that I started with this challenge and that is playable now. I have completely give up the idea to respect any deadline in this matter, but I am still doing it at my own pace! I love theses challenges.

So here is a new version of my Tiny Games!

I will one day make an entry in the dev diaries topics, but when I will be ready.
TinyGames is a mean for me to learn Defold and be a bit more productive…because at the beginning I was creating a new project each time I would try something, but lose much time starting again and again. I couldn’t build up on what I’ve coded before..
So I build this project as a games portal, I have a bootstrap collection and some common libs that I share between games and augment as I learn Defold, then I have a dedicated folder for each games where I can try and learn specific topics in the context of a small game (this would be a good case for LiveUpdate… but in a future version!)

For now I made

  • Baveur Vert :ghost:: a space shooter with a green slobber ghost fighting sushi and food!
    • my first game. I learned inputs mapping, enemy spawning, first GUI hud, defold-events, virtual pad on mobile, gamepad on anbernic console with android version
  • Mochi Fight! :steaming_bowl: :fried_shrimp: (comming soon!) : this will be a fighting game of japanese food!
    • I am still working on it, I want to implement a combo system and multiplayer game
    • but it seems it is a harder thing to do that I thought!

But today I present to you my new tiny game, Blob Planet! :alien: :microbe:

I started it with this challenge, this is my first game using physics. First time also using runtime mesh generation and shaders.
So the concept is that you play a space Blob exploring the universe and just eating stuffs to expand and expand and expand! But beware of physical forces that will rip you apart and many dangers!

  • Move with arrows (it creates a force towards arrow direction)
  • or on mobile just touch the direction you want to go (it create a force towards the touch)
  • if you are lost, double-hit rapidly backspace / back on mobile to go to title screen.

This is more a proof of concept than a game.

For now I have:

  • Mr. Blob, which is a collection of many objects:
    • a core objects, the center, with a dynamic collisionobject
    • a factory that produces externals nodes around my core with dynamic collisionobjects too
      • every nodes are joint to the core with a physics joint
      • every nodes are joint to their neighbour with a physics joint
    • so the structural integrity depends on theses joints
    • the number of nodes and the radius of joints and the properties of the joints (frequency) are configurable with script properties
    • then over this structure, I generate at runtime a mesh with a vertex on each collision object, it is a fan triangulation
    • so I move objects in fixed_update(), and update mesh vertices/material variables in update()
    • the mesh use a material with a fixed noisy texture, but the texture is used twice with moving uv at different speeds, so it’s kind of organic. I also use 2 tints for light and dark green color, and another glow color (which handles time too) for the rim effect. This is the shader:
#version 140

in mediump vec2 var_texcoord0;
uniform mediump sampler2D tex0;
// uniform 
uniform fs_uniforms
{
	mediump vec4 tint;
	mediump vec4 tint2;
	mediump vec4 glow_color; // glow_color.w = time
};
out vec4 out_fragColor;

void main() {
	// Pre-multiply alpha since all runtime textures already are
	mediump vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
	mediump vec4 tint2_pm = vec4(tint2.xyz * tint2.w, tint2.w);
	// 1. Calcul de la distance par rapport au centre (0.5, 0.5)
	// On suppose que  UVs sont bien mappés de 0 à 1 sur le cercle
	vec2 uv = var_texcoord0 - vec2(0.5);
	float dist = length(uv) * 2.0; // 0 au centre, 1 au bord

	// --- texture noise --------------
	float time = glow_color.w;
	// 1. On fait défiler deux couches de bruit à des vitesses différentes
	vec2 uv1 = var_texcoord0 + vec2(time * 0.05, time * 0.03);
	vec2 uv2 = var_texcoord0 - vec2(time * 0.02, time * 0.04);
	float noise1 = texture(tex0, uv1).r;
	float noise2 = texture(tex0, uv2).r;
	// 2. On mélange les deux pour un effet de "liquide" complexe
	float final_noise = (noise1 + noise2) * 0.5;
	dist += (final_noise - 0.5) *0.2; 
	// -------------------------------------
	
	// 2. Création de l'effet "Rim Light" 
	// Plus on est proche du bord (dist = 1), plus c'est brillant
	float rim = pow(dist, 5.0); 

	// 3. Simulation de translucidité
	// On veut que le centre soit un peu plus sombre ou transparent
	float alpha = smoothstep(1.0, 0.0, dist * dist * 0.2); 

	// 4. Mélange final
	vec3 final_color = mix(tint_pm.rgb, tint2_pm.rgb, final_noise); // mix tint and tint2
	final_color = mix(final_color, glow_color.rgb, rim ); // apply rim light effect

	// On multiplie par l'alpha du tint pour le contrôle global
	out_fragColor = vec4(final_color, alpha * tint_pm.a);
}

Now, this is a physics simulations, which mean FORCES!

I have implemented gravity forces, which you see in red because it is a debug build, but I will implement Coulomb (static electric charges) and Lorentz (moving electric charges in a magnetic fields) and any other things for fun gameplay (like vortex stuff!)

I’ve build a physics_manager and a physics_registry lua module.

  • physics_registry role is to register physical objects of two kinds:

    • mobile objects that should undergo forces. here Mr Blob
    • “force-zones” that are game objects that produces forces. here the planets.
      • A force-zone defines the function to compute the force for some “physical points”. here gravity.
        • a physical point is an object with at least a position, a mass and a velocity, but also an electric charge or other physical properties.
      • A force-zone must have a trigger collision object that defines the activation of force calculation when mobile objects enter in the zone. I use simple shape, but we can have complicated force-zone shapes by accounting for geometry in the force calculation (like a SDF function in shaders)
  • physics_manager role is to handle all global physics, so it defines a physics_world_listener which

    • activate/deactivate registered force-zones when a registered mobile objects enter in the zone (trigger event). So then the mobile object know which zone act upon it.
    • it can also repost physics events as standard on_message() messages to objects that are registered as listeners. When you use a global listener Defold stop forwarding messages automatically, but I still want some decentralised logic to be in game objects scripts. But the script must explicitly register in physics_registry as a listener.
    • in the fixed_update(), loop over all registered mobile objects and compute the forces to apply because of the force zones registered to this object
    • draw debug info for physics

Here each planet has configurable mass for gravity, mass for collisionobject, radius of planet, radius of trigger zone… so you can have a small planet with big gravity mass but a small bullet2d mass!

this is the physics_manager world_listener:

--- Listener for physics events
--- It reposts message to objects that have registry.register_listener(id)
--- It handle auto-registration of force zones triggers to mobile objects (if zone is in registry.register_zone(id) and mobile is in registre.register_mobile(id)
function M.physics_world_listener(self, events)
  for _, event in ipairs(events) do
    if event.type == M.RAY_CAST_RESPONSE then
      -- Handle raycast hit data
      --  pprint(event)
    elseif event.type == M.RAY_CAST_MISSED then
      -- Handle raycast miss data
      -- pprint(event)
    else
      local listener = registry.get_listener(event.a.id)
      local other_listener = registry.get_listener(event.b.id)
      if event.type == M.CONTACT_POINT_EVENT then
        -- Handle detailed contact point data
     --   pprint(event)
        if listener then
          M.repost_contact_point_response(event, false)
        end
        if other_listener then
          M.repost_contact_point_response(event, true)
        end
      elseif event.type == M.COLLISION_EVENT then
        -- Handle general collision data
     --   pprint(event)
        if listener then
          M.repost_collision_response(event, false)
        end
        if other_listener then
          M.repost_collision_response(event, true)
        end
      elseif event.type == M.TRIGGER_EVENT then
        -- Handle trigger interaction data
      --  pprint(event)
        -- mobile and zone auto-registration
        -- mobile zone détection
        M.handle_zone_triggers_registration(event.a.id, event.b.id, event.enter)
        if listener then
          M.repost_trigger_response(event, false)
        end
        if other_listener then
          M.repost_trigger_response(event, true)
        end
      end
    end
  end
end

And the fixed_update() loop:

function M.fixed_update(self, dt)
  for mobile_id, mobile in pairs(registry.mobiles) do
    if mobile then
      local force_points = mobile.fn_get_points()
      local total_forces = {}
      for i = 1, #force_points do
        total_forces[i] = vmath.vector3()
      end
      local has_force = false
      -- On itère sur toutes les zones qui influencent cet objet précis
      for zone_id, zone in pairs(mobile.active_zones) do
        if zone then
          local forces = zone.fn_compute_force(force_points)
          for i = 1, #force_points do
            total_forces[i] = total_forces[i] + forces[i]
            if vmath.length_sqr(total_forces[i]) > 0 then has_force = true end
          end
        end
      end

      -- Une seule application de force par objets mobiles, avec tous les points internes
      if has_force then
        mobile.fn_apply_forces(force_points, total_forces)
      end
    end
  end
end

When I will be more advanced in this code, I will shared this physics_manager module as it could be easily used for other games I think. Or just as an example.

Next steps:

  • dissociate mesh points from collision objects of Mr. Blob: I want more vertices on the mesh to smooth it, they will be influences by the collision objects, but not exactly the same. I want to add animation to them too.
  • add Blob eating stuff game mechanic: you eat, Blob grows.. and grows… and duplicate? add cores? create a nest? change blob physical properties? electric-blob? magnetic-blob? glueing blob? frozen, rock blob? Eat bad blob and gain their powers!
  • many other types of force-zones and other mobile objects (bad blobs, floating stuffs, asteroids stars etc.)
  • add a “landing” mechanics on planets so that it becomes more of a plateformer while on ground (ok this gonna be Blob Galaxy soon :sweat_smile:)
  • add a minimap to not get lost in the universe!
  • what else?

Well this was a longer post I thought I will do! Maybe it counts as a dev diary ^^
I hope you’ll like Mr. Blob and you could give some feedback about this little game.

As a final note, I want to say that I found Defold to be a truly great engine! I did all this with I found a lot less code I would expect. You have to think about organisation of things a bit first, and think “à la Defold”, but then the engine let you do everything you want in a graceful way. Thanks to all the team working on this thing.

8 Likes

Blob Planet is awesome! So nice you finished it! :wink:

2 Likes