ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > CopperCube Open discussion
forum topic indicator 2D Alpha-channel based collisions
person icon
veganpete
Registered User
Quote
2023-07-05 07:46:45

When I first started out a few years back, I used something called "Scratch" which is a basic coding-language with blocks of code that are drag-and-dropped together to make a game. It's an extremely basic (but quite capable and fun) game engine, for making many types of games, simply by importing images (or drawing your own) for sprites and levels and clipping the code-blocks together in scenes.

A much-loved feature which was particularly cool:

If you imported a transparent png image to create a scene, the engine was capable of creating paths and collision just from coloured pixels and the transparent alpha channel of the image.

EG: You could make a car or character follow a path, just by use a png image of a road (or even a simple line) and a png of a car. To make a platform game, you simply draw the level and then draw a person. The character node automatically collides with pixels and is free to travel around the alpha channel area. For player collision, it simply uses the pixels of the sprite to calculate precise shape-based collision - if a single pixel touches another pixel, collision is detected.

It does this by monitoring the alpha-chanel/pixel colours directly beneath the node's layer - the resolution is restricted to being quite low to ease the collision calculations but you can use layers of images for multiple collision planes.

It's something I always think of whenever I'm using coppercube and imagine it's possible to recreate in coppercube - maybe using a shader or a script or a simple command every few milliseconds. I'm fairly sure it's simple enough to do and certain it's low on resources for an engine. It wouldbe a great feature to have in coppercube if possible.

Another great feature (but would be harder to implement into coppercube) is obviously the visual coding; it's very intuitive and easy to use. The API just snaps together (drag and drop from their scene graph explorer), the shapes have "jig-saw" ends so you can't make mistake of clicking incompatible commands/instructions together - this means you don't need to type or learn to code anything. They're all colour-coded to make it even easier/intuitive..... all behaviours are purple, all actions are orange, all variables are green etc. It also gives an instant way of seeing/editing all the code/loops in real-time, rather than having to click in/out of many nested windows/actions.

Here's the link to the engine if anyone is interested in exploring the idea of implementing some of those features into coppercube. I think the transparent alpha collision is a great idea for 2D games.

https://scratch.mit.edu/projects...

person icon
just_in_case
Moderator
Quote
2023-07-07 06:22:04

I also personally like to have alpha based collision, as since the begining I am more into 2D games, instead of 3D. So yeah the collision based on transparency will be good. will see if I can do something regarding this.
I was busy lately and didn't got enough time to work on anything, and tbh some of the people in community just became so much toxic that it started affecting my mental peace.
But I will try to ignore those people and will focus on what I have been doing all these years.

person icon
VP
Guest
Quote
2023-07-10 08:19:05

I've always appreciate your kindness and help and enjoy your participation in the forum. You're clearly a good person, I understand your position with toxicity - it can become damaging and difficult to navigate,especially when it's undeserved. emoji icon_cry

person icon
andgameplay
Registered User
Quote
2023-07-10 19:37:58

I love the Scratch engine VP!!! I made some 2d games there and really is a wonderfull tool, very easy and powerful! visual scripting from Scracth would be great in Coppercube and action using the colors aproximity!

I appreciate your kindness too just_in_case, you help a lot the communnity, and the Coppercube is so good because of you too! You give so much work in free to everybody, you deserve everything good!

person icon
Guest
Guest
Quote
2023-08-02 19:33:04

@Just_in_case, it's been long since I heard anything from your side, your discord server seems to be dead as well, no activity at all, hope you are alright, but is this the reason that you mentioned above because of some toxic people you are not showing up in the community anymore, I have a great question or idea for you, if you want to get involved into.

person icon
Dieter
Guest
Quote
2023-08-27 09:37:04

Sounds like a great idea, to use alpha channel for collision detection. But you also need to consider that this means the program must be able to read pixels. Would be too slow to peek into an imagebuffer each time, so you'd copy the alpha channel to a 2D array after loading. It is still kind of an intensive collision check, as you have to compare the entire overlapping area. But it gives you a very flexible collision detection, indeed.

At just_in_case, yes, ignore the poison pukers, and more importantly, never force yourself to do code, or be present in a certain community. Make a break sometimes, whenever you feel like it. This might be true for everything in life. Be a sovereign, free entity. Joy is a human right.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |