Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 620 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Entities getting stuck #435264
01/05/14 05:52
01/05/14 05:52
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Hi, I am working with the free version of A8
I just started a new project and I've got a couple of enemies that move towards the player character.
It all works fine except that when the two enemies collide they get stuck on each other briefly so the movement becomes staggered instead of smooth.
And ideas on how to deal with this?
Thanks

Re: Entities getting stuck [Re: rtsgamer706] #435278
01/05/14 14:18
01/05/14 14:18
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You could post in the gamestudio forums and describe the problem there. If you include the corresponding code in your post someone may be able to help you.


Always learn from history, to be sure you make the same mistakes again...
Re: Entities getting stuck [Re: Uhrwerk] #435279
01/05/14 15:11
01/05/14 15:11
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
But the problem isn't with my code,
it's just that in G8 when you're using c_move commands and two non passable entities collide,
1 stops moving. What part of my code would I need to show?

Re: Entities getting stuck [Re: rtsgamer706] #435280
01/05/14 15:16
01/05/14 15:16
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
maybe this will help.
I'm using:
Code:
vec_set (temp, pOne.x);
vec_sub (temp, my.x);
vec_to_angle(my.pan, temp);


to have the entities face player one, and am just using a c_move command to have them move forwards so they "chase" the player.
If I only have one enemy there's no problems but when I have two, because they are both facing the player, they get stuck on each other during movement.

Re: Entities getting stuck [Re: rtsgamer706] #435282
01/05/14 15:44
01/05/14 15:44
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Originally Posted By: rtsgamer706
But the problem isn't with my code,

Then you're screwed anyways because you can't change a thing, right?
Originally Posted By: rtsgamer706
it's just that in G8 when you're using c_move commands and two non passable entities collide, 1 stops moving.
Of course one stops moving because otherwise it would end up inside the other one. Btw. there is always exactly one entity moving. You cannot move two objects at the same time. Have you set the glide flag?
Originally Posted By: rtsgamer706
What part of my code would I need to show?
The relevant one ... tongue


Always learn from history, to be sure you make the same mistakes again...
Re: Entities getting stuck [Re: Uhrwerk] #435283
01/05/14 15:48
01/05/14 15:48
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
1. Yes I have told them to glide
2. I don't know which part is exactly relevant since my question is about how the collision engine works so here is the entire action that the enemies run:
Code:
action enemy()
{
	c_setminmax(me);
	my.emask |= (ENABLE_IMPACT);
	my.event = hit_enemy;
	my.health = 20;
	my.damage = 0; //1 = took damage (invinci timer)
	var temp;
	while (my.health >= 1)
	{
		vec_set (temp, pOne.x);
		vec_sub (temp, my.x);
		vec_to_angle(my.pan, temp);
		c_move(me, vector(3*time_step,0,0), nullvector, IGNORE_PASSABLE | GLIDE);
	//	DEBUG_VAR(my.health, my.y);
		if (my.damage == 1)
		{
			set (my, PASSABLE);
			wait(30);
			reset(my, PASSABLE);
			my.damage = 0;
		}
		wait(1);
	}
	ent_remove(me);
}


Re: Entities getting stuck [Re: rtsgamer706] #435284
01/05/14 16:59
01/05/14 16:59
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Maybe decrease the collision of the enemies a bit when the player is not too close (almost passable but not entirely so that it won't look stupid). And/or add a bit of code that when enemies come to close to each other, that they change pan so that they move aligned/formation.

Re: Entities getting stuck [Re: Reconnoiter] #435285
01/05/14 17:08
01/05/14 17:08
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
What do you mean by decrease the collision of the enemies? Is there a flag between solid and passable?
Second option is also interesting but may be a bit difficult to program
thanks for the suggestions though, I'll try it out

Re: Entities getting stuck [Re: rtsgamer706] #435287
01/05/14 17:35
01/05/14 17:35
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
I think that just giving them a path finding algorithm would probably make them move around each other.
I would have needed to give it to them in the future anyways once there was proper terrain. Anyone know a good tutorial?

Re: Entities getting stuck [Re: rtsgamer706] #435288
01/05/14 17:50
01/05/14 17:50
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
U should read about "narrow" and "fat", "obstacle avoidence" and "pathfinding". Did u thought a 3d engine handles "correct" movement of models by itself ? If so, no, they wont. ^^

Take a look at Superku's pathfinding.c included in the goodies.zip, if its up to easy non-cost pathfinding.

Edit: Ull find a simple and good oa at bottom of this post:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=428514

Last edited by rayp; 01/05/14 18:24. Reason: added link to oa example

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1