Reply means to answer ~
ok then
I love the new shading
When will you publish the new file that you’ve been working on
Well I tried implementing that “theory” I made about the ai pathfinding
platformPathfinding.wick (6.4 KB)
About this project:
You can control the character with WASD
If you click on the scene, then it will generate a node graph for the pathfinding algorithm. The light blue dots are separate nodes, and the lines and curves are connections between nodes. Red lines between two nodes mean that the AI can walk between those nodes, and a blue curve means the AI can jump between those nodes. You can change the walk speed and jump velocity of the character in the character clip’s code, and the generated node graph will generate differently. The pathfinding algorithm is in the character clip, and the node graph generation is in the “main code” frame
Well, uh, there are some bugs. First of all, I can’t make the pathfinding actually work currently because it just goes into an infinite loop probably because the node graph is buggy. Second of all, for some reason there are walk connections between the two platforms. Probably because it thinks it can walk without falling between those two platforms? And also, it thinks that it can just drop down from any platform like it was a down gate. I know exactly why it does this though. And it also doesn’t make a node at the rightmost point of a platform. And the last bug I found, it found out it can jump and land on the same platform. It can realistically do that, but there’s no point in doing that, so that is not supposed to be in the node graph.
I’ll continue working on this tomorrow since I have been working on this for about seven hours. I can’t send a screenshot because the snipping tool is broken for whatever reason. So is the Windows search. Windows 10 is great.
I think with my current programming skills, I might’ve tried to bite off more than I can chew again… I’ll just focus on animating…
Well, this might be the Dunning-Kruger effect, but I don’t think programming what I wrote about would be too hard. I think the hardest part of programming is figuring out the steps on how to do a task, which I already did in my reply. That’s why I think that it wouldn’t be too hard for you. Unless this is the Dunning-Kruger effect talking. I’m still going to continue programming it though.
P.S. by “Dunning-Kruger” effect I mean, in this context, due to my relative competence, I am underestimating the difficulty of a certain task. Not when incompetent people overestimate their abilities (in this context) (context is an important word).
EDIT: also debugging is hard too
Yup, you are sooo right on that! It happens to me all the time. In reality there is a tiny amount of people in this world that knows what you know. : )
Man, I not only have learned something both interestingly new and familiar, but I now have the term for it!
Man, you know what I love most in games
LORE
And I plan to add much of it~
Thru… “Mp3 files”
Keeping with the theme of a digital world,
When a player completes a level under special conditions, they will be transported to an special area where they will be be able to listen to some story told from the perspective of one of the side characters/npcs
(Once a player collects a mp3 file, he or she is allowed to see it again in a “mp3 folder”)
This means that people who like a good story and people who just want to play the game can choose what to spend their time on.
While I get to put a ton of lore in the game >:3
What if we put it in the almanac?
Only make the folder visible once one audio file has been collected
I like the idea, but… what about the story itself?
Out of the 31 pages of our story mode doc, almost 20 of the pages are purely chapter 0. Chapter 0. Not even chapter 1, chapter 0. We’re focusing on the wrong thing.
>:3 oh i have plans alright…
I mean, that’s great, but we don’t know your plans. Could you actually implement or share your ideas? If it’s too much to completely write an entire chapter, which it should be, just write a summary that covers “everything” but not any of the minor details. Just do that for at least chapter 1 please.
I got it to actually work.
platformPathfinding.wick (8.6 KB)
Now you can click anywhere on the screen and the character will attempt to move there. Also if you don’t want the game to lag a lot due to the pathfinding visuals, then you can set DEBUG in the main code to false.
There are still a few bugs though. For example, it still sometimes will think it can walk from one node from one platform to all the nodes in another platform or vice versa (hence there being some non-horizontal red lines). I still don’t know why it does this. Also it sometimes takes the more longer path. Again, I don’t know why it does this. Also the character actually moving to places is a little buggy – when it lands after a jump, it jumps again and spazzes back and forth until it lands again – but I’m pretty sure that’s just because of the code that controls the player to move to a certain area, and not at all because of the more complicated pathfinding code.
Also I forgot to mention before, I’m doing this in a separate file so I don’t have to worry about the Forum Fighters stuff and can focus only on this thing. When this is finished, I can merge the code from here to the actual Forum Fighters game.
EDIT: I was thinking how, with this method, how running away from the player would work. I think how it would work is that it tries to find a node that would take the most amount of steps to reach from where the player is, and it would try to go there.
I have a surprising amount of work to do this week considering it’s summer, but I can try. making it only jump and land on an edge is going to be super hard though, that would need parabola-finding and making the enemy actually move. i’m not gonna do that, so if anything, I’m just letting it jump wherever.
2 possible ways to do this
If anyone else wants to try the original way (which i won’t plan on doing), I have a few suggestions.
- pick the start point (easy) and end point (based on where the player is).
- based on those 2 points. make a parabola. Since there are infinitely many ways to make a parabola with just 2 points, somehow we should place a third point and find the parabola from 3 points. I have no idea how to do that, let alone put it in coding terms, so that’s up to you.
- somehow move Xout along that parabola, probably with a random speed.
- make it attack… somehow.
If anyone wants to do it how I plan on doing so, here’s what I sorta plan on doing.
- based on where the opponent is, choose random-ish x and y velocities.
- make it move that way.
- make it attack (not quite as “somehow” as the first way)
or we just use pkhead’s pathfinding and limit Xout to only jump… that would be more efficient actually.
Actually you don’t need a third point. There is a quadratic equation that makes a parabola with only two points and a constant, given that the points are on y=0. This is the factored form of a quadratic equation: y = a(x-x0)(x-x1)
. x0
and x1
are the points that the parabola would intersect with on y=0. a
is the constant I mentioned.
I wanted a third point so that we know that the bot is “jumping”. You can also do it with 2 points and a vector but I don’t know how vectors work, I just know it’s possible.
we also can’t assume this because the bot isn’t just staying on 1 platform for the entire game.
well i said you can do it with two points and a constant (number), using the factored form of a quadratic equation. i guess a downside would be when you do it this way the angle of which the character jumps changes based on the distance of the two points. i say “i guess” because i’m not sure if that’s a bad thing or not?
here’s a desmos thing that shows that this works:
(drag the points)
to make it work, y=0 in the equation would mean the top of a certain platform. it doesn’t need to be the same platform, it can be any one platform. so a y value from the equation would be the y position relative to the top of the platform (y - platform.topY
).
y - yp = a(x - x0)(x - x1)
(yp is the y position of the platform)
or
y = a(x - x0)(x - x1) + yp
this is what i do in my pathfinding thingy
...
// find where the jump arc intersects with this platform plane
// using the QUADRATIC FORMULA!!!
// standard quadratic equation:
// 0 = ax^2 + bx + c
let a = 1/2 * c_gravity;
let b = c_jumpPower;
let c = -(surface.y - y);
let intersection = (-b + Math.sqrt(b*b - 4*a*c)) / (2*a) * c_maxSpeed;
// if the intersection point is actually on the platform
if (intersection + x > surface.left && intersection + x < surface.right) {
let newNode = new Node(intersection + x, surface.y, surface);
return newNode;
}
return null;
...
the quadratic formula gets an x-intercept of a quadratic equation. the position of x-intercept would be at (x,0). i just shift the y value based off the y position of the given platform, which is what i do when defining the variable c.
this is the quadratic formula by the way
(the ± symbol means you can choose between adding or subtracting)
Bro this is some mad math just to make an X jump from corner to corner to corner
0-0 keep up the good work