toddw123 / RotMG_Clientless

Compatible with version X16.0.0
MIT License
11 stars 4 forks source link

Projectiles (PlayerHit/EnemyHit/OtherHit) *updated with question* #18

Closed toddw123 closed 7 years ago

toddw123 commented 7 years ago

From looking over the client, it looks as if all projectiles on the screen are going to have to be tracked. Well, depending on what the end goal of this project is i guess. But anyways, im looking over the Projectile class's Update function and you can see where its picking which one it sends. It even has to send whether the enemy it hit is dead or not, which seems a bit stupid to me. I get that it takes the load off the server for collision detection, but wouldnt the server still be doing collision detection too? Otherwise you could just claim bullets A B and C all hit and killed something.

I guess the main thing im looking to figure out here is if these are vital packets that need to be sent in order to kill mobs and not get dc'ed. As i said, im sure the server is still doing some kind of collision detection, so are enemyhit/otherhit packets really required for your projectile to hit a mob? If you dont send those packets, will the server know and disconnect you? Or, if the server doesnt do collision detection, then it shouldnt disconnect you right? Will you get disconnected if you dont sent playerhit packets?

Any help on this topic would be great. Obviously it would be great if there was no need to track projectiles and do collision detection, but its looking more and more as if you have to.

Zeroeh commented 7 years ago

From what I remember, you don't get disconnected if you don't send them but the damage on the mob doesn't get registered. I'm sure the server has some form of verification to make sure the hit packets sent from the client are valid... There was an exploit some time ago where you could use your ability at any location at the map (spellbomb sphinx from the beach for example) but I'm not if this applies to normal bullets.

As for how far you want to take the project: I would continue just adding the full clients logic and features, basically the full client without the graphics. I was looking into graphics libraries in case this turned into something more, however :3

toddw123 commented 7 years ago

I wouldnt expect this to ever move towards a custom client, but i guess someone could fork this and go off in that direction if they wanted to. I dont have any desire to atleast.

But thanks for the input on the projectiles. What you said is pretty much what i was thinking. I guess its good that the server wont dc you if you dont send the enemyhit/otherhit packets, but it does suck that the monsters wont get hit unless they are sent lol. Oh well. Just another thing on the list of features that i hope eventually make it into this, depending on what this turns into. I might just build this project as a decent base, and then people can make forks and build the base into whatever they want.

toddw123 commented 7 years ago

I want to bring this back up as im probably going to be looking at projectiles here in the next week or so.

Im trying to figure out the best way, without using a fuckton of memory, to track projectiles.

My idea sofar:

The part that im not to sure of yet is how to handle the collision/sending packets when they hit something. I would either need to have the projectile's update() function return the object ids it hit during that update, and the class "manager" that holds them would be able to send the packet (pass the packetio var to the class "manager" when initializing so it can send as the client). Or i would have to pass the packetio or socket to each projectile class inside the class "manager" so that the projectile itself could send the hit packets.

any ideas? should i move forward with this general idea and figure out how to handle the last part when i get to it? would you change anything? Would you do it completely differently? Let me know so i dont waste a bunch of time to only find out it was a shit plan lol

Zeroeh commented 7 years ago

Found this while strolling through some old posts, since you seem to be wanting to get projectile / enemy tracking working. http://www.mpgh.net/forum/showthread.php?t=748808 Pages 1 and 2 have some nice info.

toddw123 commented 7 years ago

yes i have that source. its not very helpful.....at all actually lol. the language its written in is garbage. and he also didnt do very much in the way of projectiles. If you read the thread, most people say they would sit on the beach until they dc'd and wouldnt hit anything lol.

toddw123 commented 7 years ago

Infact now that I think back to it, yeah he didn't have any projectiles tracking in that. Which is why I asked before if I could hit mobs without needing to send the hit packets, because I think that's how botmakers code worked.

Though I will say that I do want to have something that works like the rankup/autoranking at some point, I love the idea of it. But obviously I would like my version to have better logic to it :)

Zeroeh commented 7 years ago

I think the projectile system is rather simple, get the distance to target enemy, use trigonometry and send a shoot packet in the direction of enemy.

toddw123 commented 7 years ago

That parts easy, yes. Functionality is already in the bot for that. It's tracking that is hard. Knowing when to send a hit packet, since you send one when enemy gets hit, when player gets hit, when object gets hit, and other gets hit. That's the hard part.

edit: and just to expand on what i said (i was on phone earlier), the ability to shoot at an enemy (as in all the math required) is already in the code. That part is easy and there was never any issue with that. The issue is following that projectile along its trajectory. You can shoot at an enemy, but just because he was at one location when you shot the bullet doesnt mean he will still be there when the bullet reaches that spot. So there has to be some way to follow each bullet and do any collision detection along the way. The game client, not the server, is the one that sends the various "hit" packets. From what others have said, you can shoot an enemy all you want but if no hit packet is sent (by the client) then the enemy wont take a single hit and wont die. So obviously i need to have some way to track when an object/enemy/etc is hit by a projectile.

toddw123 commented 7 years ago

Closing this topic for now. Probably create a new one when i actually get back to working on the projectile system.