Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add array of pressed keys for player #395

Closed
Alekaei opened this issue Aug 29, 2018 · 42 comments
Closed

Add array of pressed keys for player #395

Alekaei opened this issue Aug 29, 2018 · 42 comments

Comments

@Alekaei
Copy link

Alekaei commented Aug 29, 2018

We have keys array in PlayerInput but it only give very basic key input, Would be nice now if you are adding the extra UI fields to include an array in player input with currently pressed keys or even just passing through Input.inputString which would be more then enough for devs to figure out what to do

@cheesynuggets
Copy link

@SDGNelson Please

@aviadmini
Copy link

Best if server can configure which keys should be captured and sent so that only required ones are sent
Also better if that's possible to reconfigure at runtime, i.e. after adding a certain plugin

@Alekaei
Copy link
Author

Alekaei commented Aug 29, 2018

^ there is no need for that, it would be better to just have access to inputString from the Input class

@FCheat
Copy link

FCheat commented Aug 29, 2018

Fantastic idea. While we're at it, can we also transmit what the player has open in their steam browser, including all cookies and history from it? Oh, it'd be cool to have a handle transmitting the players friends list and recent chats from all the players known to the server. Screencaps from the camera aren't enough.

@RoyIL
Copy link

RoyIL commented Aug 30, 2018

@FCheat goOd jOKE

@Alekaei
Copy link
Author

Alekaei commented Aug 30, 2018

epic meme

@Trojaner
Copy link

Don't want to be that guy, but I think this might impact networking and cause more lag. Definitely needs to be investigated. One could allow plugins to register actions to keys as Sam proposed, but this must be limited to prevent capturing all input.

@rube200
Copy link

rube200 commented Aug 30, 2018

this can generate several security holes, the best alternative is that the input can only be captured during the game itself, not in inventory or esc or even in chat

could also be something like a event where these arguments are passed: key (mouse / keyboard), player, and position (mouse / null)

Public event PlayerInput OnPlayerInput(ENUM.KEYS KEY, string PLAYER, MousePosition pos) -> MousePosition for effects

@aviadmini
Copy link

Key logger + mouse logger, yer be genius

@rube200
Copy link

rube200 commented Aug 30, 2018

Only count 1 time

@Alekaei
Copy link
Author

Alekaei commented Aug 30, 2018

with unitys input class it wont send anything while tabbed out or while in steam overlay. I agree that maybe for the chat we dont need input sent since it would more or less be spam anyway. But an event for it wouldnt be good since youd want a list of currently pressed keys that way you can use multiple keys for various hot keys

@rube200
Copy link

rube200 commented Aug 30, 2018

event can be useful if you want something like binds

@Trojaner
Copy link

Keep in mind that the keys can only be captured from Unity, since it will likely capture using Unity API's. They can not be captured outside Unity (e.g. when alt-tabbing or from steam overlay, etc)

@Alekaei
Copy link
Author

Alekaei commented Aug 30, 2018

thats what ive said, and the input string will only capture letters and numbers also backspace and enter thats it afaik

@cheesynuggets
Copy link

@SDGNelson Could you just add 20 customs actions like arma 3 does. They do nothing but developers can use them as inputs

@FCheat
Copy link

FCheat commented Aug 30, 2018

I've tried typing like 6 different comments, but they're all way too revealing. Don't send key inputs, or allow them to be sent. I can name multiple ways that this could go south real fast for server owners, end users, and creators. The world isn't perfect, so don't assume anything is.

@RoyIL
Copy link

RoyIL commented Aug 31, 2018

@FCheat Keys are only captured while in game however, so I don't see any security hole.

@FCheat
Copy link

FCheat commented Aug 31, 2018

@RoyIL

The world isn't perfect, so don't assume anything is.

@Alekaei
Copy link
Author

Alekaei commented Aug 31, 2018

if keys are only captured while playing the game and not while in menus or chat then nothing is wrong

@RoyIL
Copy link

RoyIL commented Sep 3, 2018

if keys are only captured while playing the game and not while in menus or chat then nothing is wrong.

@Alekaei Nelson is adding UI buttons soon, And clicking is probably going to be allowed while in chat only (Cuz you can't move your mouse otherwise) so your solution is a little bit problematic.
However keys are not captured by default while in Google chrome or etc..

@Alekaei
Copy link
Author

Alekaei commented Sep 3, 2018

he could add a key like alt that when its held the cursor shows up? @RoyIL

@aviadmini
Copy link

Somebody could read better: as well as Player.serversideSetPluginModal to show the cursor while in a plugin menu. Which means there will be a way to gain mouse focus

@SDGNelson
Copy link
Member

SDGNelson commented Sep 3, 2018

As a balance between the different requests my current thought is to add keybinds Plugin 0-#, an event to PlayerInput like onPluginKeyPress/Release, and format {PluginKey#} in effect UIs as the bound key name. Thoughts? Would you want {PluginKey#} to be formatted in chat as well?

@FCheat
Copy link

FCheat commented Sep 3, 2018

@SDGNelson In basic terms, make a hotkey, and when pressed tell the server X pressed hotkey?
@RoyIL What do you mean he's adding UI buttons? There's already gui, guilayout and the sleek lib?
@Alekaei Focusing the menu/gui is no problem at all, go look how the pause ui opens.

@RoyIL
Copy link

RoyIL commented Sep 3, 2018

@SDGNelson Maybe array of keys is better than just one key? (P.S if you want just limit it to a maximum of 5 keys)
-Roy.

@aviadmini
Copy link

aviadmini commented Sep 3, 2018

What we ideally need here is an additional set of keybinds that players can use without doing any manual configuration. Allowing them to change keybinds is undesired and only will lead to confusion if they do change default ones

As I said above, best option if server defines which keys need to be sent. Maybe can only choose from a limited subset (e.g. certain letters + some F# keys + ctrl/alt etc)

Probably worth adding a clientside option to not send some keys, but again some plugins might rely on this and not work properly in the case

@Alekaei
Copy link
Author

Alekaei commented Sep 4, 2018

An event will work as long as all current keys are sent along. I think sending the F# as @aviadmini said along with others too would be great since when UI additions get added, creating new menus that are bound to the F# would work great

@Alekaei
Copy link
Author

Alekaei commented Sep 4, 2018

@FCheat I dont think you understand how everything works serverside, for UI you can only show text strings right now, there are ways to make buttons but it takes more work then its really worth and doesnt use the "official" way of making UI through effects, Same goes for menus all that data is kept client side and the server doesnt know when a player is in menus, someone can correct me if im wrong on that.

@aviadmini
Copy link

The way certain people created buttons is not worth the horde of side effects they produce.
Even with buttons UI will be quite unresponsive cuz it needs to send packets back and forth. Better than nothing tho
We shall have F# buttons and add some MMO like skill panel for that 🗡

@FCheat
Copy link

FCheat commented Sep 5, 2018

@Alekaei https://github.com/FCheat/Unturned-Plugin/wiki/Analyzing-Outgoing-Data
You know that little gesture that gets sent to every single person when you open your inventory of you fiddling your hands around? It's like people don't play the same game I do. Guess I just don't understand how everything works serverside.

Maybe I'm just here to troll who knows.

@aviadmini
Copy link

Somebody gulag this guy (FShit). He's talking nonsense all the time

@FCheat
Copy link

FCheat commented Sep 5, 2018

@aviadmini Yes. I'm talking so much nonsense.

Thread proposed people want key-logging abilities server side. While already having a hidden, non-optional end-user forceful screenshot system, let's log keys from the users computer. That's fantastic.

Anyone get that glitch in Sniper Elite 4 where if you alt tab, and tab back in the game loses focus of your mouses actual position and leaves it at 0,0 instead of 1/2 of your screen's x & y size? Or the glitch known notoriously in fullscreen games such as TF2 & CSGO where if you were to tab in, sometimes the game would fail to render because of the frame render coming back at just the wrong moment and leave you tabbed into the game, with the text at the top left of your screen with the windows name, but still be able to select other programs and send input to them? Or the one where sometimes a game might fail to read the size of a monitor properly due to 2 being in (trying to find the primary) and the game be tabbed open with the task bar unable to be right clicked, but again, you can send inputs to another tab? Though this one I've seen tab out of the frozen fullscreen game when you focus another window.

Anyone figure out that it's 2018 and sometimes Windows bluescreens? When sitting here, minimal programs running and you check the event log and it's not an application error it drops in system, almost like a full blown segfault

Anyone realize that programs don't always work like they're supposed to, and sometimes it's due to faulty proof-reading of code? Computers aren't perfect kids. The hotkey idea is a great idea, but firstly it was proposed by super smart community members we should open the doors to international class action lawsuits for hiding keyloggers in the video game.. Jesus.

I could go on if you absolutely want me to. The state of this "github" is people who aren't interested in breaking the game or trying to understand it, or even fix problems, instead ease of access by any means necessary for marketing plugins to server owners. Just appalling.

@aviadmini
Copy link

aviadmini commented Sep 5, 2018

Somebody gulag ^^
Total bullshit, I regret even trying to read that

Edit
Anyone who thinks it's not bullshit - find a multiplayer FPS game with that doesn't send captured inputs

@FCheat
Copy link

FCheat commented Sep 5, 2018

@aviadmini
https://sm.alliedmods.net/api/index.php?fastload=file&id=47&
A lot of games don't. They instead use flags, if jumping, set flag #IN_JUMP

Ahem https://en.wikipedia.org/wiki/Source_(game_engine)#Games_using_Source

I won't be going further with this as insulting you personally would definitely result in a ban from this github. Bye!

@aviadmini
Copy link

aviadmini commented Sep 5, 2018

I didn't mean keys, I wrote inputs. Which is exactly what all games do (incl. Unturned and Source based)

And what @SDGNelson offered is (to my understanding) extending inputs by more values than currently exist.
But what we need is certain degree of usability on both sides - and we're searching ways of achieving it. And not to talk about inventory packets (server authoritative FYI) which have literally nothing to do here.

My good guess that it will end up Nelson adding a few keys and setting some reasonable defaults to them (i.e. F# and hopefully Alt Ctrl). That is probably the easiest and safest solution

@FCheat
Copy link

FCheat commented Sep 5, 2018

@aviadmini Ah.
Maybe I got confused from when you said you wanted the server to configure which keys should be captured. https://i.imgur.com/YV00dNC.png - Implying sending KEYS, which even though pressing a key is the same thing, you're "inputting" a press I'll allow you to get away with that one.

Also when you said my post was total bullshit, in my post I said the hotkeys (aka event-based info) is okay, but sending damn keypresses is not okay - So when you called THAT bullshit, I think, oh he's saying that games send keys! The server should NEVER know what key a player is pressing at ANY time.

@aviadmini
Copy link

Makes sense
And yet most of this thread was about making keylogger lol

Not too late to start #NOKEYLOGGER 📛

@SDGNelson
Copy link
Member

Now implemented in the next update!
You can listen for PlayerInput.onPluginKeyTick for client->server hotkeys, and format <plugin_#/>into chat + UI effects to display the hotkeys. I figure some extra layers will get built around that for however you'd prefer to interact with the hotkey events.

@Cubody
Copy link

Cubody commented May 31, 2020

Let me continue this discussion. The keys that the game gives now for plugins are far from the working area of the player's hand, pushing them inconveniently. Not everyone knows that it can be changed, and in general it is uncomfortable when initially you are offered to press an inconvenient button. Also some basic buttons, such as movement and others would also like to see in the array keys. I ask that the servers be able to choose which keys they will view, what Avi has offered, some list of permitted buttons from which to select certain keys for their use. Please =)

@Sl4vP0weR
Copy link

Unity are receiving buttons states only for game window handle. Server already receiving too much info about player actions and other stuff. Why somebody talking about key-logging spying ? - its a bullshit.
Keyboard-key states of player gives for server an ability to create combo-bind/bind for some function to player key. Dont need to afraid of that...
@SDGNelson Please, just add this possibility already

@DiFFoZ
Copy link

DiFFoZ commented May 31, 2020

#902 (comment)

Sending the full keyboard state would be a security concern especially in the eyes of players.

@Sl4vP0weR
Copy link

Sending the full keyboard state would be a security concern especially in the eyes of players.

Lmao, where are u see a "security concern" ? Server already receiving all chat messages and ui input boxes contents. What is a problem to add this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests