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.
[ Direct .zip download | Source ]
I'd like to start by describing what Skylight is, what it is not, and who it is for.
Skylight is, simply, a collection of tools. This toolbox, called an Application Programming Interface has one purpose: help developers create bots. Plain and simple. It will not teach you how to write C# or find and prevent bugs, just like a hammer will never teach you how to construct a birdhouse or make it weatherproof.
Like all tools, it can be used by amateurs and the more skilled. If you are the former, it's important to remember that APIs such as these are useful, but limit your understanding of the internals. At one point or another, I would recommend either looking at Skylight or PlayerIOClient's source to understand what's going on so you can expand your bots' functionality. If you are the latter, I am open to suggestions/criticism in terms of efficiency, usability, and readability. If you would like something to be improved upon, simply let me know in this thread.
Now, let's more precisely describe what Skylight does. This API is an object model of EE (see next paragraph) that covers all the fundamental (and routine) methods that bot developers use. For example: logging in. Parsing the "init" message. De-rotating the world key. Making a "Build" function. Looking up block IDs. All of this is done for you in Skylight. And, what's more, it's tucked away so that you don't need to even think about the internals, allowing you can focus on your bot.
More on the object model: Every Skylight program starts with a Room object. Then, a Bot object is "born" from that Room. From there it can join, respond to events, build, speak, et al. Inside the Room, there are Blocks and Players.
You can read the blocks through Room.Map.BlockAt(x, y, layer), and you can read the Players through Room.OnlinePlayers[index]. More syntax and useful snippets later on.
Blocks and Players, of course, have properties, which I will not enumerate. Assume every reasonable property is included. For the most part, these classes are read-only, meaning they have few functions and fewer changeable properties. Bot objects, however, have many functions and can be changed by you, the driver.
1. Importing Skylight:
2. Creating Room objects:
3. Creating Bot objects:
4. Joining the Room:
5. Creating an event handler:
6. Creating Block objects
7. Building blocks
8. Saying things
9. Accessing players
10. Reading blocks on the map
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Looks pretty well made, I was going to make something like this at one point as well. Good luck, hopefully some people will find it of use.
*u stinky*
Offline
^, Agree. It's confusing when your first time to use it but later it's sooooo useful. But still i love the Old Code of mine.
Add PlayerIOClient.dll maybe?
Last edited by yNeee (Jun 11 2013 11:01:54 pm)
^, Agree. It's confusing when your first time to use it but later it's sooooo useful. But still i love the Old Code of mine.
Add PlayerIOClient.dll maybe?
Sure.
http://puu.sh/3dQkp/caba5883ac.dll
I won't be explaining how to use this, though. You don't need it unless you need to do something special like log in through Facebook (which I will eventually add support for) send a specific message through the connection or create a different client.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
By the way, in the example I think it would be better to use a Console.Read() instead of a while loop.
It makes more sense, infinite loops aren't very good practice unless absolutely necessary.
*u stinky*
Offline
Yeah. I remember reading about some processor that would literally melt when it encountered a forever loop. I believe it was taken off the market but I still wouldn't want that to happen to anyone.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Pretty nice !
By the way, in the example I think it would be better to use a Console.Read() instead of a while loop.
It makes more sense, infinite loops aren't very good practice unless absolutely necessary.
Perhaps using a ManualResetEvent instead of the loop would be a bit more useful, in case one wants to shut down from the bot =P
Offline
Looks awesome. If I didn't already know what i know, well... I wouldn't understand any of this.
But it'd be incredibly useful if I did.
Does this have the movement code for more precise player positions? I don't know my way around GitHub.
Last edited by hummerz5 (Jun 12 2013 6:56:39 am)
Offline
Wow. I'm not much of a programmer, (the only thing I've code I've written was for a crappy Choose-Your-Own-Adventure text game 2 years ago), but I might consider giving this a go! Thanks mate
Last edited by Onjit (Jun 12 2013 8:07:53 am)
:.|:;
Offline
Does this have the movement code for more precise player positions? I don't know my way around GitHub.
Yes and no; everything is in double format, which looks like "9.345713363", which is redundantly precise. But as I said, the X and Y positions of players isn't based off their actual location; it's based off their location when they last made a keystroke, which isn't quite accurate.
For example, imagine an empty wide world. Imagine someone at the bottom left corner. The game sees him at (1, 50). Now if he were to just hold Right and move all the way to the opposite corner, the game would continue to say he's at (1, 50) even though he's not. It will say he's at (1, 50) until he releases the Right key.
That's just how Chris or whoever designed it. To create an accurate system I would have to emulate the entire physics engine and calculate position based on the minimal data I'm given, just to get some player coordinates.
[Edit] Accurate movement code has been implemented.
Last edited by Tako (Jun 8 2014 9:31:54 pm)
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
I always wanted to make something like this, +1 for doing all this, it looks very well made. And the topic is very organized and gives nice instructions, so kudos to you for making something amazing with bots!
EDIT: didnt look through all the code, but do you need to create a new instance of a player and room for every block? Couldnt you just reference the object or ID?
private Player placer = new Player(); private Room r = new Room(null);
And nice comments in Tools.cs I too was way to lazy to try and figure out how to parse the room data
Last edited by Cyral (Jun 12 2013 9:44:25 am)
Player Since 2011. I used to make bots and stuff.
Offline
hummerz5 wrote:Does this have the movement code for more precise player positions? I don't know my way around GitHub.
Yes and no; everything is in double format, which looks like "9.345713363", which is redundantly precise. But as I said, the X and Y positions of players isn't based off their actual location; it's based off their location when they last made a keystroke, which isn't quite accurate.
For example, imagine an empty wide world. Imagine someone at the bottom left corner. The game sees him at (1, 50). Now if he were to just hold Right and move all the way to the opposite corner, the game would continue to say he's at (1, 50) even though he's not. It will say he's at (1, 50) until he releases the Right key.
That's just how Chris or whoever designed it. To create an accurate system I would have to emulate the entire physics engine and calculate position based on the minimal data I'm given, just to get some player coordinates.
I understand how the movements are determined.
Just needed to know if you were "emulating the entire physics engine" or not.
Offline
TakoMan02 wrote:hummerz5 wrote:Does this have the movement code for more precise player positions? I don't know my way around GitHub.
Yes and no; everything is in double format, which looks like "9.345713363", which is redundantly precise. But as I said, the X and Y positions of players isn't based off their actual location; it's based off their location when they last made a keystroke, which isn't quite accurate.
For example, imagine an empty wide world. Imagine someone at the bottom left corner. The game sees him at (1, 50). Now if he were to just hold Right and move all the way to the opposite corner, the game would continue to say he's at (1, 50) even though he's not. It will say he's at (1, 50) until he releases the Right key.
That's just how Chris or whoever designed it. To create an accurate system I would have to emulate the entire physics engine and calculate position based on the minimal data I'm given, just to get some player coordinates.
I understand how the movements are determined.
Just needed to know if you were "emulating the entire physics engine" or not.
I think it would be really interesting. I dove into the EE source code once too do this, but never finished. I'm sure there would be some obstacles with the frame rate possibly, the client and bot might not be synced if updating at different speeds.
Player Since 2011. I used to make bots and stuff.
Offline
hummerz5 wrote:I understand how the movements are determined.
Just needed to know if you were "emulating the entire physics engine" or not.I think it would be really interesting. I dove into the EE source code once too do this, but never finished. I'm sure there would be some obstacles with the frame rate possibly, the client and bot might not be synced if updating at different speeds.
It would be very complicated to do that... but eventually I might try to add it.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
EDIT: didnt look through all the code, but do you need to create a new instance of a player and room for every block? Couldnt you just reference the object or ID?
private Player placer = new Player(); private Room r = new Room(null);
And nice comments in Tools.cs I too was way to lazy to try and figure out how to parse the room data
I'm glad you pointed this out - no, you do not. I completely removed the Room requirement and the Player parameter is optional.
You can create a block just by typing:
Block b = new Block(id, x, y);
But if for some reason you want to pretend like someone else other than the bot placed it, use the Player parameter. It's mainly there for the SDK's use.
However, the latest version on Github hasn't updated yet. It's taking an unusually long time for some reason.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Finally, something that's really useful, and cannot be called mainstream. I've added Facebook login support; look at pull requests please!
Is this compatible with .NET Framework 4.0?
Offline
Finally, something that's really useful, and cannot be called mainstream. I've added Facebook login support; look at pull requests please!
Thanks - I will merge and edit the OP to explain the changes.
[Edit] Well, I'll change the OP when Github finally updates.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
EE Beast wrote:EDIT: didnt look through all the code, but do you need to create a new instance of a player and room for every block? Couldnt you just reference the object or ID?
private Player placer = new Player(); private Room r = new Room(null);
And nice comments in Tools.cs I too was way to lazy to try and figure out how to parse the room data
I'm glad you pointed this out - no, you do not. I completely removed the Room requirement and the Player parameter is optional.
You can create a block just by typing:
Block b = new Block(id, x, y);
But if for some reason you want to pretend like someone else other than the bot placed it, use the Player parameter. It's mainly there for the SDK's use.
However, the latest version on Github hasn't updated yet. It's taking an unusually long time for some reason.
Oh okay, thats some nice functionality!
Player Since 2011. I used to make bots and stuff.
Offline
If there is an AG login system, I'll be sold!
If there is an AG login system, I'll be sold!
I'm not entirely sure if that is possible, but I will definitely look into it.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Have you had a look at Microsoft Blend (SketchFlow)? If you could develop a tutorial on making a bot using this language, that would be great, thanks.
I am quite new to C# and similar languages.
Some more in-depth tutorials on coding (and what things mean) would also be great, if you could.
Thanks,
~HCB
NR2001 wrote:If there is an AG login system, I'll be sold!
I'm not entirely sure if that is possible, but I will definitely look into it.
It is possible, and I'll implement it soon...
Have you had a look at Microsoft Blend (SketchFlow)? If you could develop a tutorial on making a bot using this language, that would be great, thanks.
I am quite new to C# and similar languages.Some more in-depth tutorials on coding (and what things mean) would also be great, if you could.
Thanks,
~HCB
Yes, I will work on a SketchFlow page on Github.
As for learning C#, there are dozens of guides on the internet, so it's redundant for me to teach you. Here is one that I particularly like. Use DotNetPerls for more in-depth descriptions of certain keywords and types.
If you're confused on something specific, I'd be glad to help clarify in real time. Send me a message if that is what you need. Also, StackOverflow is a superb community of people who are eager to fix any general problems in your code.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
Hey, Tako. If you would like me to I could make an in-depth description as well as instructions for each of the methods in In.cs and Out.cs
Offline
[ Started around 1732233719.9228 - Generated in 2.258 seconds, 14 queries executed - Memory usage: 1.85 MiB (Peak: 2.15 MiB) ]