ID:841748
 
Keywords: input, keyboard
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
If not most, all game engines have some form of user input built-in; whether it be mouse, joystick, or keyboard. The support for keyboard input is strongly needed. I am pretty sure if a new game developer comes to BYOND with prior experience in other game engines, he/she would go insane just to find out that there isn't any native support for something as simple as keyboard input. The BYOND engine is simple enough already, but it is lacking a substantial amount of simplistic tools.

Anyways, it would be nice if there was a function or two to handle keyboard input, along with key codes. These functions could take a few forms:

KeyDown(key)
This function would return true if they keyboard key passed as a parameter is being pressed.

KeyRepeat(delay, interval)
delay: The amount of time(in seconds) before repeating the key.
interval: The amount of time(in seconds) between repeats.



While Forum_account's Keyboard library handles input well, I would like to see native support. Some don't ever find the Keyboard library. Maybe then we would see more games adapt to other keyboard commands and spend less time asking how to set up macros.
In response to Albro1
I don't think BYOND's keyboard/macro support is going to change much. You have to define things as macros so the client knows when the player triggered a macro and should notify the server of the verb to be called. BYOND can't just provide a KeyDown() proc since it won't know which keys the server is listening for. It's possible to create a library that hides this from the developer and presents a nicer interface, but I don't think the way it works internally is likely to change.

Albro1 wrote:
Some don't ever find the Keyboard library.

That's the problem that needs to be fixed. The BYOND developer website is very passive. It doesn't make people aware of resources, it lets people find libraries that they already know exist. Dream Maker should have an interface for browsing and downloading libraries. That way reference pages could link you to libraries that might be helpful. Instead of having to know what libraries exist, you'd be directed to libraries as you look for help in DM.
I really wish there was a simple way to capture keys so people set their own keybindings. Definitely need joystick and gamepad support too.
It is actually pretty easy to provide a traditional client.KeyDown() routine (in fact I implemented one internally some time ago), but it doesn't really offer anything over the macro system since it's just sending a message out on every keypress, and that can result in unnecessary network traffic when the key isn't processed (something the macros don't do). I guess it makes it so you don't have to define the macros, but I don't know how useful that is. Ultimately it doesn't provide a really good real-time indication of key state, which I suspect is what users really want. I'm open to suggestions though.

The problem with comparing BYOND to other engines is that those things are all client-based, and BYOND is server-based. So things like fluid mouse movement and capturing keystate is tricky without client-side hacks (which is what the javascript libraries do).
I think it would be nice if BYOND came prepackaged or if there was a link on the download page to a set of useful resources so you can get them all at once. It would also be nice if that link would show up in the BYOND pager.
Tom wrote:
Ultimately it doesn't provide a really good real-time indication of key state, which I suspect is what users really want. I'm open to suggestions though.

The only "problem" I can think of with the current setup is that if the server catches a key press and release event, when you compute how long the key was held for it might not be that accurate. If you wanted to make a golf game where the longer the key is held, the harder you hit the ball, you might want to have the client compute how long the key was held for and have it tell the server.

The keyboard library creates key up and down macros at runtime and uses those events to remember the state of each key. Since it's using macros you won't get any better behavior from handling this internally. The only problem here is that BYOND, out of the box, doesn't provide the kind of keyboard event handling you'd expect because people won't know that the keyboard library exists. This problem isn't unique to keyboard input, it'll happen with any feature that's provided by libraries.

Zaltron wrote:
I think it would be nice if BYOND came prepackaged or if there was a link on the download page to a set of useful resources so you can get them all at once. It would also be nice if that link would show up in the BYOND pager.

If you're packaging BYOND with libraries it becomes harder to update the libraries and fix bugs. If Dream Maker was able to download libraries, users would always be getting the most up to date version. Also, if you're packaging DM with some libraries you're giving people a fixed set of libraries - what about the other ones? what about new ones? If DM could display content pulled from byond.com, you could easily keep people knowledgeable of all the resources that exist.
Rather than packaging BYOND with libraries it would probably be better to add a "home" page to Dream Maker. A lot if IDE's are doing that now.

On the home page there would most importantly be BYOND news at the top, stuff about the latest update and its associated changes. Under that would probably be a suped up version of the developers page with links to some of the most used demos/libs.
In response to Forum_account
Forum_account wrote:

If you're packaging BYOND with libraries it becomes harder to update the libraries and fix bugs. If Dream Maker was able to download libraries, users would always be getting the most up to date version. Also, if you're packaging DM with some libraries you're giving people a fixed set of libraries - what about the other ones? what about new ones? If DM could display content pulled from byond.com, you could easily keep people knowledgeable of all the resources that exist.

I was thinking more along the lines that it would download all the libraries from their respective hub page that way people would be getting the latest versions every time and they would receive update notifications via pager or the BYOND website.

I think linking people to all the resources to download manually would be tedious.
The problem is that it's hard for people to be aware of the developer resources that exist. Showing them the most popular ones or making Dream Maker download a few libraries helps, but doesn't fix the problem. The "home page" in Dream Maker would help - if it showed a modified version of http://www.byond.com/developer/ that included the popular resources, newest resources, and recent posts boxes that'd help people stay aware of what's available.

Zaltron wrote:
I think linking people to all the resources to download manually would be tedious.

Tedious to use? Or tedious to create those links?

They could provide links on reference pages that bring up a dialog box asking if you want to download the library. If you click "Download", it automatically downloads it, unzips it, refreshes the Lib folder, and could even include it in the project.
FA, if you were to remake the front developer resources page what libs/demos would you have featured there?
Maybe it would be easier to download one library that includes other libraries automatically, than click a bunch of download links for each individual library? You could probably make a hub entry "Library Pack", where it's just an empty project with the libraries included in the .dme file. Downloading it should, theoretically, download all included libraries. Including the Library Pack would also include all its included libraries.

Although, it doesn't really have to be that complicated. The download link could just link you to Author.HubName and just download it, not link to the hub page.

The libraries I most often use are my ProcLib and loop libraries, F_a.Keyboard, F_a.MousePosition, and F_a.Overlays. These are all things I've done myself at some point and used often, but never made hubs for. Of these, F_a.Keyboard is the most important to me, combined with K.loop, so I can have a basic game loop with smooth multi-directional movement. Fortunately, F_a made hubs, so now I use them.
In response to SuperAntx
SuperAntx wrote:
FA, if you were to remake the front developer resources page what libs/demos would you have featured there?

The developer listings has a lot of hub entries that I wouldn't have made listed whether they're not that applicable for game development, are old and don't have active authors, repeat topics that are already covered, have been phased out (ex: on-screen text or pixel projectile demos), or just aren't that well made. Aside from raising the bar a little bit, I'd designate some resources as "featured" and have a list (like the "Popular Resources" and "Newest Resources" lists) to show them. The top four shown would be random to provide a way to promote good resources that aren't new or popular, but deserve to get more exposure.

It also might help to organize things better with tags and have the developer's page that's shown in DM ignore certain entries with certain tags. There are some introductory resources that might be good to show some people, but don't need to be shown to most people using Dream Maker.

As for the specific things that'd be featured, I haven't found too many. I'd probably pick the ones that are well-made and most widely applicable, or ones that provide the kinds of features you might expect to have in BYOND.
I like the way FA just mentioned handling it in the above post. I would have to go through resources and such to decide which ones would be best, but I think as far as the featured ones go it'd need to be a few of FA's resources, maybe a couple from ACWraith (I would need to examine these more, its been a while), and maybe a couple others that I can't remember off the top of my head. Oh, I think EviofAu? Might have some resources worth featuring, hard to say. I'd need to review those again.

There are a couple things suited for beginners, as well, that could be listed right up front for just them. One, if I recall correctly, is the ZBT? Tutorial series. That's always a winner. Just my 2 cents, since I'm likely less experienced than most posters in this topic I figured it might be some useful input.
KeyPressed(key) should be added to the DM language it would be attached to mobs/objects it would be similar to macros but counts for EVERY button on the keyboard it would be helpful too coders in many different ways,a example of it would be

mob
icon = 'icon.dmi'
icon_state = "mob"
KeyPressed(key)
usr << "[key]"


args could be the key on the keyboard that was pressed

this will be helpful in creating macros,chats,or if you just wanted to make it more spiffy and instead of the normal input box have a brightly colored input box that when you press a key it comes up in the info box in a golden color

anyway i think of, this would be more helpful then not,only thing i could think of that this would even affect is macros
In response to Shwb1
Shwb1 wrote:

this will be helpful in creating macros,chats,or if you just wanted to make it more spiffy and instead of the normal input box have a brightly colored input box that when you press a key it comes up in the info box in a golden color


Emmm that is already possible. You can make an input box that is brightly coloured come up on a key press. There is no need for this feature for that to happen. I honestly dont see any need for this.

-1 on this
In response to Shwb1
I find this useless and un-needed.
In response to Shwb1
if it is useless,tell me, how do you get any key that is pressed?, such as if a player presses any key on their keyboard it will do something?

EDIT: im not talking about macros, i mean if a person presses abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+ (insert rest of keyboard symbols and cap letters here) that you could make it do something?
In response to Shwb1
See you dont. Why would you possibly need every single keyboard command doing a function ? If you are making a chat then the input control can detect every keypress which would be inserted in the input. Like I honestly see no possible need for it
In response to Shwb1
Dj think about this: you want a chat,but you think the built-it chat looks horrible, so you decide to add a gui chat, but input also looks horrible, or you just dont like pop-up windowsso you add a macro that when you press tab a gui input opens up, so you want o be able to get the usr's keys that are pressed so the input cant register and display what they are typing, but you dont want to make a macro for EVERY ONE OF THE KEYS, how might you go about doing this?
Page: 1 2