Jump to content
Sign in to follow this  
gaius

Hotkey for building

Recommended Posts

I made some changes, so now Hotkeys can be used to select buildings to build. F.e. if pressed "Z" (the default-setting) and a Unit is selected, now a House (because its the first element in buildings-panel) is selected and can now be placed to build by this Unit. If "Z" is pressed when a Building is selected, then still the first Unit will be build, like before.

Would that be of any interest for 0 A.D. 0.23 Vanilla? @elexis

  • Like 1

Share this post


Link to post
Share on other sites

Something like this would be a bit frustrating with how the current unit panels are designed. There are a lot of buildings which can be constructed, so a lot of keys as well.

However, if the construction panel were to be split into categories like AoE it would be a different story. And would be more simple to use as well.

For example, to build the first building in the millitary category, you can just press “m” and then “z”.

Its also worth mentioning that with the current layout, there is a kinda low maximum limit of buildings that can be available to a faction. And some mods have already ran into the issue of not having enough space. IIRC, yours as well.

Edited by (-_-)

Share this post


Link to post
Share on other sites

For that reason i used the hotkeys for Units (Z,X,...N,M,Comma), so only the 8 most common buildings can be selected that way, more than that will be  a mess, very true, and the placement problem i I got rid of by making the Icons a bit smaller, So now i have 32 buildings slots and not 24 like before. But what should be done is that Females and Soldier have the same 8 most common Buildings in their Builder- Entities List, otherwise it will be confusing.

Share this post


Link to post
Share on other sites

Depends on the implementation. As (-_-) mentioned it's very weird if you have the same hotkey configuration but it equates to a different unit or building for each civ.

It should be something like B for blacksmith for all civs.

But since all civs have different civ templates, one can't use the template name as an identifier. It would either have to be an Identity class - or what I came to conclude - a hotkey identifier in the template names, such as "hotkey.building.tower" or "hotkey.building.gate_ishtar". (It's what I intended to code after the hotkey editor which I coded in 2017 but never released.)

This way one could control have the game with keypresses.

  • Like 1

Share this post


Link to post
Share on other sites

My solution is only to use the 8 most common building (the first row), and if we write in the templates template_unit_support_female_citizen.xml and template_unit_infantry.xml the same first 8 builder Entities, then the fist row in buildings panel will never change, as far as i tested. That would be, even without hotkeys, a good idea. And to use the same hotkeys as for Units is the best solution, cause it is the simplest solution.  @elexis

Share this post


Link to post
Share on other sites

Btw. to make Hotkeys for special buildings or a fortress, would be too complicated to implement and for the players to remember and to understand. And  these building will only be build , most of the time,  only once in a game.

Share this post


Link to post
Share on other sites

It could be B -> build, S -> special building, S -> next special building and the user could specify which special buildings S binds to.

Share this post


Link to post
Share on other sites

Yes, but as a player, i would never uses this, too complicated too remember and also for most player too many Keys to press. It would be faster and less frustrating to only use the mouse then. Maybe I don't like to play Zero-K just because of this implementation.

Share this post


Link to post
Share on other sites

And what if you currently have both structures and units selected? Would B then mean unit:build or structure:train5thunit? Or both?

Share this post


Link to post
Share on other sites

It will train the Unit, cause it is first tested, if a building with trainable units is selected. But in game that is rare case that unit and buildings are selected at the same time.

Share this post


Link to post
Share on other sites
1 hour ago, Nescio said:

And what if you currently have both structures and units selected? Would B then mean unit:build or structure:train5thunit? Or both?

If the same key is assigned to multiple hotkeys, all of the hotkeys are triggered when the key is pressed. Whether the hotkey does something is up to the code assigned to it. Building hotkeys for instance should only be triggered once the GUI is in "building placement mode" after pressing that hotkey; i.e. B for build, H for house. So this particular example would unlikely occur unless the user configured it particularly weirdly. But in many places of the current code that's already the case and also the reason why there's the "shiftlag" issue.

Share this post


Link to post
Share on other sites

But in my implementation, i just check in the addTrainingByPosition function of input.js, if buildings or units are selected, so there shouldn't be any lag or overhead.

Share this post


Link to post
Share on other sites

Thx fpre, didnt know about that ticket. But my solution to go over the Hotkeys for Units is preferable, in my opinion. No lag, no overhead, easy to adopt by players, and easier to understand, unlimited hotkeys, until know the first 15 buildings are all the same for all civs. But later I maybe implement the formation/stances-hotkey, which are pretty nice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×