unit moving through m- rift visual defect

Started by weekendgamer, June 02, 2011, 11:06:58 PM

Previous topic - Next topic

weekendgamer

when you make m-rifts in a diagonal next to each other, with terrain above one and below the other, units and missiles will pass diagonally through the terrain.
Sorry for the late replies.

Grauniad

Aww gee, they are still doing what they were supposed to do. Maybe this is more a visual bug than a real defect? It's not as if you gain some form of advantage that otherwise did not exist, or that it breaks something, right?
A goodnight to all and to all a good night - Goodnight Moon

weekendgamer

#2
sorry, maybe I should have named it a visual defect

edit:I thought it might be a bug because units still take time to travel between m-rifts instead of instantly moving from the center of one m-rift to the other, but when I think about it the game might think that there was no distance between m-rifts. I could investigate this further once the editor comes out...
Sorry for the late replies.

J

So they travelled longer than they must do?
Then this would also happen if you place the next to each other. (didn't test it)

UpperKEES

I've tried the same thing and this definitely is a bug, because the unit should  'jump' instantly from one microrift to the other, so the movement takes more time now:



All 3 Phantom Coils start moving at the same time from a position right of a MR to a position left of another MR:



The Phantom Coil close to the LS arrives sooner, because it has to travel 1 cell less. Well spotted weekendgamer! This could explain the problems we've seen before with MR's (like on the Credits map and on Day 9: Intelligence) that we weren't able to reproduce. There apparently still is a tiny bug in the path finding algorithm.

My CW1 maps: downloads - overview
My CW2 maps: downloads - overview

weekendgamer

yes, i have  tried it when they were next to each other and they still do that
Sorry for the late replies.

J

So Virgil programmed the game that when 2 points are next to each other (also diagonally), it moves normally. If not, it jumps. So Virgil has to test if the 2 points are m-rifts, it must jump. Please tell me if not.

knucracker

You nailed it J.  The unit movement algorithm is just given a set of point to move between.  If they are more than a cell apart, it assumes a m-rift and then does other stuff.  If they are right next to each other, then it assumes normal movement.

The trick is to check for a mrift at the target location every time... I just have to make sure to do this very efficiently, since every little packet will be doing this all of the time.

thepenguin

anyway, virgil, what pathfinding algorithin do you use? (I get the feeling its A*)
We have become the creeper...

knucracker

A* is the algorithm, but I run it without a heuristic so it is actually Dijkstra's algorithm.

thepenguin

Quote from: virgilw on June 05, 2011, 02:24:16 PM
A* is the algorithm, but I run it without a heuristic so it is actually Dijkstra's algorithm.

dijkstra's ?? how does one do the pathfinding for things like packets & units (things that have start and end points) using dijkstra's algorithim?
We have become the creeper...

knucracker

That's pretty much what dijkstra's algorithm is for.  Dijkstra's is just a special case of A*.  The graph that both algorithms operate across is just the 'grid' made up of cells.  Packets emit at the LS and have a target, like a unit, when they launch.  They just need to know the shortest path through the cell array in order to plot their course.

The trick on all of this is to make the algorithm efficient... especially in AS3.  Coding up the core algorithm takes 20 minutes.  Making it efficient and work properly in the game takes 3 weeks.

thepenguin

Quote from: virgilw on June 05, 2011, 07:47:41 PM
The trick on all of this is to make the algorithm efficient... especially in AS3.  Coding up the core algorithm takes 20 minutes.  Making it efficient and work properly in the game takes 3 weeks.

I was under the impression that Dijkastra's algorithim was always less efficient in this type of scenario (i.e. start and end points), and that it had moved out in every direction, making it less efficient than A*
We have become the creeper...

Kithros

It might not really be elegant - but I don't think it would really be necessary for all the packets to check for that (ie. only have units check for it) - the only ways I can possibly see packets being effected at all by it is when the closest microrift to the LS is also directly beside another microrift, which pretty much never happens in normal play. That said, I don't really know how it's coded so that might not really be viable.