Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 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
AI problem #220510
08/07/08 13:22
08/07/08 13:22
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline OP
Serious User
croman  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
Hi,

I'm using perfect ai with litec and everything worked fine (compute.c) but i found where problem is using beep(); it's in this while loop::
while (paths[(my.start_node - 1) * 50 + (target_node - 1) * node_id * 50 + current_node] != 0)

it cant get into it. that while loop is not true.

is it maybe that i need to use more brackets inside of it like this maybe:
while ((paths[((my.start_node - 1) * 50) + (target_node - 1) * node_id * 50 + current_node]) != 0)


can someone please help me with that?



Ubi bene, ibi Patria.
Re: AI problem [Re: croman] #220616
08/07/08 19:43
08/07/08 19:43
Joined: May 2006
Posts: 90
England
TigerTao Offline
Junior Member
TigerTao  Offline
Junior Member

Joined: May 2006
Posts: 90
England
Have you found out what the sum of all that is before it is used as the while condition?

It looks fine to me (the first one that is) so perhaps the condition equals 0 so the while never starts.

Re: AI problem [Re: TigerTao] #220630
08/07/08 22:09
08/07/08 22:09
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline OP
Serious User
croman  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
yeah that's true. but i'm using perfect ai code and i dont understand why does it happens so.

i could really use some George Pirvu's advice



Ubi bene, ibi Patria.
Re: AI problem [Re: croman] #220651
08/08/08 00:39
08/08/08 00:39
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
i'd put more brackets in there definately, but i guess it's doing what it should be anyway if you got this from a tutorial?

with
Quote:
while (paths[(my.start_node - 1) * 50 + (target_node - 1) * node_id * 50 + current_node] != 0)
it's impossible to see what's going on,

when doing calculations they aren't necessarily calculated from left to right, but in the order of *or/ then % then +or-

what you've written there (if i get this right) is...
while((paths[((my.start_node - 1) * 50) + ((target_node - 1) * node_id * 50) + current_node]) != 0)

which i'm not sure what you want but it's a lot easier to see... current_node is never multiplied, and i'm not sure why you're always muliplying my.start_node with 50,

if you're working off of a nodegrid you have no calculations there for both x and y axis

hope this helps a little but without seeing what you're trying to achieve it's hard to unravel what you're doing smile

Re: AI problem [Re: MrGuest] #220664
08/08/08 06:14
08/08/08 06:14
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline OP
Serious User
croman  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
that line of code is from pirvu's perfect ai, but you're maybe new to 3dgs so pirvu is the one who's writing aum magazine and in aum 27-31 i think he was creating workshop perfect ai, about node based pathfinding, and that line is not working for me for some time.

i also had problems with this kind of code: if(key_w || key_s || key_a || key_d), that line didnt work also without more brackets



Ubi bene, ibi Patria.
Re: AI problem [Re: croman] #220701
08/08/08 13:49
08/08/08 13:49
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
i've just done a quick test for the 2nd line and have no problems with that

Code:
while(1){
	if(key_w || key_s || key_a || key_d){
		beep();
	}
	wait(1);
}


can't help you any further except maybe your compilers having some issues, but there is no way you can visibly check that... hmmm... smirk


Moderated by  HeelX, Spirit 

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