Pixel-by-pixel destructible terrain?[Yup, why not]

Get help using Construct 2

Post » Tue Dec 24, 2013 10:50 pm

:o thats pretty sexy *assimilates*
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Wed Dec 25, 2013 1:02 am

@JJList
This reply is a bit late but as for the original clearing I couldn't get it any faster by not using sqrt.

As for using the pixels from the canvas object here's an example:
https://dl.dropboxusercontent.com/u/5426011/examples21/canvasWithTileMap.capx
It is very slow, for me the whole bit takes about 5 seconds to transfer the canvas to the tilemap.

So on a whim I also did a test with a snapshot and straight javascript using the browser object since I didn't want to make a plugin.
https://dl.dropboxusercontent.com/u/5426011/examples21/snapshot2tilemap.capx
For me it takes about 3 seconds. After looking at the times I think it can be made faster by bypassing the array and just converting the pixels to a format the tilemap can load. But that isn't a simple task as the format is pretty complicated.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Wed Dec 25, 2013 1:50 am

Bravo for getting that to work form the browser object!

The only problem is snapshot only gets the view port.
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Wed Dec 25, 2013 7:31 am

Well you don't have to use the snapshot, it can also load images in the files folder.

So as in the title "why not", I updated this further. It now converts an image directly that can be loaded into the tilemap object. Right now it just does tile/no tile based on the alpha of the pixels, but it can be tweaked to use different tiles based on color.
https://www.dropbox.com/s/vsq1xdlyvr7od ... .capx?dl=0
Also on the plus side it's much faster. For me it works in just under a second for a 1280x1024 image.
Last edited by R0J0hound on Sun Mar 26, 2017 5:38 pm, edited 1 time in total.
B
94
S
33
G
118
Posts: 5,393
Reputation: 75,847

Post » Wed Dec 25, 2013 9:14 am

replying to bookmark this for later reading....
B
28
S
5
G
2
Posts: 77
Reputation: 3,087

Post » Wed Dec 25, 2013 2:58 pm

Never would have thought of loading an image. That's the k.i.s.s. method at its finest.
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Wed Dec 25, 2013 5:37 pm

@R0J0hound That is brilliant! Exactly what I expected to see!:D
Tile/No tile works perfect if we want to use generated tilemap as a collision mask;)
As for colored tiles.. Well, that might be a bit harder, but still possible :D Well, at least for 8bit color palette ^_^ 256 tiles, not too hard:)

Here is a little demo of a 1pix TileEditor that I'm trying to create.. Not sure if it's useful:P But anyways, it's a nice chunk of experience for me:)
I thought I'd have a bit more time to work on this one, so it is now at a very early state:(
Right now you can only draw/erase tiles by hand, using simple brushes and 4 colors.
Should've done it faster, but when it comes to drawing and setting up GUI interactions, I'm just too slow and pedantic

Works a bit slow in browser.. But it's pretty fast in node-webkit preview.
I'm totaly going to include image-to-tilemap generation and save/load/export functions in later versions:)
Also I'll try to implement zooming/scrolling and setting canvas(our entire tilemap) size.

Plz let me know if you find any bugs! And also I'd appreciate any ideas on what functions should I add JJList2013-12-25 17:40:43
B
18
S
5
G
1
Posts: 74
Reputation: 2,672

Post » Wed Dec 25, 2013 10:47 pm

@R0J0hound awesome! I guess Pixel Press team will be mad at you.

http://projectpixelpress.com/

@JJList Nice editor, it reminds me some Amiga software, it's still awesome, the biggest problem C2 lacks RGB color feature to apply brush color.Joannesalfa2013-12-25 22:54:41
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Sat Mar 22, 2014 10:25 am

R0J0hound wrote:@JJList
This reply is a bit late but as for the original clearing I couldn't get it any faster by not using sqrt.

As for using the pixels from the canvas object here's an example:
https://dl.dropboxusercontent.com/u/542 ... leMap.capx
It is very slow, for me the whole bit takes about 5 seconds to transfer the canvas to the tilemap.

So on a whim I also did a test with a snapshot and straight javascript using the browser object since I didn't want to make a plugin.
https://dl.dropboxusercontent.com/u/542 ... lemap.capx
For me it takes about 3 seconds. After looking at the times I think it can be made faster by bypassing the array and just converting the pixels to a format the tilemap can load. But that isn't a simple task as the format is pretty complicated.


I was wondering, using a 16*16 tilemap (256 colored pixels), could we potentially have a way to load an 256 color image and choose one particular value that would count as transparent if we could read the different color identifiers of the image (like the top left pixel would be the transparent one) without too much trouble performance wise?

Because I think this is a good concept, but I don't know how much time it would take to perform identification process.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Sun Mar 26, 2017 4:51 pm

@JJList, hi friend, can you reupload the Mask generation example again?
B
12
S
6
G
1
Posts: 24
Reputation: 1,612

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: WesleyDeveloper9 and 7 guests