Shape Game - Simple matching game based on suikagame

Taking a slight break from my village building game to work on something simpler. At least that’s the idea. I had this idea of making a game like https://suikagame.com/, but the game is based on a circle instead of a box. Since I imagined I’d work with a lot of concepts I normally don’t use in my games, such as circles and physics, I sought out the help of ChatGPT.

I created a custom GPT that uses live web browsing and Defold’s most-recent API. Results have been better than expected so far.

In one instance, I wasn’t sure how to generate one message per collision (i.e., a merge). Here’s what it recommended.

local function check_collission_shape(self, message)
	local other_url = msg.url(nil, message.other_id, "script")
	local other_shape = go.get(other_url, "shape")

	if self.shape == other_shape then
		-- Create a deterministic order based on instance IDs
		local id1 = tostring(go.get_id())
		local id2 = tostring(message.other_id)
		if id1 < id2 then
			-- Only send the try_merge message if this object has the "lesser" id
			msg.post(message.other_id, "try_merge", { other_shape = self.shape })
		end
	end
end

Since instances are numerical, comparing two instances (i.e., two collisions) and sending a message from the instance with the lowest value is a simple and effective way to send one message per collision.

The next thing I needed help with was confining my cursor to a circle.

function confine_cursor_to_rim(cursor_x, cursor_y, center_x, center_y, radius)
    local dx = cursor_x - center_x
    local dy = cursor_y - center_y
    local angle = math.atan2(dy, dx)
    
    local confined_x = center_x + radius * math.cos(angle)
    local confined_y = center_y + radius * math.sin(angle)
    
    -- Set the cursor position to the confined coordinates
    -- Depending on how you handle cursor position in Defold, this might vary.
    -- This is a generic way to update cursor position.
    cursor.set_position(vmath.vector3(confined_x, confined_y, 0))
end

I can’t say that using GPT is a gamechanger, but it is a convenient tool. You still need knowledge of Defold. GPT makes mistakes and there’s also the matter of knowing how to communicate your goals. One thing it does a better job than me at is referencing information. It’s basically a faster search tool.

Here’s some basic gameplay so far.

3 Likes

The circle concept wasn’t as interesting as I thought. I went with a box instead. The theme is now you’re a magician placing shapes in a hat. It will be a standard matching game, but with leveling and roguelike elements.

Some current ideas for perks to choose on level up:

  • increased hat size
  • decreased shape sizes
  • more xp per shape collision
  • increased chance to award a bonus shape (matches with first shape touched)
  • trigger micro “explosions” on match (so shapes have a chance to fall into each other)

2 Likes

Working prototype available.

Not sure if I’ll continue working on this one. It was fun to try and get something basic working in a short amount of time.

6 Likes

Added all shapes (11), up to the heart.

Some shapes are buggy.

I’m on the fence about finishing this. On one hand, I’m eager to work on a new game. On the other, it would be nice to have a developed game live on poki or yandex games.

The camera zoom is a dev tool. I plan to add upgrades that let you expand the hat and zooming the camera will be part of that process.

2 Likes

Minor update:

  • Adjusted sizes of the game/hat
  • Added leveling system

Far from finished, but closer to the goal than I was yesterday.

2 Likes

Going back to a score-based system. I like the idea of XP and levels, but the goal is to get a simple working game finished. A simple score system gets me closer to that goal.

I also updated the graphics.

New version:

High score now works. I don’t know if I’ll develop this further.

2 Likes

Very fun game, love the choice of colors
keeps getting better and better

I did spot a bug tho, initially everything works as expected but has the game progresses some simmer shape won’t combine anymore

Look at the Hexagons on the left

Similar to the previous update

The hearts on the right

But overall, very fun to play

Hmm, I thought I fixed that.

I’ll try some other things to try and solve the problem. I think some of the collisions are happening too fast to register. Setting the collisions to “bullets” might help.

1 Like

Really cool game, nice and chill. I like that there are no timers so I can go at my own pace. A nice simple game where the colors are pleasing and the mechanics are immediately familiar.

2 Likes

Thank you. Words of encouragement help me continue and complete this game.

New update:

Gradually getting it ready for release!

There still are some bugs to fix before it’s ready.

Very nice game. did you used defold default physics engine /box2d/ ?