Simple Scorched Earth, Worms game

  • Yeah, if you need very complex (or non-polygon, rounded etc.) shapes and pixel precision, the only option is canvas plugin.

    Or you can make some shapes like pixel-perfect circles, ovals, sine waves etc. with math formulas.

  • I see, at the moment i will continue without canvas plugin wonder the limit i can go .

    Also was thinking on destructible moving objects and if i'm right to do that will be something like:

    On start layout + for each SpriteMovable(Family) create a tilemap with Sprite width/height, set tiles for the sprite form and pin pos+angle. I don't know if i'm missing something.

    If all this is possible(And perfomance is still good) i can see a good destruction game here, i'm gonna do some tests

  • If there are performance issues, try increasing the tile size to 2x2. The edges will look a little bit rougher but the performance should be much better.

    I just noticed than in my demo there are 2 identical instances of tilemap object, one on top of another. And it still works pretty fast

  • This is probably off from the direction you're going but here is a way to get the pixels of an image without the canvas plugin.

    https://www.dropbox.com/s/soijvpnt8vjkc ... .capx?dl=1

    It actually just gets the alpha as in transparent 0 or not 1. Every line is separated by a newline.

    It could be modified to give a width and height then a list of pixels but as is is fine imo.

    Anyways it may be useful to someone. To make it work with C3 all that should be needed is to replace 'c2_callFunction' with 'c3_callFunction' in the js file in the files folder.

  • Wow, R0J0hound, you never seize to amaze!

  • dop2000 Oh yes! i don't see that, instance removed!. I guess this means is possible do various tilemaps without problems so to do the objecs movable with their tilemap should be ok with perfomance.

    ---

    R0J0hound Wow! what a workaround, i don't know that can be done in C2 :O

    Well, does the job i want, but uses an image from the project file, is there any way to set to a Family? So, i can add any sprites there to be "rendered" in the tilemap automatically.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It’s not really a workaround, it’s JavaScript that usually is in a plugin. Also it is possible to get the image from other objects if we tap into the runtime functions. It will no longer work when minifying though, and it’s a bit complex as there are many more edge cases to handle. At that point why not just use the canvas plugin?

  • Trying to save objects for perfomance. I mean, for moving objects each one will have their own tilemap and using canvas also they will need to have one but thinking better as you said in the comments i guess will be run one time with canvas on to get the transparency for the tilemap and then save the tilemap family as json and run the gameplay version without the canvas, just loading the tilemaps generated. I don't know if i'm missing something.

    Hope get some time to put all the ideas and organize to make a test to see if all this can be done with a good perfomance. Also adding physics and other stuff like control the pixels in a way to do some Sine movements, maybe there is a way to do a realistic water, sand or similar. Just pushing C2 to the limits to see until what point can be achieved with enough perfomance to build an interesting gameplay.

  • I may not fully understand what you are trying to do, but why don't you destroy canvas objects after you build your tilemaps?

    You can go even further - create a tilemap with a 128 or 256 colors pallet, convert your sprites to tilemaps on start of the game using canvas, and then destroy all sprites and canvases, keeping only the tilemaps.

  • dop2000 Yes is what i'm saying, but instead of destroy canvas just save to .json the tilemap creation and for gameplay just create only the tilemap and load the tiles by .json without even create the canvas object.

    Love the color palette idea using the tilemaps and deleting sprites, so get RGB values from canvas and create X conditions to asociate each RGB color picked with a tile in the tile map to be added.

    The unique thing is that i'm afraid that due is pass from using a single tile to lots of different ones for each color maybe the perfomance can slowdown but well, is another thing to test, thanks!

  • matriax

    I tested the tilemap with 256 colors - it's insanely slow, less than 1fps. When each building is one uniform color, it's fine. But if each pixel is a different color, everything comes to a halt. So forget this idea.

  • dop2000 Oh, thats why i was afraid.

    But, 256 colors and what resolution?

    My idea is a PixelArt game, up to 320x180 resolution and 16 colors max without antialising (Sampling=Point instead linear).

    Mainly keep the specs low to allow do more crazy/cool stuff with this pixel destruction thing, lots of ideas but still working in a simple design with families and all well organized before start the fun thing, hope have some .capx version tonight.

  • I used the same example - 640x480 map with about 30% fill.

    I also tested with only two colors, selected them at random (like a white noise). The result is pretty much the same - less than 1fps. So it's not the number of colors that matters, but how they are placed.

    I think C2 optimizes performance for tilemap - when there are lots of identical tiles grouped together, they are treated as one big tile or something like that.

  • dop2000 Who want a cofee? XDD I can't get the Canvas plugins with alpha working arggg

    One of the problem is that each canvas uses X,Y 0.0 as their hotspot position and they needs to be translated to the layout 0.0 to fit with the tilemap coordinates that is a problem i can't get fixed :S . Also the rezise canvas(Resolution inside the canvas size) not works, when try to resize in any way dissapears.

    This is the .capx

    https://drive.google.com/file/d/1OslraA ... sp=sharing

    (The errors are marked with bookmarks to find easy)

    So due the resize canvas not works after runtime i guess the unique option to achieve pixel-perfect will be using a big canvas set at 0.0 and pass the position of the objects box and look for the alpha if i'm not missing something.

    But, before that i'm gonna still trying other workarounds with the same idea.

    EDIT: Workarounds failed so i tried the Big canvas idea and worked to set correctly the tiles, but seems the expresions to detect the alpha not works, mmm:

    Big canvas:

    https://drive.google.com/file/d/1h44-Hg ... sp=sharing

  • Ok, got working using only one canvas:

    https://drive.google.com/file/d/1PCsZN6 ... sp=sharing

    So sprites with pixel-perfect collision based on their alpha <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    have to work with the bullet-shoot because sometimes get stucked and not does the destruction correctly but well just time.

    When i fix this i will try to some crazy stuff if not achieve i will post there what i done to see if somebody know.

    EDIT: The bullet thing is due the speed of the bullet that starts as 64x64 and then when is created i set as 8x8, but seems already "walked" so the stepping/frames makes collide before get on the collision. Just set in layout 8x8 or in events on starts layout, and then depending of the shot make it bigger to avoid this problems.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)