I have created a grid based enemy movement. it selects a random number between 0-7 and selects a direction accordingly, then it runs the grid movement code i have written (which isnt the problem, it works fine). I have collision detectors generate at the start of frame around each enemy in the correct places but they dont work.
If i have just one enemy on screen the collision detection works fine. as soon as i put more than one in it forgets all about them and the enemies walk over everything. Im assuming this is due to my use of a qualifier to determine the enemy.
Do i have to do some sort of spread value code for the collision detectors to work? and if so how do i do that cause i have no idea how to use it.
If i could use qualifiers in object behaviors i wouldnt be having this problem but thats just a fevered dream of mad man.
If you dont know what im talking about i will add some code but its quite lengthy and extremly confusing to anyone but me.
In a project I did long ago, the thing that moved was invisible. While the enemies were in "move state" (Like A = 1 or somethings) they would be placed on top of this object. The detectors were placed using this dummy object (So I only had 4 detectors for any amount of enemies on the field). All the Enemy behavior code was then contained in this one object, which made the process much simplier. I believe that I also coded the player movement in this same object so I could just flag units as enemy/friendly and use that one object to move all the characters, but I could be wrong. But now I'm rambling.
thx for the help guys, ill prob be back on this thread soon as i have never done this before. cant be too hard though.
if its as easy as Benta is saying then i shouldn't have a problem.
Yeah well, using TGF for 5 years has it's effects, like odd coding practices. The other reason I did was so that I could have 3 more throwaway values; cause 3 values just isn't quite enough for a tactical game (When dealing with attack/defense/etc).
after careful analysis i have found that it doesnt work as well as i thought, all the collision detection now works but the movement has been restricted to only one enemy, the others just turn to face the direction they should move but dont move anywhere,
I think im gonna have to do some object specific codes to remedy my problem.
Before you go about it like that, check to see if simply running the objects one at a time will fix the problem. Sounds like you AI is trying to run all at once, and that's where it's getting confused.
Sounds like there may be some fastlooping that needs to be done :\.
Glad I could be of SOME assistance, maybe you could post a mfa (or cca but that means I can't try and help) with just the enemies and their detectors etc? Then everyone can try to help.
Yeah im reall stuck now, i have tried everything i can do and its still not working, If i have just one enmy then it works perfectly, so the code is getting confused like shabb said. i will post the mfa in a while, ive gotta pop out but if you could take a look for me i would greatly appreciate it.
what might be earsier is (if its not too much trouble) would be for you to make a quick grid AI for me to see, i know this is cheeky but my code would prolly be unreadable even if i did put it up. i am trying to make it so the code will control all types of enemy with only one movement, (all enemies can move the same in this game, it wont be weird) its a 20x20 grid. If this is possible i will possibly flood my trousers as this is the last peice of code in my game engine, once done its plain sailing.
Oh and lastly, do you know of any good places for me to upload my mfa to?
Thx again.
n/a
Peblo Custom ratings must be 50 characters or less
Registered 05/07/2002
Points 185
10th November, 2007 at 19:49:27 -
I can spread your value for free
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath
Peblo Custom ratings must be 50 characters or less
Registered 05/07/2002
Points 185
10th November, 2007 at 19:53:47 -
From what it sounds like, you're making it harder than it needs to be. Only one set of collision detection objects is necessary. I'll make a mfa if I find mmf again.
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath
thx peblo. i really do appreciate this, i have now remade the enemy AI several times and it wont work either way. I think the problem is that the enemy colliosion detedtors have to detect a qualifier. If this wasnt the case i think i could do it.
The reason for this is that alot of the tiles are animated and have to be Active objects, all these objects are quilified "Neutral". This stops me from doing the code in the object behaviours (which would solve the problem) so it all has to be done from the main coding screen.
Again this is a real help and if anyone feels like doing a quick Grid based enemy AI i would be extremly appreciative and credit will be given without a doubt as this will allow me to finish my project.