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, last edited by Tako (2015-11-21 08:26:43)

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

[API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

4d9081a0aa.jpg

Welcome!

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.

More info

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.

So what does it look like in my code?

1. Importing Skylight:

Hidden text

2. Creating Room objects:

Hidden text

3. Creating Bot objects:

Hidden text

4. Joining the Room:

Hidden text

5. Creating an event handler:

Hidden text

6. Creating Block objects

Hidden text

7. Building blocks

Hidden text

8. Saying things

Hidden text

9. Accessing players

Hidden text

10. Reading blocks on the map

Hidden text

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

Offline

#2 Before February 2015

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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.


signature.png
*u stinky*

Offline

#3 Before February 2015

yNeee
Guest

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

^, 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)

#4 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

yNeee wrote:

^, 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

#5 Before February 2015

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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.


signature.png
*u stinky*

Offline

#6 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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. //forums.everybodyedits.com/img/smilies/tongue


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

Offline

#7 Before February 2015

TiKen
Member
Joined: 2015-02-24
Posts: 298

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

Pretty nice !

?tilla wrote:

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

#8 Before February 2015

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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

#9 Before February 2015

Onjit
Member
Joined: 2015-02-15
Posts: 9,709
Website

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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 //forums.everybodyedits.com/img/smilies/big_smile

Last edited by Onjit (Jun 12 2013 8:07:53 am)


:.|:;

Offline

#10 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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.

[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

#11 Before February 2015

Cyral
Member
From: United States
Joined: 2015-02-15
Posts: 2,269

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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 //forums.everybodyedits.com/img/smilies/smile 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

#12 Before February 2015

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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.

Offline

#13 Before February 2015

Cyral
Member
From: United States
Joined: 2015-02-15
Posts: 2,269

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

hummerz5 wrote:
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

#14 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

EE Beast wrote:
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

#15 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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 //forums.everybodyedits.com/img/smilies/smile 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

#16 Before February 2015

Jojatekok
Guest

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

Finally, something that's really useful, and cannot be called mainstream. I've added Facebook login support; look at pull requests please! //forums.everybodyedits.com/img/smilies/wink

#17 Before February 2015

Buzzerbee
Forum Admin
From: Texas, U.S.A.
Joined: 2015-02-15
Posts: 4,575

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

Is this compatible with .NET Framework 4.0?


TdQRyz3.png
https://wiki.everybodyedits.com/images/5/5d/135_bee

Offline

#18 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

Jojatekok wrote:

Finally, something that's really useful, and cannot be called mainstream. I've added Facebook login support; look at pull requests please! //forums.everybodyedits.com/img/smilies/wink

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

#19 Before February 2015

Cyral
Member
From: United States
Joined: 2015-02-15
Posts: 2,269

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

TakoMan02 wrote:
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 //forums.everybodyedits.com/img/smilies/smile 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

#20 Before February 2015

NR2001
Guest

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

If there is an AG login system, I'll be sold!

#21 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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.


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

Offline

#22 Before February 2015

Happychubbybubby
Guest

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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

#23 Before February 2015

Jojatekok
Guest

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

TakoMan02 wrote:
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... //forums.everybodyedits.com/img/smilies/wink

#24 Before February 2015

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

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

Happychubbybubby wrote:

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

#25 Before February 2015

Buzzerbee
Forum Admin
From: Texas, U.S.A.
Joined: 2015-02-15
Posts: 4,575

Re: [API] [Beta] Skylight: Make bots with ease (Redux Nov 2015)

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


TdQRyz3.png
https://wiki.everybodyedits.com/images/5/5d/135_bee

Offline

Tako1448089601560510

Board footer

Powered by FluxBB

[ Started around 1732215475.1608 - Generated in 0.322 seconds, 10 queries executed - Memory usage: 1.85 MiB (Peak: 2.15 MiB) ]