craftyjs/Crafty

Nightly build breaks my game

matthijsgroen opened this issue · 12 comments

I want to prepare my game to use the latest version of crafty, but a lot of changes since 0.8.0 seem to break my game:

  • Crafty crashes when removing a component that was not added (fixed in #1162)
  • Scenery build up uses parts that are attached to eachother. somehow the attached part is no longer visible (has something changed here?)
  • Normally when the ship touched the edges of the screen, it was merely pushed back. Now, the ship instantly explodes... (has collision detection changed?)
  • The ship even explodes during the intro animation

Is there a clear list of changes so that I know if I need to change some things in my game, or that there are bugs in Crafty that were not detected before?

I've recorded a video of the game running in Crafty 0.8.0, and in the Crafty Nightly build.

https://www.youtube.com/watch?v=2HhmVEDtypk

There have definitely been some breaking changes; I'll try to put together a full list, but for now I'll link to some PRs that are likely suspects.

There were some changes to how motion works that might be screwing up your game, as well as some implementation changes to collision detection that could be producing bugs. Here are the PRs:

  • #1146 (removes the "Moved" event and changes to how "Move" is triggered. In particular, x/y motion will now happen at the same time for objects with Motion.)
  • #1147 (Optimizations to collision methods)
  • #1144 (Split filtered/unfiltered spatial hashmap search into two methods)

I compiled a full list of release notes and added them here, with a section listing breaking changes.

I'll hold off on creating a testing branch until we figure out if the problems you're seeing are due to breaking changes or bugs.

Wow super! I will try to update and make the game compatible If I find anything that is missing I'll report it here.

One of the issues was that I used the shift method with only an x provided (assuming the y would automatically be 0) This was not the case, so I needed to add the extra argument for y)

if (x || y) this._setPosition(this._x + x, this._y + y);

Thanks to the list the game is almost working again! I will close this issue later and add the stuff I needed to change (that could help others)

Cool, I'm going to go ahead and create an "official" testing branch.

The only thing that is not correctly working is the collision detection.

collision-issue

I marked the 'Solid' areas in red, and the ship should be kept in this area. for collision with the top and the left of the screen this seems correct, but not with the right or bottom of the screen.

Having a collision 'shape' or just use the entire entity as shape makes no difference (I disabled the shape and show the entire entity with 'SolidHitBox' here.

With 0.8 the collision is correct, resulting in this:

collision-issue-0 80

@starwed any hints what I should change to fix this? or is this an issue within Crafty?

For me the 'Solid' and 'Edge' Items did not have the 'Collision' component. When that is added, the collision is correct again. Is this the way to go?

Fixed at #1168

Sorry, somehow didn't get any github notifications for these comments! Luckily I ran into the same collision issue myself, glad it resolved the last (?) of your problems with 0.9 as well.