Echo #24: Huge step forward

Posted by Phoebii on Feb. 14, 2016, 2:27 p.m.

This week was very good for Sector Six, because I have managed to implement key remapping or as I call it, control customization system, bring back ether to the game and began updating technology interface.

I also ran few long tests and I was very happy to find out, that all those game systems are finally starting to work!

It seems that my attempts to improve game by making parts rarer, preventing level from giving armour, limiting weapons, etc, were not waste of time.

Anyway, when new abilities came out, they didn't required ether to use them.

Well, evil laugh, now they do!

Even better - ether doesn't regenerate anymore!

Regeneration is a disgusting mechanic.

It makes being idle in the game into something you might consider doing!

That makes no sense, considering that the games are here mostly to fight boredom!

Regeneration was extremely harmful to Sector Six, because hiding from enemies and waiting for armour, ether or alloy container charges to regenerate was very easy.

In the past I have removed armour regeneration.

Now I removed ether regeneration.

In future alloy containers with regenerating charges will also disappear!

Regeneration will be completely replaced with generation when you destroy enemy or demolish ruins. Or initial generation for ether and alloy container charges.

With ether regeneration gone, all ether providing parts became much more useful, making spaceship building more fun than ever.

Ether rework had huge impact on the gameplay, but it's minor change compared to the fact that Sector Six now has perfect controls!

How? You can now go to settings and change movement, ability, dialogue and alloy container keys to almost any key on the keyboard!

For those who use GameMaker: Studio and are interested in making key remapping in their games, here's how I did it:

First, I had added bunch of buttons for every control in game.

If, for example, you press container use button and then press T on keyboard, container use key will be remapped to T.

​When you click button, the variables mode_remap and selected_key are set.

For example, if you click container use button, selected_key is set to 14.

These variables are then used in the press any key event.

/// Press < any key> event

if mode_remap = true

{

if scr_check_key() = true

{

mode_remap = false;

switch(selected_key)

{

case 1: movement_up = keyboard_lastkey; break;

case 2: movement_down = keyboard_lastkey; break;

case 3: movement_left = keyboard_lastkey; break;

case 4: movement_right = keyboard_lastkey; break;

case 5: ability_1 = keyboard_lastkey; break;

case 6: ability_2 = keyboard_lastkey; break;

case 7: ability_3 = keyboard_lastkey; break;

case 8: ability_4 = keyboard_lastkey; break;

case 9: ability_5 = keyboard_lastkey; break;

case 10: ability_6 = keyboard_lastkey; break;

case 11: ability_7 = keyboard_lastkey; break;

case 12: ability_8 = keyboard_lastkey; break;

case 13: ability_9 = keyboard_lastkey; break;

case 14: container_key = keyboard_lastkey; break;

case 15: dialogue_key = keyboard_lastkey; break;

case 16: engine_key = keyboard_lastkey; break;

}

}

}

scr_check_key script is here to prevent people from remapping to keys like caps lock and screen capture.

/// scr_check_key()

var allow = false;

switch(keyboard_lastkey)

{

case vk_left: allow = true; break;

case vk_right: allow = true; break;

case vk_up: allow = true; break;

case vk_down: allow = true; break;

case vk_enter: allow = true; break;

case vk_space: allow = true; break;

case vk_shift: allow = true; break;

case vk_control: allow = true; break;

case vk_alt: allow = true; break;

case vk_backspace: allow = true; break;

case vk_tab: allow = true; break;

case vk_home: allow = true; break;

case vk_end: allow = true; break;

case vk_delete: allow = true; break;

case vk_insert: allow = true; break;

case vk_pageup: allow = true; break;

case vk_pagedown: allow = true; break;

case vk_f1: allow = true; break;

case vk_f2: allow = true; break;

case vk_f3: allow = true; break;

case vk_f4: allow = true; break;

case vk_f5: allow = true; break;

case vk_f6: allow = true; break;

case vk_f7: allow = true; break;

case vk_f8: allow = true; break;

case vk_f9: allow = true; break;

case vk_f10: allow = true; break;

case vk_f11: allow = true; break;

case vk_f12: allow = true; break;

case vk_numpad0: allow = true; break;

case vk_numpad1: allow = true; break;

case vk_numpad2: allow = true; break;

case vk_numpad3: allow = true; break;

case vk_numpad4: allow = true; break;

case vk_numpad5: allow = true; break;

case vk_numpad6: allow = true; break;

case vk_numpad7: allow = true; break;

case vk_numpad8: allow = true; break;

case vk_numpad9: allow = true; break;

case vk_multiply: allow = true; break;

case vk_divide: allow = true; break;

case vk_add: allow = true; break;

case vk_subtract: allow = true; break;

case vk_decimal: allow = true; break;

case ord("1"): allow = true; break;

case ord("2"): allow = true; break;

case ord("3"): allow = true; break;

case ord("4"): allow = true; break;

case ord("5"): allow = true; break;

case ord("6"): allow = true; break;

case ord("7"): allow = true; break;

case ord("8"): allow = true; break;

case ord("9"): allow = true; break;

case ord("0"): allow = true; break;

case ord("Q"): allow = true; break;

case ord("W"): allow = true; break;

case ord("E"): allow = true; break;

case ord("R"): allow = true; break;

case ord("T"): allow = true; break;

case ord("Y"): allow = true; break;

case ord("U"): allow = true; break;

case ord("I"): allow = true; break;

case ord("O"): allow = true; break;

case ord("P"): allow = true; break;

case ord("A"): allow = true; break;

case ord("S"): allow = true; break;

case ord("D"): allow = true; break;

case ord("F"): allow = true; break;

case ord("G"): allow = true; break;

case ord("H"): allow = true; break;

case ord("J"): allow = true; break;

case ord("K"): allow = true; break;

case ord("L"): allow = true; break;

case ord("Z"): allow = true; break;

case ord("X"): allow = true; break;

case ord("C"): allow = true; break;

case ord("V"): allow = true; break;

case ord("B"): allow = true; break;

case ord("N"): allow = true; break;

case ord("M"): allow = true; break;

}

return allow;

So, that's basically it.

Of course, you also need to make game respond to the key variables:

if keyboard_check(movement_up)

{

x -= 1;

}

Instead of:

if keyboard_check(vk_up)

{

x -= 1;

}

And the hardest part is probably to make the interface, but since every game has different interfaces, it's up to you.

But here's something that might help you do that:

/// scr_return_key_string(key)

var key_string = "";

switch(argument0)

{

case vk_left: key_string = "Left"; break;

case vk_right: key_string = "Right"; break;

case vk_up: key_string = "Up"; break;

case vk_down: key_string = "Down"; break;

case vk_enter: key_string = "Enter"; break;

case vk_space: key_string = "Space"; break;

case vk_shift: key_string = "Shift"; break;

case vk_control: key_string = "Ctrl"; break;

case vk_alt: key_string = "Alt"; break;

case vk_backspace: key_string = "Backspace"; break;

case vk_tab: key_string = "Tab"; break;

case vk_home: key_string = "Home"; break;

case vk_end: key_string = "End"; break;

case vk_delete: key_string = "Delete"; break;

case vk_insert: key_string = "Insert"; break;

case vk_pageup: key_string = "Page up"; break;

case vk_pagedown: key_string = "Page down"; break;

case vk_f1: key_string = "F1"; break;

case vk_f2: key_string = "F2"; break;

case vk_f3: key_string = "F3"; break;

case vk_f4: key_string = "F4"; break;

case vk_f5: key_string = "F5"; break;

case vk_f6: key_string = "F6"; break;

case vk_f7: key_string = "F7"; break;

case vk_f8: key_string = "F8"; break;

case vk_f9: key_string = "F9"; break;

case vk_f10: key_string = "F10"; break;

case vk_f11: key_string = "F11"; break;

case vk_f12: key_string = "F12"; break;

case vk_numpad0: key_string = "Numpad 0"; break;

case vk_numpad1: key_string = "Numpad 1"; break;

case vk_numpad2: key_string = "Numpad 2"; break;

case vk_numpad3: key_string = "Numpad 3"; break;

case vk_numpad4: key_string = "Numpad 4"; break;

case vk_numpad5: key_string = "Numpad 5"; break;

case vk_numpad6: key_string = "Numpad 6"; break;

case vk_numpad7: key_string = "Numpad 7"; break;

case vk_numpad8: key_string = "Numpad 8"; break;

case vk_numpad9: key_string = "Numpad 9"; break;

case vk_multiply: key_string = "Numpad *"; break;

case vk_divide: key_string = "Numpad /"; break;

case vk_add: key_string = "Numpad +"; break;

case vk_subtract: key_string = "Numpad -"; break;

case vk_decimal: key_string = "Numpad ."; break;

case ord("1"): key_string = "1"; break;

case ord("2"): key_string = "2"; break;

case ord("3"): key_string = "3"; break;

case ord("4"): key_string = "4"; break;

case ord("5"): key_string = "5"; break;

case ord("6"): key_string = "6"; break;

case ord("7"): key_string = "7"; break;

case ord("8"): key_string = "8"; break;

case ord("9"): key_string = "9"; break;

case ord("0"): key_string = "0"; break;

case ord("Q"): key_string = "Q"; break;

case ord("W"): key_string = "W"; break;

case ord("E"): key_string = "E"; break;

case ord("R"): key_string = "R"; break;

case ord("T"): key_string = "T"; break;

case ord("Y"): key_string = "Y"; break;

case ord("U"): key_string = "U"; break;

case ord("I"): key_string = "I"; break;

case ord("O"): key_string = "O"; break;

case ord("P"): key_string = "P"; break;

case ord("A"): key_string = "A"; break;

case ord("S"): key_string = "S"; break;

case ord("D"): key_string = "D"; break;

case ord("F"): key_string = "F"; break;

case ord("G"): key_string = "G"; break;

case ord("H"): key_string = "H"; break;

case ord("J"): key_string = "J"; break;

case ord("K"): key_string = "K"; break;

case ord("L"): key_string = "L"; break;

case ord("Z"): key_string = "Z"; break;

case ord("X"): key_string = "X"; break;

case ord("C"): key_string = "C"; break;

case ord("V"): key_string = "V"; break;

case ord("B"): key_string = "B"; break;

case ord("N"): key_string = "N"; break;

case ord("M"): key_string = "M"; break;

}

return key_string;

It turns, for example, movement_up variable into "Left" string.

You can use it like this:

/// Draw event

draw_text(x,y,scr_return_key_string(movement_up);

This could be useful.

So, until next week!

​I hope it will be as good as this one!

PS.: <3

Comments

Gift of Death 8 years, 10 months ago

GM:S also has chr(int) function built in. Could shave quite a bit off the switch statement in scr_return_key_string(key). I haven't tested what the output is with arrow keys and what not (probably just a space), but any unicode stuff is put out correctly.

Phoebii 8 years, 10 months ago

Yeah, I tried chr()

I could have used it for letters, but it's easier this way.