Jump to content

[1.15.2] Help with Mob Movement (Please ;_;)


BadBichShaquonda

Recommended Posts

Hey guys,

 

As you can probably tell by the title, I'm feeling very demotivated right now. This is because I have spent countless hours tinkering with and trying to figure out movement controllers.

My friend and I went through the dolphin's movehelper and all we got from it is that it calculates a whole bunch of angles using arctangeants and sets them to some properties that I don't even know what they do.

 

Basically, what I'm asking is this: can anyone here explain to me (here, on discord [BadBichShaquonda#4858], anywhere) how movement controllers work, as well as any of the following classes: PathNavigator, Path, PathFinder any any movement-related goals.

These classes all seem to be related to each other. I can share my github if needed, although I don't really have anything on it other than me failing hahaha

 

Any help would be greatly appreciated; there is so much extending going on, properties all over the place, and the frameworks calls some of their methods in some specific order which makes things even more complex.

I've been coding for the past 4 years and I've never seen something this complex. Like I said, any help would be appreciated, and honestly I would pay for help at this point.

 

Here's what (I THINK) I've figured out so far:

  • MovementController does not actually move the mob, rather it tells it how to move IF it were to move. How it does this is beyond me.
  • Movement-related goals seem to somehow get the mob to move using PathNavigator potentially?
  • If a mob has a PATH, then the MovementController logic is not applied until the PATH is complete.
    • I'm thinking that I would somehow need to create a Path/PathNavigator/PathFinder, but I'm not sure which one, nor what each do
  • Vectors vectors vectors. I tried using the entity's travel method by supplying a vector I created out of the blue, but that just made my entity go in random directions
    • This may also work, but because it wasn't too clear and I wanted to try using the other 300 classes, I gave up on this
    • I also tried this using the base MovementController's setMoveTo, but that did almost the same thing

 

Sorry for the long and rather desperate post. I feel like I'm running out of options and I really don't want to give up.

 

Thank you for your help :)

Link to comment
Share on other sites

17 minutes ago, BadBichShaquonda said:

Vectors vectors vectors. I tried using the entity's travel method by supplying a vector I created out of the blue, but that just made my entity go in random directions

You will need a basic understanding of math/linear algebra to make mods that involved entity movement and custom rendering. I would suggest learning that first.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Post your code.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Hey, good morning

 

Sorry about not posting my code at the beginning. I guess what I was looking for was more explanations than actual code.

Here is my github: https://github.com/BadBichShaquonda/shark-mod/tree/dr_shtroumphi

 

Nothing much to see, but basically I created my own SharkMovementHelperController class in client/entity/ai (my mob class is SharkEntity in entities/). The code in there is vanilla dolphin's MoveHelper. I tried screwing around with the dolphin values, but setting them to constant values every tick changed nothing visible. In hindsight, I know this was not the best idea because those values clearly change on every tick, but I just wanted to try some stuff out of desperation.

 

Here are two things I've realized:

1. The reason all aquatic animals have their own 'helper' version of MovementController is because they also move on the Y axis (pretty obvious, I know)

2. Yaw, Pitch and Roll - I didn't know what these words meant in the code (I'm french origin) (for example: mob.rotationYaw, mob.rotationPitch). I thought it was something like, rotation of the Y axis on aw, and never did I think to google search the terms. Well, today I did, and found this wonderful wikipedia page (https://en.wikipedia.org/wiki/Yaw_(rotation)) that explains everything. So, all this to say that these types of rotations can be seen in the aquatic animal movement helper controllers, and basically mean that they can rotate on more axes (obviously, and this coincides with point 1, but at least now I know what those variables are for!)

 

Another thing I will add is that I got my best friend on board who is a mcgill mathematician (so I have that going for me, woohoo!), but he doesn't know too much code. Today we setup the modding environment on his computer and he seems excited to help me figure out what's going on in the movement controllers, and how we can similarly make our own.

 

What I need help with is figuring out the link between all the movement classes/methods, and in what order the framework calls them and what the framework provides. I understand that you may not know this, but essentially, this is what I need. Any information here would help, such as how Paths and PathNavigators and PathFinders interact with each other, and what that group of Path classes has to do with MovementControllers and Movement-related goals. Also, how does having a path navigator work? Does the framework randomly decide whether it's getting a Path or moving with the base movement controller?

 

Thank you for your help, I could not do this without this community. Any tip would be appreciated.

 

Have a great day :)

Edited by BadBichShaquonda
Link to comment
Share on other sites

4 hours ago, BadBichShaquonda said:

Hey, good morning

 

Sorry about not posting my code at the beginning. I guess what I was looking for was more explanations than actual code.

Here is my github: https://github.com/BadBichShaquonda/shark-mod/tree/dr_shtroumphi

 

Nothing much to see, but basically I created my own SharkMovementHelperController class in client/entity/ai (my mob class is SharkEntity in entities/). The code in there is vanilla dolphin's MoveHelper. I tried screwing around with the dolphin values, but setting them to constant values every tick changed nothing visible. In hindsight, I know this was not the best idea because those values clearly change on every tick, but I just wanted to try some stuff out of desperation.

 

Here are two things I've realized:

1. The reason all aquatic animals have their own 'helper' version of MovementController is because they also move on the Y axis (pretty obvious, I know)

2. Yaw, Pitch and Roll - I didn't know what these words meant in the code (I'm french origin) (for example: mob.rotationYaw, mob.rotationPitch). I thought it was something like, rotation of the Y axis on aw, and never did I think to google search the terms. Well, today I did, and found this wonderful wikipedia page (https://en.wikipedia.org/wiki/Yaw_(rotation)) that explains everything. So, all this to say that these types of rotations can be seen in the aquatic animal movement helper controllers, and basically mean that they can rotate on more axes (obviously, and this coincides with point 1, but at least now I know what those variables are for!)

 

Another thing I will add is that I got my best friend on board who is a mcgill mathematician (so I have that going for me, woohoo!), but he doesn't know too much code. Today we setup the modding environment on his computer and he seems excited to help me figure out what's going on in the movement controllers, and how we can similarly make our own.

 

What I need help with is figuring out the link between all the movement classes/methods, and in what order the framework calls them and what the framework provides. I understand that you may not know this, but essentially, this is what I need. Any information here would help, such as how Paths and PathNavigators and PathFinders interact with each other, and what that group of Path classes has to do with MovementControllers and Movement-related goals. Also, how does having a path navigator work? Does the framework randomly decide whether it's getting a Path or moving with the base movement controller?

 

Thank you for your help, I could not do this without this community. Any tip would be appreciated.

 

Have a great day :)

Hey man, hope you're doing well, I'm currently not at my machine, and I don't really have any code to work off as I haven't done it before. However, if you're wondering in what order things happens, if you're overwriting vanilla methods just put print statements in it, you'll see what order they print and therefore can work it out, some of them are dependant on conditions but through analysis of the vanilla classes I'm sure it will become explanatory, if there's any particular method you're confused with I'd be happy to take a look when I'm next around, stay safe and stay inside ❤️

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.