Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

9 years ago by Dejan

Hey everyone,
I'm trying to creat some custom collision tiles for a game i'm working on.

What I wanted to archieve is something like this (the first collision box next to the test player)
/><br />
<br />
That's why I tried to add this to the "collision-map.js" :<br />
<br />
## 46: [0.2,0, 0.2 ,0, SOLID], ##<br />
<br />
Unfortunatley this didn't caused any collisions. By turning it into that:<br />
<br />
## 46: [0.2,0, 0.2 ,1, SOLID], ## <br />
it worked the way it was supposed to be on at least 3 sides. <br />
<br />
<img src= // If we project further out than we moved in, then this is a full // tile collision for solid tiles. // For non-solid tiles, make sure we were in front of the line. if( px*px+py*py >= vx*vx+vy*vy ) { return solid || (lvx * (ty-vy) - lvy * (tx-vx) < 0.5); }
By trying to modify this I made some parts work while others stoped working. So I wanted to ask if anybody here already is having soem expirience with creating custom tiles and can tell me where I'm going wrong. or how I can make this work.

And I'm aware of the fact that I can just set the normal tiles size of the collision layer to 1/8 of the current size. But this is strongly increasing the number of needed Collision tiles which seems to be affecting the performance quite strongly.

9 years ago by drhayes

I worked on a game with custom tile defs and they looked a lot like yours:

  // Impact stops at 55. Let's start at 80.
  // From collision-map.js:218.
  var H = 1/2,
    N = 1/3,
    M = 2/3,
    SOLID = true,
    NON_SOLID = false,
    tileDef = ig.CollisionMap.defaultTileDef;

  // Right-half solid.
  tileDef[80] = [H,1, H,0, SOLID];
  // Left-half solid.
  tileDef[81] = [H,0, H,1, SOLID];

The difference is I didn&039;t use 0.2 I used 0.5 (#H). What's the tilesize of your maps? Maybe 0.2 is too small relative to the magnitude of your sprites' velocities? That can cause "tunneling" under these kinds of physics systems.

9 years ago by Dejan

Hey drhayes,
I actually started by using 0.5 as well. Unfortunatly the error stayed the same.3 Sides of the tile are working perfectly and after touching the edge of the newly created one you are getting teleported backwards.

I'm using a tilesize of 32. And it doesn't seem to be effected by the velocity (100 or 10 the result is the same).

edit: Here the best build to see what's happening if you touch the custom tile from the right side https://dl.dropboxusercontent.com/u/51029492/test_build/index.html

9 years ago by drhayes

Your example isn't working for me. It's 404ing when loading some assets and nothing but the tile background is showing up.

9 years ago by Dejan

What happend there O_o When I locally tested it, it worked without problems but opening it online with the dropbox link it indeed is erroring @_@ anyways I baked and uploaded it again and now it seems to be working without problems (i really have no idea what went wrong before)

Anyways thanks for trying to help me and the link is still the same https://dl.dropboxusercontent.com/u/51029492/test_build/index.html

9 years ago by Joncom

Doesn't this over-complicate things?

If you want tiles that are 1/3 the size, why not just make your collision-map tilesize 1/3 the size, and create the collision-shape out of smaller squares?

9 years ago by Dejan

Hey Joncom,
this actually is one of the ways how i I did it in the past. For smaller games this is working perfectly but if the game is a little bit bigger than you need to save performance where ever you can. And I made the experience that many collisiontiles can have quite the impact on the performance of the game.

And now imagine that I instead of tilesize of 32 I would take 16. Then I would need 4 Tiles to make up for a normal one. This at some point would still be okay but if i would half the 16 too 8 then I would already need 16 collision tiles just for a normal one. And this is just too much. At some point using invisible entities is working as well but at some point they are leading to several problems.

That's whyI came to the concluson that custom collision tiles are the best solution for that.

9 years ago by drhayes

So, no more errors... but I'm still seeing the checkerbox image but nothing else. What inputs do I use? Should there be entities there?

Here's what I'm seeing.

9 years ago by Dejan

Interesting, the static screenposition of firefox and google chrome had been at different places.... Anyways I quickly centred the camera to the rectangle and now it should work.

9 years ago by drhayes

Wow, that's really dramatic and terrible! I wasn't seeing anything like that in the game I did with custom tiles. I wish I had a good answer for you.
Page 1 of 1
« first « previous next › last »