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 2017-08-08 20:20:08

anon player
Banned
Joined: 2017-08-08
Posts: 1

Simulating keys being pressed

How would I simulate pressing the right key, left key, space bar, etc... so that my bot moves accordingly

Offline

#2 2017-08-08 20:43:17, last edited by John (2017-08-08 20:43:33)

John
Member
Joined: 2019-01-11
Posts: 2,009

Re: Simulating keys being pressed

According to the Everybody Edits Protocol, the Horizontal Direction is the left/right key and the Vertical Direction is the up/down key.

Values:
Vertical Direction:
-1 (Up)
0 (No key pressed)
1 (Down)

Horizontal Direction:
-1 (Left)
0 (No key pressed)
1 (Right)

For jumping, specify "true" to Space Pressed to simulate holding space, likewise Space Just Pressed when you first press the spacebar.

If you need clarification feel free to ask.

EDIT:
Typo


PW?scale=2

Offline

#3 2017-08-09 01:05:40

den3107
Member
From: Netherlands
Joined: 2015-04-24
Posts: 1,025

Re: Simulating keys being pressed

As Emalton said, you can specify your "buttons pressed", however, to create realistic movement that's far from the entire story.

If you're planning on making your bot move in one direction, hit a block (come to a complete stop), go another direction, hit a block (come to a complete stop), etc. You're probably off fine with providing just what Emalton said.

If you want to make him move more intricately, you will have to specify the horizontal and vertical speed modifier and time everything correctly.
There have been a few threads about "recording" player movement and then playing it back on a bot, and even then the bot generally moves rather jerky (unrealistically).


Unless you feel like spending (a lot) of time in figuring out how exactly the EE physics work, I suggest you to try and find an alternative or use more simple movement (like mentioned earlier).

Offline

Wooted by:

#4 2017-08-09 01:13:14

John
Member
Joined: 2019-01-11
Posts: 2,009

Re: Simulating keys being pressed

den3107 wrote:

There have been a few threads about "recording" player movement and then playing it back on a bot, and even then the bot generally moves rather jerky (unrealistically).

I haven't had any issues with replaying movements.

And Cercul1 I think EEPhysics might help if you are looking for more precise movements.


PW?scale=2

Offline

John1502237594671621

Board footer

Powered by FluxBB

[ Started around 1732426139.9528 - Generated in 0.037 seconds, 12 queries executed - Memory usage: 1.4 MiB (Peak: 1.5 MiB) ]