I bet Jow Forums can't write a pathfinding algorithm without googling how to do it

I bet Jow Forums can't write a pathfinding algorithm without googling how to do it

Attached: Screenshot-4 (1).png (640x480, 55K)

if (blocked) {
getUnblocked();
}

Of course not. Do you imply I'm some sort of lowly gamedev that does that every day, so I'd need to know it by heart?

fpbp

I, too, got filtered at day 15

Basic breadth first search.

you don't need googling, if you githubing.

What about stackoverflowing?

>not duckduckgoing

I bet people here remember A* algorithm perfectly.
[spoiler]Except LARPers[/spoiler]

vx = xTarget - x
vy = yTarget - y
move(vx, vy)

how'd I do

?

For 2D, a BFD.
For 3D, BFD with cacheing and a "good enough" heuristic.

I bet you can't suck black man's dick. Would probably choke on it. Dumb mouthlet

this.

what about obstacles

I actually had to implement some of the more complicated ones for my master's thesis (e.g. D*-Lite).

You did not specify any

>without googling
Why can't you Bing it! yourself?

Why reinvent the wheel? It's like reimplementing arraylists or strings because you want to prove that you can do it. So fucking what? Is anyone going to give you a tiara for reinventing string?

Now, if you can actually make a better one: by all means, knock yourself out.

yea but you just drew a line

Sounds like a problem for the Virgin pathfinding algorithm while a Chad algorithm takes the direct route.

Fix this, nerd!

Attached: uBzf9.gif (400x300, 2.18M)

Pythagoras theorem for distance

sqrt((y2 - y1)^2 + (x2 - x1)^2)


Normalise the direction by finding the difference between the positions and dividing by the distance. Then multiple by speed (Amount to move per cycle.

next_x = (x2 - x1) / distance * speed
next_y = (y2 - y1) / distance * speed


Good enough for most games.

That would require understanding algorithms.
Great deal of Jow Forums is phoneposting "tech fan" lanklets who haven't done anything more complex than compiling ready sources, but have strong opinions on how you should be using C and asm for everything from webdev to AI.

Attached: 1531589844486.png (1024x719, 806K)

Attached: corner.png (482x377, 5K)

>implying you can't read on phones about AI, C or asm

Attached: tumblr_pb7kovTQ0M1xofy75o1_640.jpg (640x793, 59K)

>average phoneposter reading comprehension

just dijkstra everything, fuck A*

>implying that theory not enough

Attached: grayons.png (720x736, 177K)

>without google
Ok. Allow me to consult this textbook of knowledge, since memorizing infrequently utilized algorithms is asinine.

>pathfinding is a gamedev-exlusive problem

Attached: who-would-win-the-sun-2-trillion-george-costanza-5083388.png (500x356, 62K)

gamedev here

got bfs, dfs, djikstra, a* and jps on the back of my hand

pls do not reply to Jow Forumsadgeteers

>grabs textbook
Heh nothin personal kid

Goddamn, why does the stupid shit always make me laugh

Everything else uses Neural Networks

Sun is approx ~10^30 kg
1 trillion Constanzas is ~2x10^14 kg

The sun wins, since the Costanzas would die very quickly with nothing to sustain them. Even if you were to fling them into the sun as a massive Constanza bullet, the Sun simply is too massive for it to matter.

>create nodes
>floodfill

Brainlets need university for this

while(x!=xdest&&y!=ydest)
{
switch(rand()%4)
{
case 0:
MoveLeft();
break;
case 1:
MoveRight();
break;
case 2:
MoveUp();
break;
case 3:
MoveDown();
break;
}
}

Guaranteed to complete when given enough time.

Throw a ga at it like I do for everything.

If you didn't use google you would just reference a book on algorithms. Why resolve a problem someone already has solved? That's inefficient.

If you want to get into the study of pathing algorithms, then there are books on this.

Wouldn't the gamedev solution just be to use an existing library?
Isn't that the correct answer anyway?

depth first is faster.

You calculated the mass but you underestimated the strength of the cant'standya.

gottem

On a grid? You better be pretending to be retarded, nigger.

why would you use a library for an algirithm thats about 150 lines of code

its a feature, how else am i supposed to impress my girlfriends dad.

What sense is there in reimplementing something?
In no perspective does it make sense.
Wasting time actually typing the algo, and the abstractions around it, but also by not using a preexisting library, you completely eliminate the chance of de-dupe.
People probably already have the library on their computer.
>but it's only a waste of 30 minutes and a few kb
literally why waste either?

Wanna know how I know you suck at programming?

because it's literally more work to interface with another library than to do it yourself

Why wouldn't you? Not using existing code "just cuz" is just being contrarian.

No, because as this very post implies, you like to waste time. It's not worth my continued attention.

>hasty generalization
I'm sure this applies to all engines and projects...

generalization? In this specific case, it's like twice as much work to go find an appropriate library, then convert your map data structures to something the library will understand, than to just do it yourself

What specific case? There is none.
"gamedev" could be using straight up prefab unreal shit or custom implemented engine.
If you're working with something often enough to remember it, then you'd benefit from using a library rather than reimplimenting it per project.
This is programming 101.
DRY

Not stacking libraries for trivial shit isn't a waste of time. It's proper professional work

KISS > DRY

>"gamedev" could be using straight up prefab unreal shit or custom implemented engine.
thats the reason you write it yourself
a library is a generic, your data is in any format, considering pathfinding is a simple algorithm it's easier to just write it yourself
that's like saying you download a library when you need to sort something

this isn't hard to figure out

also, why are programming solutions called "algorithms"? You could literally have a very simple way of doing this and it'd be considered an "algorithm". Such a pretentious word used only among pretentious academic types.

Don't bother with him. This is the mindset of a programmer that just came out from college or has very little real world experience. I deal with these types all the time. Their idea of solving a problem is googling for a library that solves it in the most confusing possible way, and then wasting time trying to integrate it. Then they repeat this process until the project relies on 100 libraries and 3 frameworks and the code needs to be constantly updated to keep up with the updates for those libs and frameworks. Meanwhile a decent programmer does the same job with far less code and nearly zero headaches. And somehow they even find the proper libraries with a much higher success rate

'algorithm' doesn't imply that it's super complex or hard to understand

The definition of an algorithm is "a series of steps needed to achieve some result". Stop being so illiterate.

its no skin off my back if he doesn't believe me, library stacking doesn't make you a good programmer, the sooner someone realizes it the better

This reeks of self convincing. As expected from gamedevs.

>150 line algorithm
>stacking 100 libraries
I bet you people are more concerned about job security than actually being efficient.
>trust me, we have to reinvent the wheel again this week or it's just not going to work right guys ;))

For an algorithm that small, the cost of actually interfacing with the library is much higher than simply writing it yourself

>rolling an A* or BFS takes more than 30 minutes
Found the idiot. Enjoy your libraries

How different are your data structures really across projects? You expect me to belevie you're making something hyper specific each time you need this? As if it wouldn't take 2 seconds to modify a library after the first project.

I can't believe people are actually trying to justify rewriting solutions and wasting time without basis. You have the preconceived notion that interfacing with a library is inherently difficult and somehow costly.
I'm not buying it.

Based on what I've read so far I think it's an accurate estimate for the debug time introduced from someone of your caliber.

>How different are your data structures really across projects?
For pathfinding? Incredibly different, it could be anything from a 2D square grid stored as an array to a 3D convex polygon navigation mesh stored as objects to anything it between.
>You have the preconceived notion that interfacing with a library is inherently difficult and somehow costly.
Not preconcieved, it comes from experience
It'd be nice if all libraries were just "here, copy and paste my code and do what you want" but that's rarely the case

As a matter of fact Jow Forums cannot write a pathfinding algorithm EVEN with google, Advent of code 2018 made me realize that most of Jow Forums likes to talk big but they're absolute shit at programming and struggle with even the most menial tasks

>Advent of code 2018 made me realize that most of Jow Forums likes to talk big but they're absolute shit at programming and struggle with even the most menial tasks
it took you that long?

>a series of steps needed to achieve some result
so.. programming?

>a board obsessed with consumerism does not know the first thing about technology
Shocker

It's almost like all the good programmers are busy working instead of doing it for hobby.

Next time you're gonna tell me Jow Forums is actually a shithole that attracts people who start pointless arguments about consumer devices while using anime reaction gifs instead of discussing technology.

>Just fucking do whatever
Lul

How in the fuck would you calculate the strength if we don't know the acceleration.

just duckduckgo it

Or recursively such that you start from the endpoint and search "back" until you hit the startpoint, but it's a BFS by any other name

They're implied
Wtf do you think pathfinding is

I bet Jow Forums can't write a 3d dynamic path finding algorithm in continuous space(no grid allowed) without googling how to do it. Extra bonus points for doing it for a nonholonomic system or a system that has more dimensions (like a robot arm)
>>not using A* or some other * algorithm
I am severely disappoint Jow Forums

I could since it's just a graph search. It wouldn't be very efficient but it'd find a path every time if it exists.

Doesn't terminate if there's loops, which there obviously are on a grid

You already know the map because its your game, just create a graph where every node are locations in the game, if two locations can be travelled linearly (aka in a straight line)you put an arc between those two nodes. Use djkstra to find any path between two points. You literally cant make a faster algo than this

I just took AI last term and yes op. I would still need to google.it.

A* search I would at least need to google.

You're. I can write one without googling
I'll just go to redblobgames.com directly as a quick reference

I'd probably be able to code something from scratch, but I don't remember anything other than "precompute grid and move entities in terms of if it's closer or farther away"

Yeah but Costanza can lift 100 lbs over his head.

>while(x!=xdest&&y!=ydest)
Hope you mean || there

what if the constanzas attacked at night

If Path = unfound, find path.

astar is pretty easy to put in yourself and works really well for almost anything

TravelTo(current_pos, target_pos):
If(current_pos != target_pos):
Move(random_step)
Update.current_pos
TravelTo(current_pos, target_pos)

Oh damn you're right.

func BFS2(start, dest, neighbours):
search = new queue()
pathback = new dictionary()

func BFS(start):
for x in neighbours(start):
pathback.set(x, start)
if x == dest:
return true
else if !pathback.has(x):
search.push(x)
return false

search.push(start)
while BFS(search.pop()):
continue

finalpath = new Array()
x = dest
while x != start:
finalpath.push(x)
x = pathback.get(x)
finalpath.push(start)
finalpath.reverse()
return finalpath