Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

How to integrate physics into your own bot, predict player movements

I've ported the required physics classes from EE and I've decided that I will share them so people can implement them to make something awesome. (Protip: Check who took a key)

I'm just going to drop the link to them here and you will have to figure the rest yourselves. Remember, I took these straight from my own bot and they need to be adjusted for your own.

Mod verification complete, script safe for use.

https://dl.dropboxusercontent.com/u/395 … vement.rar
How to implement:

private Dictionary<int, PhysicsPlayer> players = new Dictionary<int, PhysicsPlayer>();

This line of code will store your players. In every add/left packet, you should remove and add players to this dictionary. In the "m" packet, you will have to set the variables in the player class with the data you get from the packet.

private Thread playerPhysicsThread; private Stopwatch playerPhysicsStopwatch = new Stopwatch();  //Initialize the thread to use UpdatePhysics playerPhysicsThread = new Thread(UpdatePhysics); playerPhysicsThread.Start();  private void UpdatePhysics() {     playerPhysicsStopwatch.Start();     while(true)     {         if(playerPhysicsStopwatch.ElapsedMilliseconds >= Config.physics_ms_per_tick)         {             playerPhysicsStopwatch.Restart();             foreach (Player player in players.Values)             {                 player.tick();             }         }     } }

This code will update the physics of every player. This implemention is NOT thread safe, you will need to come up with a solution that fits you best, I use a "SafeDictionary" that locks itself automatically.

License:

DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
                             Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <<a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="4734262a072f28242231263569292233">[email  protected]</a><script cf-hash='f9e31' type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

                 DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE **** YOU WANT TO.

Last edited by gustav9797 (May 13 2014 6:03:44 am)


uzjIGfi.gif

Offline

#2 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: How to integrate physics into your own bot, predict player movements

Sweet.

Friendly reminder that it's good habit to include a license. (Creative Commons is ... common)

[Edit] Now I remember why I hated this so much... the lack of documentation...

Last edited by Tako (May 12 2014 7:29:04 pm)


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

#3 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to integrate physics into your own bot, predict player movements

More documentation added.


uzjIGfi.gif

Offline

#4 Before February 2015

Cyclone or Meredith
Guest

Re: How to integrate physics into your own bot, predict player movements

I don't think he can use a license since most of the code is directly from the SWF which is copyright Cape.Net

#5 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to integrate physics into your own bot, predict player movements

License added, why do you even care.


uzjIGfi.gif

Offline

#6 Before February 2015

Showpath
Guest

Re: How to integrate physics into your own bot, predict player movements

Gustav9797 I have a suggestion how about you include your project or something because i wished to try this but i don't feel like figuring out how your code works just to make the class IRoom and the other classes for the Blocks and Block information personally to me its not worth the time to just take your code and figure out what i need to add to make it work and what exactly to make it work.

#7 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: How to integrate physics into your own bot, predict player movements

gustav9797 wrote:

License added, why do you even care.

I just wanted to know how much credit you want.   I hate it when people just publish code with no license but then get offended when you don't give them credit for it or modify it without their permission.


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

#8 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to integrate physics into your own bot, predict player movements

I know this has been wanted for a long time and I'll just simply give it to you, I don't want any credit because I just ported the code from EE.

I'll soon create another thread for the bot itself.


uzjIGfi.gif

Offline

#9 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: How to integrate physics into your own bot, predict player movements

What about the IRoom class?   Don't we need to update the block map?

What is BlObject?

So many questions.

[Edit] Nevermind, I figured it out.   I just forgot to change the namespace.

[Edit2] Uuuugh, so many NullReferenceExceptions.   Have you actually used this?

[Edit3] Nevermind, my fault for not using the Player constructor.


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

#10 Before February 2015

Fdoou
Banned

Re: How to integrate physics into your own bot, predict player movements

just copy and paste my signature, that's a copyright of some sorts

#11 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: How to integrate physics into your own bot, predict player movements

Okay I have a question the I cannot answer: what do the variables mean?

I need to update them with the "m" message, but I do not know which goes with which.

[Edit] I'm looking at Masterbot's source right now... you use the same names (Horizontal, ModifierY, et al) but I'm not seeing how they connect to PhysicsPlayer...

[Edit2] Okay, I see.   They are a part of SynchronizedSprite.   I got it to work - thank you so much!


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

#12 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to integrate physics into your own bot, predict player movements

Tako wrote:

Okay I have a question the I cannot answer: what do the variables mean?

I need to update them with the "m" message, but I do not know which goes with which.

[Edit] I'm looking at Masterbot's source right now... you use the same names (Horizontal, ModifierY, et al) but I'm not seeing how they connect to PhysicsPlayer...

[Edit2] Okay, I see.   They are a part of SynchronizedSprite.   I got it to work - thank you so much!

//forums.everybodyedits.com/img/smilies/wink


uzjIGfi.gif

Offline

gustav97971423757566203866

Board footer

Powered by FluxBB

[ Started around 1732693131.6482 - Generated in 0.060 seconds, 12 queries executed - Memory usage: 1.5 MiB (Peak: 1.66 MiB) ]