csanyk.com

video games, programming, the internet, and stuff

Category: Uncategorized

KB Tester utility helps you see what value to check for when a key is pressed.

KBTester is a utility/demo I made to help out with coding your keyboard_check routines. It is born out of frustration and necessity for handling certain inputs from a very fundamental input device for computer games, the standard keyboard, which are not supported out of the box.

If you program keyboard input in your games, you’ll find that, for most keys on a computer’s keyboard, you can use vk_constants and ord(letter)… but for some odd reason YYG didn’t create a vk_constant for every key on the keyboard, and don’t plan to. Not only that, but there are certain keys that don’t return the right value for ord() to work with keyboard_check.

For example, say you want to check if the period key is pressed. You might think that you can do keyboard_check(vk_period) but to your surprise, there is no vk_period constant defined in GML. So, then it must be that you need to do keyboard_check(ord(“.”)) only… it doesn’t work!

That’s because ord(“.”) returns a value of 46. But for some reason, if you want keboard_check() to return true when the period key is pressed, you need to check for the value 190. Why? Why are certain keys on the standard keyboard treated as second-class citizens? Because, sadly it’s not in YYG’s vision to improve keyboard support.

To paraphrase a certain “Evil YoYo Games Employee” who commented on my suggestions for ways the current keyboard support badly needs to be improved:

<paraphrase>Why should we improve keyboard support when you can just research what codes map to your keyboard keys, make an extension that has a few constants in it, and then hope that these will work with all keyboards and all target platforms? Just code it once and then put it up on the Marketplace. Now that the marketplace exists to provide stopgap coverage of GM:S shortcomings, we don’t have to pay our own programmers to fix those holes anymore.</paraphrase>

So, I guess we’re supposed to figure out the numbers and then code some constants for the missing vk_constants, and use those. This, despite the helpfile recommending against using hardcoded numeric values in keyboard_check because you never know if it’ll work on the target platform if it’s not Windows/Mac/Ubuntu:

NOTE: These functions are designed for Windows/Mac/Ubuntu desktop platforms only. You may find some of the in-built variables and constants aren’t valid on other platforms and many of the functions won’t work on mobiles.
Now, each key is normally defined by a number, called the ascii code, and you can directly input this number into these functions and they will work fine… But, as it’s a bit difficult to remember so many numbers and the relationship that they have with your keyboard, GameMaker: Studio has a series of constants for the most used keyboard special keys and a special function ord() to return the number from ordinary typed characters (either letters or numbers).

The implication is that, YYG seem to be saying, “Despite the promise of GM:S to be a development environment that supports multiple target platforms, we didn’t see the need to ensure that your code will run the same on all target platforms we support, or all region/localities, or with all keyboard layouts. After looking into it we decided it was too hard for us to deal with, so we’re passing it along to you to figure out for yourself. So just be aware that these may or may not work on all platforms, and that’s all the info we’re going to give you about that. You’re on your own to figure out how to solve keyboard input from any platforms that don’t work with our keyboard input functions.”

Well, for whatever reason, YYG doesn’t provide FULL keyboard coverage between ord() and vk_constants, and it’s not in their vision to address this shortcoming, so I guess you’re going to have to go out and find some reference that will tell you what numbers represent what key, and then hope they still work.

In the meantime, you can use KBTester, press a key, and get the answer without having to hunt the info down on the internet and hope it’s correct. If you’re having trouble getting keyboard_check to work, and need to verify that the magic number you’re using is indeed the right one, you can run KBTester. Press the key you want to use, and KBTester will tell you the value that GameMaker sees when it is pressed.

Open Letter to Smart Phone Manufacturers

Dear Smartphone Industry,

I don’t need a bigger screen, OK? I need a screen that will fit comfortably in my pocket. My front hip pocket to be exact. The dimensions of the Samsung Galaxy S5are about as big as I can go. Really, the S2 was more comfortable.

I don’t need a thinner phone. I need a phone that feels comfortable in the hand.

I don’t need a thinner phone. I need a phone with ample battery, such that I don’t need to charge for several *days*, despite heavy use of the device. If you made the phone phone that was inch thick, and all that extra space was battery, and I could go a week without charging, that would be AMAZING.

While we’re at it, I would also really like intelligent battery management. I would like apps that need to use the network to not talk to the network directly, but talk to a network handler, which will determine if/when to allow the data to be transmitted. I can then configure the network manager to either not allow any transmission (like airplane mode; saving maximum battery), or allow all transmissions at any time (fastest response but lousy battery), or burst mode (leaving the transmitters off most of the time, but waking up and reconnecting every N minutes, sending/receiving data that has accumulated in that time, or when I request it).

Lastly, tell network providers to quit bundling apps with their phones. I don’t want or need so many of them, and there’s no way to uninstall the ones that are baked into the firmware. I can figure out what I need and install it. If I’m upgrading or migrating from an old phone, it should carry all that stuff over, with all my settings and data anyway. There’s no need to bundle anything. Just provide me with a bare phone.

And tell network providers that they must roll out security updates in a timely fashion (days, not months) so that users aren’t left vulnerable. Frequent, more granular updates rather than one or two monolithic updates before support for my handset model is dropped entirely, would be great.

Thanks,

New GameMaker Community Forums now live (finally!)

Following up on my earlier posts on this subject, after long delays, the new GameMaker Community Forums is now live. The archive of the old GMC forums is still at its old url. YoYo Games are offering a 10% discount coupon as a token of appreciation to users who’ve put up with the lengthy downtime as the old forums were transitioned and the new forums took unexpectedly long to bring online. It’s good to have writable forums once again.

 

The Decline and Fall of the The Walking Dead

[Editor’s note: I started writing this post shortly after the last episode of season six aired, back in April… then promptly forgot about it, until season seven started last week. In light of the outpouring of fans and critics complaining about the season’s first episode, I decided to finish up and publish.]

I’m thinking about this season’s last episode of The Walking Dead. The big season ending cliffhanger in which we’re finally introduced to Negan, and he brutally beats (likely kills) one of the central cast members, and we’re left to wonder who until next season.

My feelings on the show are pretty mixed. I definitely like TWD, overall, and moreover, I am predisposed to like it. But I increasingly find myself wondering why as the show grinds on. Mainly, I think, it comes down to the characters that I’ve grown attached to: Glenn, Daryl, Carol being my favorites. They’re played by great actors, and viewers have grown very attached to them over six seasons. But what really hooked me was the strength of the writing in the first season, and the realism of the situations that the survivors faced, and the realism of their responses to it.

There was a serious external threat represented by the zombie outbreak and the collapse of civilization, but also internal struggles as people who probably would ordinarily never cooperate or interact with each other were thrust together by circumstances and forced to cooperate for a chance at survival. Disagreements and conflicts and strained loyalties. And the choices the characters made had real, life or death consequences. People died on the show, just about every episode, and they were often characters who you cared about.

But also, there were the pragmatic, immediate matters of survival at hand. What tactics work against zombies? What about a huge number of zombies? Forgetting about zombies, how do you do basic survival when civilization has collapsed — how do you eat? Stay warm? Take care of your health and hygeine?

As the show has worn on, though, these things that made it interesting have been replaced or receeded into irrelevance. It’s taken for granted that they know how to survive. They are shown foraging, farming, and scavenging, but we never really see them starving, or shivering, or too weak to go on. They’ve gotten competent with fighting and know anti-zombie tactics so well that zombies are no longer a threat unless the show decides to make a stealth zombie come out of nowhere for a deus ex machina kill. Death spares the central cast, making it tame and predictable.

[[PUT SOMETHING HERE ABOUT HOW THE SHOW AT ONE TIME GAVE A FALSE HOPE OF FIGURING OUT WHAT WAS CAUSING THE ZOMBIE OUTBREAK AND STOPPING IT]]

For a time, the series dangled some hope of answers and a resolution. We might find out what caused the zombie apocalypse. There might even be a way to cure it. But those hopes were blown up in a memorable episode a few years ago, and since then, apart from a false hope in the form of Eugene’s story that he needed to get to Washington, D.C., there really hasn’t been any sense of direction. The cast have not been on a quest to go anywhere or accomplish anything, it’s just been an endless sequence of running into people, running into zombies, running into people, running into zombies, and most everyone they run into ends up dying before too long, but the central cast had started to take on an aura of invincibility.

Encounters with the living follow a formula: Either the other group is brutal and threatening, cannot be trusted, ever, and must therefore be destroyed; or, the other group is soft and weak, cannot be relied on, and must be exploited until their inexplicably stable pocket of civilization is overrun by either zombies or stronger people. We pick up a few new cast members who have the potential of making it with the protagonist group, but these people are all marked for death, and the idea is that we’re supposed to start to develop feelings for them before the show rips them from us, usually in some meaningless, almost accidental incident that is there mostly for its shock or horror value, which due to the contrived and predictable nature of the setup, is always diminished and weaker than intended.

Because there’s not enough time to allow for meaningful character development at the pace the writers want the show to take, we mostly don’t get any. There’s hints of possibility that go unexplored as the main plot hurtles past at highway speed. In many ways it feels like what makes it to broadcast is the “digest version” of a larger, richer story that we’ll never get to see. I guess that’s why the book is always better than the screenplay production. Yet, it’s frustrating. And if they could simply choose to take the time, you know they could make the show 10 times better than it ends up being. Essentially every character’s arc is left unfinished, or truncated. This could be the tragedy that we crave if it’s in full development only to be cut short by an untimely, horrible death. But despite the cornucopia of death that the show loves to present to us, almost none of it seems to hit us that way — the recent death of the doctor character just as she’s starting to come into her own being one notable exception, but all the more glaring due to its singularity.

Also, the central characters are so safe that the show’s writers are forced to have them make stupid decisions for no apparent reason. Carol’s most recent apparent death wish and her decision to leave the group again, for no real good reason, being the latest example of this. But we see it again and again, and it feels like it’s only an excuse to put a central character in danger, only to have the show pull its punches and spare them from harm.

Now, with the Negan kills ????? cliffhanger, the show is promising us a bloody, brutal end to one of our favorite characters. I’ve admired The Walking Dead for its willingness to kill characters, as TV shows so seldom often do. It was far more interesting to watch TWD knowing that it would not pull punches and spare a character just because they were a fan favorite. But this cliffhanger, I think, is too much for me. It’s like the show is using the spectacle of execution as entertainment. Death on the show wasn’t for entertainment, at least not for me, it was there to illustrate that TWD was a different sort of show, where, just like in real life, death doesn’t play fair, and that made me feel like characters were really in peril whenever there was danger.

I haven’t watched the first episode of Season 7 still, and after reading a lot of people’s responses to it, I’m not sure that I want to.

The Vulnerable Android

Recently a story about a vulnerability affecting 95% of Android devices made the rounds. The vulnerability is particularly nasty, in that it can be exploited by sending a SMS message to the target, which in some cases need not even be read by the user, and which can be deleted immediately after the device has been compromised, leaving no visible trace to the user that they have been pwnd. If the thought of this isn’t enough to make you shit your pants, it’s probably because you’re not wearing any. Compounding the problem is the slowness with which cellular carriers typically roll out updates for the phones they sell.

It’s clear that it’s not a top priority for cell carriers to update the software on your handset. If it was, they’d do it in a more timely manner. Once they stop marketing a given model, it becomes increasingly unlikely that they will spend any money in support of it; it becomes their incentive to let your old phone go out of date so that you will have to buy a new handset.

This is clearly not in the interests of the consumer. The distribution model for software updates of the base firmware needs to change. It’s trivial to take app updates from Google Play, but not the Android firmware. For firmware updates, customers have to wait for the carrier to release an update, and then users have to go into the Android settings and find the “check for updates” feature and manually initiate the update, and that’s just crazy. Just as we do not look to our ISP to provide updates for our desktop PC, we should not be looking to our cell provider for these updates either. All devices should have the shortest possible update path — that is, get the update directly from the source of the software. Cell carriers are middle-men who provide packaging, bundling, and distribution, and they need to get out of the way, and let users get updates directly from the software maintainers.

This is especially important when it comes to critical security patches. Customers should not have to root their phone to gain this level of control over a device that they paid for and own.

Consumers should reject business models that call what they buy a “service” or “subscription” or “license” and insist on true ownership. I expect it’s too late for this to change, but that won’t stop me from advocating for it.

Since we do not yet live in this world, Android users need to take steps to mitigate vulnerabilities that they cannot patch.

It’s always a good idea to think about mitigation steps anyway, since it’s always possible for an unknown, undisclosed vulnerability to be present on a system, and so you should always assume that your device is vulnerable, and thus take steps to ensure that if it is compromised, you can accept the consequences of the event. It’s just a little more difficult to come up with mitigation strategies when the vulnerabilities are not known, but not impossible. All that you need to do is use your imagination to think of what could an attacker do with your phone if they got complete access to it, and ask yourself what you can do to minimize the harm and exposure of that.

If you have a smartphone, it’s not much of a stretch to say that You are your phone. Your entire life is in there. Your contacts, photos, web browsing history, your saved passwords, access to your email accounts where you receive password reset requests for all your other accounts. An compromised device also compromises two-factor authentication. If you use two-factor authentication, one of the two “factors” involved is a 1-time key that is sent to your phone via SMS. This, plus your password, are the two “factors” that are supposed to be a more secure form of authenticating than just using a password alone. But if your phone is compromised, and the 1-time key is sent to your phone, and therefore shared with the attacker who pwnd your phone, two-factor authentication is no longer effective at protecting you. And if the attacker can read your password reset request emails, and use them to gain control over your other accounts, that’s a very serious liability. Once your attacker has access to all your accounts, they can deny you access to them, and start impersonating you.

To mitigate these risks, I recommend the following:

  1. Stop treating the google account associated with your android devices as your “home” or “primary” account. Keep the minimum information and stuff in the account that you need in order to make the phone useful for you, and have that account be a “throwaway” account, which you can discontinue using if it gets compromised. I guess that probably means just using it for storing your contacts, and maybe for photos backups.
  2. Do not use the google account associated with your android devices as a point of contact for password resets. Create a secret email just for password resets, and use it only for that purpose. Don’t log into that account from your android device. Of course, most services will send you other mail to the account you use for password resets, so you’ll have a hard time using your password email only for that purpose, but limit your use as much as possible, so you do not become overly reliant on the account for other uses.

Do you have any other ideas for limiting the value of your compromised phone or tablet to an attacker? Comment below with your ideas.

Ouya that was

It was announced today that Razer has bought Ouya.

“Razer reportedly plans to continue supporting Ouya’s existing game service for a year.”

“Razer doesn’t seem to be interested in trying to continue Ouya’s original strategy.”

So what does this mean for the users? Razer will continue the Ouya service for another year, and then they are pulling the plug. After that, will an Ouya have any useful purpose? Will it boot? Probably. But you can bet that any updates there might have been for it will not be available any longer. Can users re-install games that they had purchased? It doesn’t sound like it.

Someone will hopefully come up with a solution, a way to back up your Ouya games and run them — at least those titles that do not depend on a live service that they must connect to in order to play at all. Any games that do require a server for the client to access, will probably cease to be playable. Which is a shame. Unless perhaps the services are spun off to some other organization, or released as a product that people can obtained and run on their own hardware. But that seems quite unlikely. What profit would there be in it? The industry has interest only in selling you new product — sorry, services; it’s not fair to call it a “product” anymore when you can’t own what you are paying for — and they have no incentive to compete against what they released a few years ago, even though there might well be a long-tail niche of fans, enthusiasts, and academics who have an interest in keeping it around for amusement or research.

This weekend, I attended the 2015 CCAG Show where gamers, fans, and collectors gathered to exhibit and trade vintage and recent video games, some approaching almost 40 years old. This celebration of living video game history has been going on for 10 years now, and was made possible by the love players have for these games, and the enduring survival of the physical medium into which they were encoded. Will there be anything like this for Games as a Service consoles and mobile devices? It seems very doubtful. Once the vendor no longer wants to support the product, they will shut it down, the lights will die, and the party is over, the attendees left standing around in the dark, shuffling to music that is no longer playing, wondering what it all meant, or if it even happened at all.

Historians such as Jason ScottHenry Lowood, and others engaged in the struggle to preserve the history of the culture and industry of video games can do a great deal when it comes to archiving media and emulation of hardware, but when it comes to service-based business models, it becomes difficult if not impossible to envision how these things can be preserved so that future generations will be able to look back and see what was, and understand how we got here. The users only have access to the client side, and the service side is not only out of their reach, licensed for use but not owned, but it changes and evolves over time.

The ultimate laptop: retro modern ThinkPad

Lenovo started listening to years of ThinkPad fans griping yesterday.

Ars Technica picked up the story, and people are discussing it, really exited about the idea.

Yesterday I talked about what would make the perfect keyboard for my dream laptop.

Today I’ll talk about the features that I’d love to see on a new ThinkPad that harkens back to the best days of the product line.

Screen

  1. 15.4″ (but by all means, produce a full line of different sized ThinkPads with different screen sizes: 11″, 13″, 15″, 17″…)
  2. 16:10 aspect ratio — this is a MUST
  3. 10-bit IPS panel with at least up to 3K resolution
  4. glare-free matte surface, not glossy.
  5. not a touch screen (but I’m ok if it’s a configuration option at purchase)

Chassis

  1. Rugged, metal frame — aluminum, magnesium, or titanium
  2. Rubberized black paint finish
  3. Easy to work on. Repairing/replacing or upgrading the keyboard, RAM, and hard drive should be as easy as they were on the T61p.
  4. RAM slots sufficient to support at least 32GB of RAM
  5. Support ultrabay hard drive carrier
  6. Door/sliding cover for webcam for paranoid folks
  7. Sliding latch to securely hold lid closed
  8. Weight and thickness not primary concern, should not constrain design or compromise durability or features.
  9. Removable battery with sufficient capacity to run laptop for at least 12 hours of heavy, active use, on a charge — 18 hours would be even better. Yeah, a big bulky heavy battery. What good is the ultimate laptop if you can’t use it because it’s out of juice?

Ports

  1. Modern everything. HDMI-out or Display Port out instead of VGA. USB 3.0 slots (at least four of those).
  2. Gigabit ethernet (of course).
  3. Optional for SD card reader slot
  4. Full size slots, nothing proprietary or minimized for space

Mouse Double Click extension for GameMaker Studio provides double-click detection

Mouse Double Click is an Extension that provides two new GML functions, mouse_doubleclick_init() and mouse_check_doubleclick() 

Written in pure GML, these new functions round out the built-in Mouse functions, allowing you to easily check for double-click events.

To use it, first call the mouse_doubleclick_init() function in the Create event for the object that will be handling click actions. This creates an instance variable used to perform timing checks for the double-click, like so:

//Create Event:
mouse_doubleclick_init();

In a Step or Mouse event, call mouse_check_doubleclick(), passing in parameters for the mouse button to test for, and the doubleclick delay in microseconds (1/1,000,000th of a second).

//Mouse Event
mouse_check_doubleclick(mb_left, 250000); //250000 microseconds = 1/4 of a second

mouse_check_doubleclick() will return true if there were two clicks within the duration specified by the second argument, and false if no double click is detected.

That’s all there is to it.

csanyk.com © 2016
%d bloggers like this: