PDA

View Full Version : Alice crashes while I make lists


DamonDragon13
09-17-2012, 11:34 PM
Hy guys and girls,

I am currently making a game for my Mutimedia Gaming class, and I have been working on collision detection for over a term, which has taken up a lot of time, time I could be using to make AI for enemies.The problem is this: When I am making a very long list (Over 100 objects) Alice freezes for about seven to ten seconds and then goes back to normal, which is fine up until I try to save. If this short, without warning freeze occurs at any time and I try to save, Alice will first decide to take roughly fifty times longer to save (I'm not eggadurating with the 50X either) which means if it freezes, I need to shut down Alice how it is and re-open it from the last save, which means I lose a bit of work.

I have tried to make it not happen by saving after every 5-10 items listed but it can happen if I put in even 2. Is there a way to make Alice stop freezing.

Notes - I have only started using Alice this year
- I am listing positioned spheres because using a few spheres around each building or claimable surface is more realistic than listing the actual building, because the building (Or other objects that are not round) will count a sphere around the building, whereas if I list the spheres, I can line them along a wall, etc and I will know the character will collide with the wall, not an invisible sphere around the object.

I appreciate any time taken to help me, this piece of work is due in roughly five weeks I think.

djslater107
09-18-2012, 06:28 AM
Collision detection is very difficult, I admire your efforts... Two possible explanations for the crashes...

1) If you used the copy tool in scene setup to create your spheres, and then added them to your list... Alice does not handle these references well and often gets confused... You would be better off creating each sphere individually (painful, I know)... But this would lead to the second problem...

2) Alice does not handle large numbers of objects in a world very well... When I saw that you had a hundred spheres, I immediately became concerned...

Another way to solve this problem, without using large numbers of objects, is:

- Create a list of all objects you do not want to collide with

- write a world function that takes both the mover and the object that you do not want to collide with as parameters.

---- this function returns true if (mover.width / 2 + target.width / 2) <= collision distance (whatever you determine this value to be); false otherwise

- Every time the mover makes a move, determine which of these objects is closest to the mover (or in front of or some other test). Then call the collision function on the mover and the closest target, and if the function returns true the mover performs its avoidance activity...

This is not a perfect solution, but collision detection is very difficult and Alice does not handle it well...

In Alice 3.x, we have added events that better support collision detection...

Good luck...