SleekXMPP treats the resource as an option and distinguishes between a "bare" JID and a "full" JID. I'd wager that it's OpenFire that is assigning the "abc123" style of resource to clients that supply a "bare" JID.
Yup. But to be honest, because I was just trying to get off the ground, there's a lot of the XMPP implementation I shortcut around and am now going to implement for completeness, so I wasn't even running into boundjid/boundjid.bare issues because I was hardcoding jid.
I'm human, though (that's the story my parents keep telling), so I actually spent last night getting walk cycles to work. Because implementing service discovery protocol is fun and all, but watching your bot moonwalk (because of yaw cosine sign reversal) will keep you awake till 2am.
I have no specific plans to reimplement the sequencer (yet) so that too is being cheated in for now. Not sure I'm as ambitious as Codewalker in that regard, and I'm still going to have to do something with maps at some point, unless Codewalker beats me to version 1.3 first.
Also, bots don't have to obey gravity, and can enter any movement cycle that exists, so:
If you can construct the correct messages in the right order, bots can fly.
This is currently my bot's "brain" that is doing nothing more than obeying my keystrokes:
jog_moves = ['RUNPOST', 'RUNPRE', 'RUN_BACK_PRE', 'RUN_LEFT_PRE', 'RUN_RIGHT_PRE']
fly_moves = ['A_FLYPOSE1_POST', 'A_FLYPOSE1_PRE', 'A_FLYPOSE1_PRE','A_FLYPOSE1_PRE','A_FLYPOSE1_PRE']
pc_moves = []
pc_moves.append(jog_moves)
pc_moves.append(fly_moves)
class Pcbot_brain:
def __init__(self):
self.oldkeys = sets.Set()
self.newkeys = sets.Set()
# newkeys has only recently pressed keys, oldkeys has all currently depressed keys
def processKeyState(self, kt):
#print "Debug: oldkeys: " + str(self.oldkeys) + " new keystate: " + str(kt.keystate)
self.newkeys = kt.keystate.difference(self.oldkeys)
if len(self.newkeys) > 0:
print "Debug: newkeys: " + str(self.newkeys)
self.oldkeys = kt.keystate.copy()
#print "Debug: new oldkeys: " + str(self.oldkeys)
return
def take_action(self, pcbot):
move_speed = 0.3
turn_speed = 0.05
move_mode = (303 in self.oldkeys) # Right-Shift
if 112 in self.newkeys: # P
pcbot.send_pcPresence()
print "Debug: sending pcPresence based on keypress"
if 119 in self.oldkeys: # w
pcbot.position[2] = pcbot.position[2] + move_speed * math.cos(pcbot.orientation[1])
pcbot.position[0] = pcbot.position[0] + move_speed * math.sin(pcbot.orientation[1])
if pcbot.animation != pc_moves[move_mode][1]:
pcbot.animation = pc_moves[move_mode][1]
pcbot.send_pcu()
elif pcbot.animation == pc_moves[move_mode][1]:
pcbot.animation = pc_moves[move_mode][0]
pcbot.send_pcu()
if 97 in self.oldkeys: # a
pcbot.position[2] = pcbot.position[2] + move_speed * math.sin(pcbot.orientation[1])
pcbot.position[0] = pcbot.position[0] - move_speed * math.cos(pcbot.orientation[1])
if pcbot.animation != pc_moves[move_mode][3]:
pcbot.animation = pc_moves[move_mode][3]
pcbot.send_pcu()
elif pcbot.animation == pc_moves[move_mode][3]:
pcbot.animation = pc_moves[move_mode][0]
pcbot.send_pcu()
if 115 in self.oldkeys: # s
pcbot.position[2] = pcbot.position[2] - move_speed * math.cos(pcbot.orientation[1])
pcbot.position[0] = pcbot.position[0] - move_speed * math.sin(pcbot.orientation[1])
if pcbot.animation != pc_moves[move_mode][2]:
pcbot.animation = pc_moves[move_mode][2]
pcbot.send_pcu()
elif pcbot.animation == pc_moves[move_mode][2]:
pcbot.animation = pc_moves[move_mode][0]
pcbot.send_pcu()
if 100 in self.oldkeys: # d
pcbot.position[2] = pcbot.position[2] - move_speed * math.sin(pcbot.orientation[1])
pcbot.position[0] = pcbot.position[0] + move_speed * math.cos(pcbot.orientation[1])
if pcbot.animation != pc_moves[move_mode][4]:
pcbot.animation = pc_moves[move_mode][4]
pcbot.send_pcu()
elif pcbot.animation == pc_moves[move_mode][4]:
pcbot.animation = pc_moves[move_mode][0]
pcbot.send_pcu()
if 113 in self.oldkeys: # q
pcbot.orientation[1] = pcbot.orientation[1] - 0.1
pcbot.send_pcu()
if 101 in self.oldkeys: # e
pcbot.orientation[1] = pcbot.orientation[1] + 0.1
pcbot.send_pcu()
if 32 in self.oldkeys: # SPACE
pcbot.position[1] = pcbot.position[1] + move_speed
pcbot.send_pcu()
if 120 in self.oldkeys: # x
pcbot.position[1] = pcbot.position[1] - move_speed
pcbot.send_pcu()
return
It doesn't batch updates, it doesn't do prediction, and my send_pcu code doesn't quite correctly send the initial sequence once (its supposed to send MOVE_PRE once and then stop sending but I goofed in a simple to correct way, but I'm rethinking the entire process) so it studders if you hold down movement keys because it keeps re-entering _PRE. But, you hold down the shift key, and she flies. For a few feet at a time, anyway. Then you release shift and she starts walking in the middle of the air.
Also, because of the way Paragon Chat works, there's a lot of lag. I'm not sure if that lag is because of how Paragon Chat works, because of Openfire latency, or what, yet. But that lag places limits on how instantly interactive a bot can be. But at least I am in striking distance of the original goal for the bot project, which was to make a bot that can shadow box and fall down. The lag I'm seeing makes the prospect of implementing react-moves almost comical, but we'll see what happens.
There's a difference between knowing, and seeing. There's a lot about the animation system I know. But its different when you have to pull every string, and you see what failing to pull a string or pulling the wrong string does. I didn't think I needed to do this, but now I'm thinking I should implement inertia. Movement just doesn't look right without it.