Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,426 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Converting a script from c-script, having problems #289019
09/10/09 01:55
09/10/09 01:55
Joined: Sep 2008
Posts: 68
T
Tai Offline OP
Junior Member
Tai  Offline OP
Junior Member
T

Joined: Sep 2008
Posts: 68
Since I dislike the way that A* uses a grid-like system, I decided to use Perfect AI's algorithm (with modifications). However, since it's not written in Lite-C, I decided to do some converting. Curiously, the definition of the array, written like...
Code:
define max_nodes 300; // maximum number of nodes that can be used in this demo
define max_arrays 90000; // 300 x 300 (max_nodes * max_nodes)


Gave me the first errors. So I rewrote the variables like...
Code:
void max_nodes [300]; // maximum number of nodes that can be used in this demo
void max_arrays [90000]; // 300 x 300 (max_nodes * max_nodes)


This worked, but it gave me an error right away with this section
Code:
var node_to_player[max_nodes]; // distance from the node to the player


So I searched the forums and found that sometimes [] doesn't work, so I switched to (max_nodes). This worked, and I got all the way down to this.

Code:
index = j + i * (number_of_nodes + 1); // compute the correct index in the array
			if (node_to_node(index) == 0) // if these nodes can't see each other
			{
				node_to_node(index) = 999999; // set a huge distance for the nodes that can't see each other
			}


I changed the [index] to (index), but now the line setting it to 999999 gives me a syntax error no matter what? What am I doing wrong with converting this code? Any ideas regarding this would be nice.

PS. I'm posting a lot of topics atm; sorry for the inconvience.

Re: Converting a script from c-script, having problems [Re: Tai] #289021
09/10/09 02:12
09/10/09 02:12
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
afaik i already translated it to lite-c.

also

define max_nodes 300; // maximum number of nodes that can be used in this demo
define max_arrays 90000; // 300 x 300 (max_nodes * max_nodes)

would be

var max_nodes=300; // maximum number of nodes that can be used in this demo
var max_arrays=90000; // 300 x 300 (max_nodes * max_nodes)

not the one you did.


3333333333
Re: Converting a script from c-script, having problems [Re: Quad] #289023
09/10/09 02:16
09/10/09 02:16
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Actually the equivalent would be:
Code:
#define max_nodes 300
#define max_arrays 90000


Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Converting a script from c-script, having problems [Re: JibbSmart] #289024
09/10/09 02:20
09/10/09 02:20
Joined: Sep 2008
Posts: 68
T
Tai Offline OP
Junior Member
Tai  Offline OP
Junior Member
T

Joined: Sep 2008
Posts: 68
Well that's interesting. I'll take a search of the forum for your conversion Quadraxas!

Unless you didn't release it :S

EDIT: Found it, thanks!
Also I'm seriously off my game today, posting two useless threads. :S

Last edited by Tai; 09/10/09 02:22.
Re: Converting a script from c-script, having problems [Re: Tai] #289025
09/10/09 02:39
09/10/09 02:39
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
What don't you like about A*?


Formerly known as JulzMighty.
I made KarBOOM!
Re: Converting a script from c-script, having problems [Re: JibbSmart] #289026
09/10/09 02:53
09/10/09 02:53
Joined: Sep 2008
Posts: 68
T
Tai Offline OP
Junior Member
Tai  Offline OP
Junior Member
T

Joined: Sep 2008
Posts: 68
Movement, as far as the examples I saw, was grid based, and that's unacceptable for what I'm doing.

Re: Converting a script from c-script, having problems [Re: Tai] #289028
09/10/09 02:59
09/10/09 02:59
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Trust me, that depends on your implementation laugh I'm making an RTS, and if I relied on a regular grid for the nodes I'd be in serious trouble (just too many nodes to consider on that scale; too slow). I have a dynamic node system where visibility between nodes is recalculated whenever a building/obstacle is created or destroyed, and each obstacle has nodes attached to its corners so that the nodes always mark out the best path. Each node knows its children and the cost of getting there.

It's a bit more effort, though!

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Converting a script from c-script, having problems [Re: JibbSmart] #289029
09/10/09 03:01
09/10/09 03:01
Joined: Sep 2008
Posts: 68
T
Tai Offline OP
Junior Member
Tai  Offline OP
Junior Member
T

Joined: Sep 2008
Posts: 68
Yeah. I think if I really needed anything beyond some short range detection(c_tracing), I would use A*, but Perfect AI should be good enough for my needs.

Re: Converting a script from c-script, having problems [Re: Tai] #289030
09/10/09 03:03
09/10/09 03:03
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Fair enough. Just out of curiosity, what type of game is it?


Formerly known as JulzMighty.
I made KarBOOM!
Re: Converting a script from c-script, having problems [Re: JibbSmart] #289031
09/10/09 03:29
09/10/09 03:29
Joined: Sep 2008
Posts: 68
T
Tai Offline OP
Junior Member
Tai  Offline OP
Junior Member
T

Joined: Sep 2008
Posts: 68
I'm doing sort of an open-world fps game. The AI would mostly be stuff like guards (need pathfinding to navigate to say an alarm area), or crowd AI (general movement pathfinding, obstacle avoidance).

(FPS is sort of misleading, since it's a sword-fighting/freerunning(mirror's edge) gameplay)

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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