Well another problem appeared when I tried to optimize the FPS in my zombie game.
Instead of doing "z:collidesWith(whatever)" in the zombie_update code, I switched to doing the zombie collision checks using "on_collision", I did that because it significantly raised my FPS. But! I don't know how to fix the flickering problem that the zombies now suffer from, those poor creatures.
Controls
w,a,s,d = move
mouse = aim and shoot
z = spawn zombie roughly at mouse (haven't bothered to update spawn code when I added the camera)
F1 = start game
Spawn a few zombies so that they surround you and then move around, you will see that their movement flickers.
the lua files you probably want to look at are:
zombie.lua
game.lua
Thanks in advance.
How to optimize hardoncollider collision checks?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 28
- Joined: Tue Mar 20, 2012 10:39 am
How to optimize hardoncollider collision checks?
- Attachments
-
- Zombehs!1.love
- (602.02 KiB) Downloaded 217 times
Last edited by MiniDemonic on Thu Apr 05, 2012 12:47 am, edited 1 time in total.
Re: How to optimize hardoncollider collision checks?
Hmm, I can't seem to get past your menu, clicking on the buttons has no effect, nor does using arrow keys, wasd, enter, or space.
Nevertheless you may want to make sure you are not solving multiple collisions per frame; that was a problem I had before. Happened because I collided with two objects that had the exact same value on one plane, so it hit both at the same time and solved double the mtv. I don't know if that's your issue, since I can't run your game. Menu looks nice though!
Nevertheless you may want to make sure you are not solving multiple collisions per frame; that was a problem I had before. Happened because I collided with two objects that had the exact same value on one plane, so it hit both at the same time and solved double the mtv. I don't know if that's your issue, since I can't run your game. Menu looks nice though!
It was the best of times, it was the worst of times . . .
-
- Prole
- Posts: 28
- Joined: Tue Mar 20, 2012 10:39 am
Re: How to optimize hardoncollider collision checks?
Oh yea, forgot to write that in the OP, to start the game you need to press f1, haven't coded the menu buttons yet heheRefpeuk wrote:Hmm, I can't seem to get past your menu, clicking on the buttons has no effect, nor does using arrow keys, wasd, enter, or space.
Nevertheless you may want to make sure you are not solving multiple collisions per frame; that was a problem I had before. Happened because I collided with two objects that had the exact same value on one plane, so it hit both at the same time and solved double the mtv. I don't know if that's your issue, since I can't run your game. Menu looks nice though!
Re: How to optimize hardoncollider collision checks?
The problem is indeed collision resolution. When there are many zombies around the player and you move one shape to resolve a collision, you are introducing a new collision. That new collision will be detected in the next frame, where the circle repeats. Let me illustrate:
Solving this situation is actually a very hard problem. Searching for box stacking problem might give you some insight.
-
- Prole
- Posts: 28
- Joined: Tue Mar 20, 2012 10:39 am
Re: How to optimize hardoncollider collision checks?
Thanks vrld, once again.
You have helped my so much that I will include you in the credits for the game when I release it.
The game is not designed to have zombies stacked, and this problem seems too hard to solve to even care about it.
I will update the main thread for this game as much as possible. You can find it in projects and demos.
You have helped my so much that I will include you in the credits for the game when I release it.
The game is not designed to have zombies stacked, and this problem seems too hard to solve to even care about it.
I will update the main thread for this game as much as possible. You can find it in projects and demos.
Who is online
Users browsing this forum: Amazon [Bot], Bing [Bot], Google [Bot] and 12 guests