One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2019-03-24 14:40:34

zed
Member
Registered: 2017-06-27
Posts: 46

keyboard control

I've been experimenting with keyboard control, and although the way I've
implemented it might well please no-one but me, I thought I might as well
share my work:

https://gitlab.com/_zed_/OneLife/

I haven't compiled binaries for you or anything, you'll have to compile from
source to try it.

It's based on classic roguelike input methods. See
https://gitlab.com/_zed_/OneLife/blob/m … bdcommands
for a full command list. The whole protocol is covered.
I find it entirely usable, and much more comfortable than using a mouse.
There are also a few things which you can't do with the mouse, like picking an
item from deep in a backpack and marking locations.

If anyone wants to take this further, feel free! I guess the main thing to do
before it would make senes to make a PR to the main project would be to add
configuration options to enable/disable keyboard control and set the keys.

Offline

#2 2019-03-24 14:48:37

Whatever
Member
Registered: 2019-02-23
Posts: 491

Re: keyboard control

Nice,

Did you see this pr: https://github.com/jasonrohrer/OneLife/pull/18
its about wasd movement

I think it would be nice if you could only move with wasd but not with the mouse.
This way you could make it so if you right/left click a tile you automatically:
pick up an item that is on the tile / or use an item on that tile (for example round stone one stacks for building)

Offline

#3 2019-03-24 15:03:01

Whatever
Member
Registered: 2019-02-23
Posts: 491

Re: keyboard control

Many cool things here, i dident try it out yet, but could explain this a bit more:

m <mark> : mark current location
' <mark> : go to marked location

So i press for example "m" and then "k", then i go 200 blocks away and press "'" and "k", will it go back to the correct position?

q <dir>: kill player

xD

f <dir> : pick up from / use object on target

if i wanted to pick up an item 2 blocks above me, what would i type?
Are you using hjkl as directional keys like in vim? Why not wasd?

Offline

#4 2019-03-24 15:31:17

zed
Member
Registered: 2017-06-27
Posts: 46

Re: keyboard control

Whatever wrote:

So i press for example "m" and then "k", then i go 200 blocks away and press
"'" and "k", will it go back to the correct position?

Yes, except that because of the way things work it will only move about 8
tiles per command, so you have to keep typing "'k".

q <dir>: kill player

It's actually really good to separate the kill command from the use command -
no more accidental knifings!

if i wanted to pick up an item 2 blocks above me, what would i type?

You have to get next to it first, so "kfk".

Are you using hjkl as directional keys like in vim? Why not
wasd?

Because I was raised on roguelikes and vim wink.

wasdqezc would work too I guess, with command keys on the right. Best would be
to have the keys configurable. If there's actually interest, and no-one else
wants to, I could take the time to implement that.

Offline

#5 2019-03-24 15:36:31

Whatever
Member
Registered: 2019-02-23
Posts: 491

Re: keyboard control

Can you play the game like this without using the mouse?
Do you play it only using the keyboard?
Is this faster? What are the advantages and what are the disadvantages?

Offline

#6 2019-03-24 15:56:48

zed
Member
Registered: 2017-06-27
Posts: 46

Re: keyboard control

Yes, it fully replaces the mouse. That was my primary aim - I personally
dislike using mice, and can never be comfortable using them.

It's been a long time since I've tried playing the game with mouse control, so
I'm not sure exactly how it compares. But I expect kbd control is
substantially faster for many purposes, in part because you can rely on muscle
memory for repetitive tasks, and don't have to worry about misclicks or
hunting for active pixels. A few things are more fiddly -- the worst is
checking the names of people around you, where I haven't found a mechanic
that's anything like as powerful as mousing over them. It also lacks any
equivalent of holding down the mouse button to run, but I find typing e.g.
"al" once a second to keep running to the right is fine really. There's also a
big learning curve of course; I still haven't memorised what number
corresponds to what item of clothing, for example.

Last edited by zed (2019-03-24 15:57:35)

Offline

#7 2019-03-24 16:15:20

Whatever
Member
Registered: 2019-02-23
Posts: 491

Re: keyboard control

zed wrote:

the worst is checking the names of people around you, where I haven't found a mechanic
that's anything like as powerful as mousing over them.

I am using the mouse but i still find it annoying to check player names.
So i wanted to do it so that player names will be shown always.
I added this line:

if (inObj->name) handwritingFont->drawString( inObj->name, personPos, alignCenter );

at 2 points in the source code, right after these lines:
https://github.com/jasonrohrer/OneLife/ … .cpp#L4018
https://github.com/jasonrohrer/OneLife/ … .cpp#L3781
This will write player names around their feet, but i dident do it the right way.
Sometimes player names will not be shown, and they will be drawn behind objects (like players)
Also the text is most of the time white, but changes color if someone wears a blue hat for example.
In order to always draw them white, you could put this before the drawString line: (not tested)

setDrawColor( 1, 1, 1, 1 );

I was to lazy to improve it further, but i always play like this, helps me out here and there.

(you could also make it so that if you press a key it shows the names as long as you press it)
(the names could have different colors depending on your relationship with them - green your mum - dark green your grandmum - blue sister / brother - and so on .... )

Last edited by Whatever (2019-03-24 17:15:18)

Offline

#8 2019-03-31 16:24:59

wondible
Member
Registered: 2018-04-19
Posts: 855

Re: keyboard control

Interesting ideas. I've been playing around around with click modifiers to sort out the ambiguities. Right now it's just move, object, and self (mostly eat)

Some things feel more awkward, but one day probably wasn't enough to get over the learning curve. Some are better of course - I don't know of a way to examine a door in vanilla, and cycling stakes is way faster.

I think the best way to handle names might be holding a key to show names, as Whatever described.

- I found backpack awkward. I didn't really figure out the position bit in the time I was playing. A cycling option like the base game would be nice.
- I also had trouble with boxes, but that might be learning curve. One time I couldn't find a way to cycle through items, but I may have found one later. Needs more experience
- Clothing numbers are definitely obtuse.
- I didn't see away to attack animals at range. At least it shouldn't be an accidental move onto their tile, but I don't like to stand next to them.
- A repeat command would be nice. Though really it's often two commands (pick up berry, put in bowl)
- Saved locations are really good (maybe too good at long distances) I'd love to able to use them for objects e. g., use on forge.
- Moving to multiple objects feels more awkward (e. g. layed out pottery when using kiln)
- Use and drop feel opposite to the base game in places (e. g. stacks of bowls). Probably all the special cases in the vanilla click handler.
- Use with diagonals doesn't work, but then happens when you walk next to the target tile.
- There seem to be some missing animations, e. g., bounce towards something you interact with.
- There are two 'j' in the source, I assume one is supposed to be 'k' - the compiler actually complained about duplicate case.
- I also did a little patch to shut it off in VOG mode.


https://onemap.wondible.com/ -- https://wondible.com/ohol-family-trees/ -- https://wondible.com/ohol-name-picker/
Custom client with  autorun, name completion, emotion keys, interaction keys, location slips, object search, camera pan, and more

Offline

#9 2019-03-31 18:10:51

Whatever
Member
Registered: 2019-02-23
Posts: 491

Re: keyboard control

About doors:

Jason added springy doors, i dident see them jet, but i find it weird.
Why not instead make it so you automatically open and close doors when you go trough them.
And path finding should not be blocked by doors (unless they are locked ofcourse)

This might be a bit tricky to implement, idk, i wish jason would have done it.
I wonder what he thinks about it.

Offline

#10 2019-03-31 19:59:38

BlueDiamondAvatar
Member
Registered: 2018-11-19
Posts: 322

Re: keyboard control

Whatever wrote:

About doors:

Jason added springy doors, i dident see them jet, but i find it weird.
Why not instead make it so you automatically open and close doors when you go trough them.
And path finding should not be blocked by doors (unless they are locked ofcourse)

This might be a bit tricky to implement, idk, i wish jason would have done it.
I wonder what he thinks about it.

I had a whole thread about this - making doors not block pathing, so we don't have to RP opening and closing doors - shortly after the temperature update, and Jason actually commented a few times, but didn't seem to buy in.  I think the springy doors are as close to a reaction to that complaint as we are going to get.  I did live in a town with springy doors yesterday, and they were quite nice.


https://onehouronelife.com/forums/viewtopic.php?id=5394

But honestly, i'm never building walls unless he makes doors automatically pathable.  The likely amount of heat a standard building is going to make really isn't worth how bad the blocked paths through towns have become.  Guess I'll just have to live with not ever building walls.


--Blue Diamond

I aim to leave behind a world that is easier for people to live in that it was before I got there.

Offline

Board footer

Powered by FluxBB