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.
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 2004Copyright (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 MODIFICATION0. You just DO WHAT THE **** YOU WANT TO.
Last edited by gustav9797 (May 13 2014 6:03:44 am)
Offline
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
More documentation added.
Offline
I don't think he can use a license since most of the code is directly from the SWF which is copyright Cape.Net
License added, why do you even care.
Offline
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.
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
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.
Offline
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
just copy and paste my signature, that's a copyright of some sorts
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
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!
Offline
[ Started around 1732693046.9239 - Generated in 0.182 seconds, 12 queries executed - Memory usage: 1.5 MiB (Peak: 1.66 MiB) ]