Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Quad, EternallyCurious, 1 invisible), 726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
find_path() function in AUM 109 workshop #461206
07/28/16 18:42
07/28/16 18:42
Joined: Jul 2016
Posts: 9
J
JackPell Offline OP
Newbie
JackPell  Offline OP
Newbie
J

Joined: Jul 2016
Posts: 9
Hello, everyone

I know this may have been posted in the wrong section ,but I thought it is a rookie thing ,so Starting With Gamestudio was my choice for posting ...

In the AUM 109 workshop (named "AI Part 4"), I figured out every part except when it comes to the find_path() function which I didn't understand at all frown
The problem is that the writer of the workshop didn't clarify it in detail and depended on merely writing comments in the code which still didn't help, so I would appreciate it if anyone has helped me understand how this function works and what it does precisely in plain English laugh Also, a brief description of this workshop as a whole would be appreciated ...

Here's the function:

Code:
function find_path(l, j)

{

       i = 0;

       while (i < max_nodes) // search from this node for the rest of the nodes (up to 299 more nodes)

       {

               if ((i != j) && (visited[i + max_nodes * j] == 0)) // the current node can "see" these nodes, excepting itself of course (i != j)

               {

                       if (node_to_node[l + max_nodes * j] == node_to_node[l + max_nodes * i] + node_to_node[i + max_nodes * j])

                       // that's a node on the shortest path because the shortest path includes it

                       {

                               k += 1; // move to the next array element

                               path[k] = i; // and store the node number inside the array

                               next_node = i; // store the new node on the shortest path because it will loose its value right away

                               i = max_nodes - 1; // don't test other values - eliminate other paths that have the same length (that could happen in some levels)

                               if (path[k] == l) // end of search, reached the starting point (l = start_node, remember?)

                               {

                                       return; // get out of this function

                               }

                       }

               }

               i += 1; // increase i if the function continues to run

       }

       j = next_node; // set the next node on the path as target

       find_path(l, j); // recursive function, search for the shortest path again (if it searched (2,10) now search (2,9) and so on)

}


Last edited by JackPell; 07/28/16 18:45.
Re: find_path() function in AUM 109 workshop [Re: JackPell] #461207
07/28/16 20:08
07/28/16 20:08

M
Malice
Unregistered
Malice
Unregistered
M



Is and algorithms like it are a bit above beginners because they require understanding of some higher concepts .

Quote:
// recursive function

recursive function is a bit hard to grab. You can start by googling 'c recursive function" -- I'll also post a link to a video in a edit that helps understand this..

The function basically takes a start and end point then test every node combination between them(Almost more below) at once. It then collects all the shortest 2- point-nodes in the collection of all nodes between. If you know a start and end then you can test the lengths between 2-point-node-sets for shortest till you've found all node on the shortest path.

It's hard to explain and from people to grasp because it's not simple in concept. It's absolutely not expected for beginners to get this, it's just supposed to work till you learn enough to understand it.


Watch video
https://mva.microsoft.com/en-US/training...nHKy_3404984382
Recursion starts at time 1:15:40 or So...
The whole core programming section of video is good to understand, but quite basic and boring if your experienced you'll know all this..

Last edited by Malice; 07/28/16 20:18.
Re: find_path() function in AUM 109 workshop [Re: ] #461213
07/29/16 04:36
07/29/16 04:36
Joined: Jul 2016
Posts: 9
J
JackPell Offline OP
Newbie
JackPell  Offline OP
Newbie
J

Joined: Jul 2016
Posts: 9
I am not really a total beginner laugh I know what a recursive function is from the manual. And that's the problem with me and probably some other users of 3DGS, I kept learning, read the 25 workshops ,then the manual till I became familiar with most functions and built a simple FPS game, then I read AUMs (I was on this forum for months but I decided to use my real name on new account) ...

The problem is that I reached a point that I can't move on from to something more advanced like a simple pathfinding. I am stuck in a strange way frown and just don't know how to improve my knowledge. Especially that the AUMs stopped for a couple of months and they kept making workshops on game dev business. I am a total hobbyist and I don't study computer science in college ,but I am really obsessed with game making ...

So, I really want to jump to the next level .. I don't want to be a beginner anymore ...

Thank you for helping any way laugh

Greets!

Last edited by JackPell; 07/29/16 04:53.
Re: find_path() function in AUM 109 workshop [Re: JackPell] #461214
07/29/16 06:12
07/29/16 06:12

M
Malice
Unregistered
Malice
Unregistered
M



Well --- Good luck let me know when you figure it out. Then maybe you can teach me!

Jack use the web and get your education in programming outside of this place and that manual. Google some really basic path finding, even old stuff. I C if you good with lite-c. Start to recreate it simple , then expand. Make a study of path finding. As you read through where it started and how it got to now. As you study the code, logic, math and langue in your adventure, you will look up new and other things.

How can a dot product cut the number of node to check in half? Can a lerp or tangent be used to interpolate past a middle node in a 3 node chain? What the heck is the logic of A* without all the crazy math?

Or don't go through programming the hard way - grab a newer engine and just use the path finding out there. There is no point in reinventing the wheel. Find a path finding package and just use it. That's the idea of the AUM too some point... If you don't want to be a programmer and even a programmer not limited to games than don't.

It's a love of logic design and computer science.

Learn just level scripting and level/play design. The programmers can write the hard code, you just grab the assets and use scripting to access the stock stuff than bring the game to life! Do you want to figure out how to make a model melt into water then turn into a bubble? Or do you want to script the encounters with the bad who melt when the player enters level room-22?

Quote:
Scripter[edit]
In early video games, gameplay programmers would write code to create all the content in the game—if the player was supposed to shoot a particular enemy, and a red key was supposed to appear along with some text on the screen, then this functionality was all written as part of the core program in C or assembly language by a gameplay programmer.

More often today the core game engine is usually separated from gameplay programming. This has several development advantages. The game engine deals with graphics rendering, sound, physics and so on while a scripting language deals with things like cinematic events, enemy behavior and game objectives. Large game projects can have a team of scripters to implement these sorts of game content.

Scripters usually are also game designers. It is often easier to find a qualified game designer who can be taught a script language as opposed to finding a qualified game designer who has mastered C++.


Disciplines are here
https://en.wikipedia.org/wiki/Game_programmer

Pick a focus... I wish I had. Here in this engine this forum you kind of touch it all and all on your own... And you never get good at any of it. We have the shader guys and physics guys, I've now a sound programmer and a UI programmer... Those that specialized got good. It's a team sport - or rather a team JOB, just like banking of stocking store markets, it's smaller teams in a greater team, in a collection of unrelated teams... This how all things work.



Last edited by Malice; 07/29/16 06:34.
Re: find_path() function in AUM 109 workshop [Re: JackPell] #461217
07/29/16 10:24
07/29/16 10:24
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: Malice

Pick a focus... I wish I had. Here in this engine this forum you kind of touch it all and all on your own... And you never get good at any of it. We have the shader guys and physics guys, I've now a sound programmer and a UI programmer... Those that specialized got good. It's a team sport - or rather a team JOB, just like banking of stocking store markets, it's smaller teams in a greater team, in a collection of unrelated teams... This how all things work.
, not always. Although it is hard, I have seen some lonewolves create awesome projects. It just depends on the person, hobby/work and whether you are working as an indie or in bigger companies (in which case specialization is probably always(?) required).

Originally Posted By: JackPell
The problem is that I reached a point that I can't move on from to something more advanced like a simple pathfinding. I am stuck in a strange way frown and just don't know how to improve my knowledge. Especially that the AUMs stopped for a couple of months and they kept making workshops on game dev business. I am a total hobbyist and I don't study computer science in college ,but I am really obsessed with game making ...

So, I really want to jump to the next level .. I don't want to be a beginner anymore ...

Thank you for helping any way laugh

Greets!
, I know how you feel. Gamestudio 3d lacks some intermediate/hard tutorials.
A few suggestions:
-> when you hit a specific problem or obstacle, just ask it in the forums.
-> search this forum for some more advanced topics like pathfinding.
-> maybe the check the wiki for some more tutorials.
-> create some minigames or simple games to start with, learning along the way.
-> use an other engine like Unity.

Last edited by Reconnoiter; 07/29/16 10:28.
Re: find_path() function in AUM 109 workshop [Re: Reconnoiter] #461224
07/29/16 15:22
07/29/16 15:22
Joined: Jul 2016
Posts: 9
J
JackPell Offline OP
Newbie
JackPell  Offline OP
Newbie
J

Joined: Jul 2016
Posts: 9
Obviously, pathfinding is really hard ..
Thank you guys for help and I already started learning new engine laugh ..

Re: find_path() function in AUM 109 workshop [Re: JackPell] #461227
07/29/16 17:50
07/29/16 17:50
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: JackPell
Obviously, pathfinding is really hard ..
Thank you guys for help and I already started learning new engine laugh ..
, keep in mind though that pathfinding is hard regardless of the engine. However I think atleast e.g. Unity has the some functions/features to help with e.g. A*.

Re: find_path() function in AUM 109 workshop [Re: Reconnoiter] #461232
07/29/16 22:27
07/29/16 22:27

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
not always. Although it is hard, I have seen some lonewolves create awesome projects. It just depends on the person, hobby/work and whether you are working as an indie or in bigger companies (in which case specialization is probably always(?) required).

Well yes but this is called an exception.. It's even harder to find a lonewolf that never used out-box-solutions, design and wrote all parts from their own mind(AI, Pathfinding) without deep study of the known Technics, didn't use a current or simplified engine or a in-house engine and tool set, created all assets and shaders and content by themselves, and was hailed a wild success with a stunning project. That very much is the definition of genius prodigy which is in life is the definition of and exception, and not a target goal to measure oneself against.
And your are right about ones goals... I start want to make a game, I then wanted to work as a pro game programmer, finally after talks with people lone left the forum and work as high level real programmers for big names, I wanted to have as my job programming period. Even if it wasn't games. I wanted to work and make money write code and logic designs for software.

So Jack gets two views but vary valid, mine and yours.

hehe
Mal

Edit --
@Jack
-----> use an other engine like Unity.----
Even if you are not using unity or UE4, their forums and stuff can be studied too when looking for the higher level that the 3dgs tutorials don't offer. Because programming is logic in design not an engine or langue... You can convert their logic to your tools and that is one hellofAh learning experience.

Last edited by Malice; 07/29/16 22:30.

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