One more word to aspiring bot writers. It may seem like all of this is daunting, and its not exactly easy, but its worth noting that in my experience to date, development goes in cycles where first you are climbing what seems to be a very steep and unrewarding learning and coding curve, and then there's a payoff in being suddenly able to do a lot of things with the results of that curve. Followed by another curve.
First, you have to learn your tools. The language you're using, the frameworks you're using, enough to be able to write any meaningful code at all. Initially, it will seem like its difficult just to "Hello World" yourself out of a box. But once you get into the flow of things, your production rate will start to rise substantially.
The second hurdle to overcome is to understand and implement enough of XMPP to be able to connect to servers and send and receive messages. Until you get there, its difficult to get any feedback as to whether your code is actually doing anything or not. But once you can connect and send and receive messages, your ability to process those messages and do things will speed up dramatically. If you want to make a conversational bot, or a bot that interacts with the world but doesn't itself need to appear in that world, you can do a lot just from here. For example, the hypothetical "ski slope bot" that was discussed in another thread could have been written entirely from this point.
The third hurdle is visibility. It takes a lot of things to work simultaneously to make a bot visible to other players, and any one of them failing will make you invisible. Until you can see your bot, its difficult to really know if you can make it do anything at all beyond the chatting and other non-visible tasks discussed above. But once you make your bot visible, all sorts of things open up. You can get hacky things working like making the bot move to a spot, spin around, and emote without too much difficulty. Smooth locomotion - i.e. running, jumping, flying, walking - is trickier, but once your bot is visible, its a lot easier to experiment with this.
The fourth hurdle is to realize that your bot needs a way to execute a sequence of commands. Depending on how you've written your bot and what language and tools you're using, this could be easier or harder, but you will probably at some point need to put in at least some work here. And its entirely possible that the way you wrote your bot up to this point makes this difficult, because you didn't take this fully into account. My strongest recommendation here is, like you should have been doing up to now, keep every version and iteration of your bot. When you start refactoring code, make sure you never, ever, EVER delete any previous version, particularly versions that worked even if they didn't do exactly what you wanted. Nothing is more disheartening than "breaking" a working bot, and discovering you forgot how it used to work in the first place.
Also, there's two kinds of "sequences" you need to consider, and you need to consider if you're going to address them in the same way or different ways. First, there are animation sequences. When animating a visible bot, animations need to flow in certain orders. Some Paragon Chat will do for you automatically, some not. You need to learn how to do that, and how to write your bot so it can understand what state it is in, and what it should do next when it comes to animations. Separately, you will probably one day want to give your bot a script or sequence of commands, and each command may or may not require many different actions by your bot to perform them. Don't be afraid to stop and think about this problem carefully, taking a break from coding the bot if you need to, until you have a solution you like. This is probably a critical part of your bot development because it will influence how you interact with the bot from now on. My recommendation is to try to disconnect what the bot literally does from moment to moment and the higher level tasks it has to perform, if for no other reason than it becomes easier to try out ideas, and if they don't work to discard them and try something else without having to make major changes to the bot.
Above all, remember that if you break up the task into manageable components, each one with a payoff, you can better manage your own expectations and keep development moving without getting bogged down in trying to do too much at once. If you keep trying to swing for the fences, you'll never get on base.
Here's a partial list of my intermediate bot goals as I was developing the bot (much of which has been documented in this thread):
- Log into XMPP correctly, see my chat in pidgin.
- Send and receive chat on the Atlas Park broadcast channel between bot and a player
- Receive command by tell, interpret as a query to City of Data website, send response to sender
- Connect to meta channel, see other player data
- Become visible using costume of logged in player, doesn't require costume inquiry code
- Add keyboard controls so can move bot, turn bot.
- Implement walk, run, fly animations in conjunction with keyboard controls
- Implement costume code, allow bot to appear as any costume
- Implement grow, shrink with costume code
- Implement basic in-game command processor to send commands to bot, implement "comehere" and "faceme"
- Refactor controls, add goal queues and basic goal processing
- Implement basic "followme"
Small steps, each one with an achievable and demonstrable goal. And remember that from the very beginning, the goal was to make a shadow boxing combat bot. These little goals are all achievable and fun in and of themselves, but they are also heading in that ultimate direction.
At the moment my bot is 990 lines of very organic (i.e. messy, ugly, ill-documented, poorly error checked, highly unoptimized) python code with an additional 320 lines of costume stanza library code. Technically speaking, I started actually writing code
about June 30th, which means at this moment in time I've been working on this, not every single day, for about 63 days. I've been averaging 21 lines of code a day. In other words, on an average day, I sit at my computer, think about the bot, write this:
elif self.cmdQueue[0][0] == 'comehere':
distance = 5.0 # how close to get
x1 = self.position[0]
y1 = self.position[1]
z1 = self.position[2]
x2 = float(self.cmdQueue[0][1].split()[0])
y2 = float(self.cmdQueue[0][1].split()[1])
z2 = float(self.cmdQueue[0][1].split()[2])
xx = x2-x1
yy = y2-y1
zz = z2-z1
k2 = math.sqrt(xx*xx + yy*yy + zz*zz)
xk = xx/k2 * distance
yk = yy/k2 * distance
zk = zz/k2 * distance
self.position[0] = x2 - xk
self.position[1] = y2 - yk
self.position[2] = z2 - zk
print "Debug: popping comehere, moving to " + str(self.position)
self.send_pcu()
del self.cmdQueue[0]
and then I go out and see Ant-Man. I'm not saying everyone should be able to code, or everyone should want to do this, but if you can code, and you want to do this, I'm here to tell you its doable, and doable without a herculean level of effort (although everyone has different skill levels with code, I'm talking relatively speaking).
Go. CODE. MAKE BOTS.