OpenXcom Forum

Modding => OpenXcom Extended => Topic started by: Meridian on July 15, 2016, 11:22:50 am

Title: [Documentation] Multiple inventory templates
Post by: Meridian on July 15, 2016, 11:22:50 am
Hi,

so I'm working on a feature, which will allow you to have multiple (permanent) inventory templates.
For example, you can have one template for your melee guys, one for snipers, one for weak soldiers, one for heavy soldier, one for meat shields, and so on...

I have two possible UI ideas in my mind:

1. limited number of templates (let's say up to 10), no UI, just shortcuts... for example Shift+F1 to Shift+F10 to save templates on positions 1 to 10 and then shortcuts F1 to F10 to apply the template saved on corresponding position. The hotkeys would be configurable of course.

Advantages: very quick management, no extra clicks, no extra files (everything saved within the main save file)
Disadvantages: not enough slots?, no possibility to name templates

2. unlimited number of templates, saved on file system in the save directory (but not within the save file)... hotkeys to save/load templates... which open UI similar to save/load game

Advantages: unlimited slots (maybe first 10 could even have hotkeys to improve speed), templates can have names
Disadvantages: slower management (too many clicks :) ), more files in the save directory, templates are not part of the save file

Let me know, which one you like better... or if you have a better idea...

M.
Title: Re: Multiple inventory templates
Post by: ivandogovich on July 15, 2016, 01:47:42 pm
I think Option 1 is probably better, personally.  I like that its more streamlined.
Title: Re: Multiple inventory templates
Post by: Stoddard on July 15, 2016, 02:29:55 pm
Do them templates include armor?
Title: Re: Multiple inventory templates
Post by: Meridian on July 15, 2016, 02:41:21 pm
Do them templates include armor?

No, but it's an interesting idea.
(I probably would prefer if they didn't.)

You can still easily change the armor by pressing 'A' (or 'M' ... I don't remember) and selecting from a list.
Title: Re: Multiple inventory templates
Post by: Solarius Scorch on July 15, 2016, 03:11:04 pm
You can still easily change the armor by pressing 'A' (or 'M' ... I don't remember) and selecting from a list.

It's A :)
Title: Re: Multiple inventory templates
Post by: Stoddard on July 15, 2016, 07:20:49 pm
2. unlimited number of templates, saved on file system in the save directory (but not within the save file)... hotkeys to save/load templates... which open UI similar to save/load game

I think that would be too much code complexity wrt saves not having relevant items/armors (for the inv layout) researched. Also I know I will make a horrible mess of those saved layouts and won't ever know how I named the one I need right now. Not to mention the clicks.

So please no.

No, but it's an interesting idea.
(I probably would prefer if they didn't.)

Having thought about it I can't quite think of how it could be done acceptably UX-wise. I guess that should left for the future.

You can still easily change the armor by pressing 'A' (or 'M' ... I don't remember) and selecting from a list.

Thanks for the heads-up.
Title: Re: Multiple inventory templates
Post by: Arthanor on July 15, 2016, 09:15:59 pm
I feel like option 1 is the more elegant and it should be sufficient. 10 roles is a fair amount and your 11th most common role should be getting into the rather uncommon, so dealing with it by hand isn't too much of a pain.

Would we keep the quick loadout create/apply as well? ie have F1 to F10 for saved permanent loadouts, and then the create/apply template on the go that's not saved anywhere, which can be defined on the fly?

I find the quick create/apply convenient for things like mansion missions: Define a "gal in maid armor with the best she can get" template, paste on pretty much everyone, then upon return from missions, the F1-10 keys would be used for reassigning proper raiding gear. It's not worth saving a mansion loadout permanently, because the missions are rare and gear evolves between them, but it's very convenient to quickly apply the same to all the gals that go on the mission.
Title: Re: Multiple inventory templates
Post by: Meridian on August 09, 2016, 04:34:39 pm
OK, so I have decided for a hybrid solution.

Implemented so far:
- there will be 9 templates
- templates are global and saved within the save file (nodes "globalEquipmentLayout0" to "globalEquipmentLayout8")
- templates will survive also mod upgrades... if modder removes a weapon, ammo or inventory slot, the removed object in the save will be ignored (i.e. won't crash)
- hotkeys are fixed
- ctrl+1 to ctrl+9 to save template 1 to 9
- shift+1 to shift+9 to load template 1 to 9

I will publish this soon.

In second phase I will implement also GUIs, which:
- will allow to name individual templates
- ctrl+0 to save under a selected template (1 to 9) with option to name the template
- shift+0 to load from a selected named template

- ctrl+0 and shift+0 may be replaced by existing quick load and quick save configurable hotkeys... not decided yet
Title: Re: Multiple inventory templates
Post by: Solarius Scorch on August 09, 2016, 04:44:19 pm
It's great news, except for this part:

- hotkeys are fixed
- ctrl+1 to ctrl+9 to save template 1 to 9
- shift+1 to shift+9 to load template 1 to 9

Honestly, I will be erasing my templates half the time I'm trying to use them. I assure you I won't be able to remember what is activated by Ctrl and what by Shift. It's the same for any game (except action games where you mostly keep your hand in the same place). Which is probably why no game, as far as I know, uses such a system.
Why not do like others do (say, Starcraft for example) and assign Shift+0...9 for saving a template and just 0...9 for recalling them?
Title: Re: Multiple inventory templates
Post by: Meridian on August 09, 2016, 04:58:50 pm
Honestly, I will be erasing my templates half the time I'm trying to use them. I assure you I won't be able to remember what is activated by Ctrl and what by Shift. It's the same for any game (except action games where you mostly keep your hand in the same place). Which is probably why no game, as far as I know, uses such a system.
Why not do like others do (say, Starcraft for example) and assign Shift+0...9 for saving a template and just 0...9 for recalling them?

I was inspired by Ctrl+insert and Shift+insert for copy/paste in many applications... but you have a point.

Let's do:
- Ctrl+0...9 for saving
- 0...9 for loading
Title: Re: Multiple inventory templates
Post by: CanadianBeaver on August 09, 2016, 09:56:47 pm
It will be great, if different types of armors can have different layouts in inventory screen. I don't know, maybe this opinion has been proposed before.
Title: Re: Multiple inventory templates
Post by: Meridian on August 09, 2016, 10:02:44 pm
It will be great, if different types of armors can have different layouts in inventory screen. I don't know, maybe this opinion has been proposed before.

They already have, if you look for example at PirateZ mod.
Title: Re: Multiple inventory templates
Post by: Meridian on August 10, 2016, 07:13:12 pm
Loading GUI is done, now saving :)
Title: Re: Multiple inventory templates
Post by: Starving Poet on August 10, 2016, 09:38:49 pm
Oh this is going to be such a time-saver.
Title: Re: Multiple inventory templates
Post by: Arthanor on August 11, 2016, 12:29:27 am
I am so looking forward to that! Woot!
Title: Re: Multiple inventory templates
Post by: Meridian on August 11, 2016, 02:09:02 pm
It's finally ready.
There are some changes:

- there are 20 templates, 9 of them can be accessed directly via hotkeys, the rest via GUI only
- templates are global and saved within the save file (nodes "globalEquipmentLayout0" to "globalEquipmentLayout19")
- templates will survive also mod upgrades... if modder removes a weapon, ammo or inventory slot, the removed object in the save will be ignored (i.e. won't crash)
- direct hotkeys are fixed: ctrl+1...9 to save template 1 to 9; 1...9 to load template 1 to 9
- GUIs can be opened by configurable quick save(F5) and quick load(F9) hotkeys
- templates can have names, which can be entered via GUI only... direct hotkeys will preserve existing names
- direct hotkeys work only in base or during briefing, not during mission; same for load GUI
- save GUI works always, i.e. also during mission

See attached.
I would appreciate some help with testing.

Code: [Select]
      STR_EMPTY_SLOT_N: "Empty slot {0}"
      STR_UNNAMED_SLOT_N: "Unnamed slot {0}"
      STR_LOAD_EQUIPMENT_TEMPLATE: "LOAD EQUIPMENT TEMPLATE"
      STR_SAVE_EQUIPMENT_TEMPLATE: "SAVE EQUIPMENT TEMPLATE"
      STR_SAVE_UC: "SAVE"
Title: Re: Multiple inventory templates
Post by: hellrazor on August 11, 2016, 03:12:17 pm
I hope this will be merged into vanilla branch!

Since I wanted to have something like this since ages see here (https://openxcom.org/forum/index.php/topic,3304.0.html)
Title: Re: Multiple inventory templates
Post by: Meridian on August 11, 2016, 03:23:38 pm
I hope this will be merged into vanilla branch!

That doesn't depend on me.
Title: Re: Multiple inventory templates
Post by: hellrazor on August 11, 2016, 03:46:45 pm
That doesn't depend on me.

I know would be cool thou.
Title: Re: Multiple inventory templates
Post by: SIMON on August 11, 2016, 04:32:01 pm
This might be a silly question but how do you access the screens as depicted in your 2 images, idiot proof instructions would be appreciated, currently running off your exe of 2016-08-11.

Many thanks in advance
Title: Re: Multiple inventory templates
Post by: Meridian on August 11, 2016, 05:10:00 pm
This might be a silly question but how do you access the screens as depicted in your 2 images, idiot proof instructions would be appreciated, currently running off your exe of 2016-08-11.

Many thanks in advance

F5 and F9... or whatever hotkeys you have configured for quick load and quick save in Options > Controls
Title: Re: Multiple inventory templates
Post by: ivandogovich on August 12, 2016, 09:08:15 pm
I did test this out a bit last night, and had no troubles with it.  My mansion crews have standard templates now. :)
Title: Re: Multiple inventory templates
Post by: CanadianBeaver on August 19, 2016, 12:27:42 am
They already have, if you look for example at PirateZ mod.

O no... thx.
Anyway, I do not see the difference in the documentation:
https://www.ufopaedia.org/index.php/Ruleset_Reference_(OpenXcom)#Inventory_Sections
https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Inventory_Sections

Title: Re: Multiple inventory templates
Post by: Meridian on August 19, 2016, 09:13:35 am
O no... thx.
Anyway, I do not see the difference in the documentation:
https://www.ufopaedia.org/index.php/Ruleset_Reference_(OpenXcom)#Inventory_Sections
https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Inventory_Sections

I didnt put any of my changes on the wiki as they are not part of vanilla openxcom, yet.
Title: Re: Multiple inventory templates
Post by: ivandogovich on August 19, 2016, 03:46:42 pm
O no... thx.

I really don't get this response.  You are saying that different armors should have different layouts and Meridian responds that XPiratez has been doing that for sometime.  You respond with "no thanks."   This feels like "Something from Piratez? Forget it!"  (Edit: maybe I misunderstood it, I appologize for the semi rant that follows, if I did. Maybe you were saying, "Piratez has it?  O No! Now I have to figure out all of the arcane stuff in that mod to see how it works!" )

If you are hoping for this in vanilla, OpenXcom Extended (Yankes branch) and OpenXcom Extended Plus (Meridian's additions to Yankes' branch) have moved beyond vanilla a long time ago.  With these features Dioxine has devised a very clever system that uses Nulls to block out parts of the inventory layouts for different armors.  Some armors have the handslots blocked with built in weapons and only 4 inventory slots available in 1x1s on the legs and shoulders.  Others have 28 inventory slots available on making them awesome pack mules.  The flexibility of this system is pretty impressive.

(https://www.ufopaedia.org/images/7/74/Armor_RefractorI_Piratez.png)

I can give you a better breakdown on how Dioxine implements these if you like, because I have had to figure it out to update the wiki.

Title: Re: Multiple inventory templates
Post by: Solarius Scorch on August 19, 2016, 04:42:37 pm
I think Beaver meant "Oh, I should have known this, thanks for informing me." But it's not like I know. :)
Title: Re: Multiple inventory templates
Post by: CanadianBeaver on August 19, 2016, 06:30:48 pm
ivandogovich, I ask about openXcom, not about forks, because only OpenXcom 1.0 works on Linux without problems. I am so sorry, but I have no idea how OpenXcom nightly and forks of OpenXcom can be compiled on Linux and I do not want to waste time on it. For example, there is a repository of OpenXcom nightly for ubuntu, but it do not work on virtualized ubuntu (I think it depends on video driver) and I think it does not work on Debian.  Also, I am afraid that no one is interested in OpenXcom forks on Linux.
Title: Re: Multiple inventory templates
Post by: ohartenstein23 on August 19, 2016, 06:37:12 pm
Everything I do with OpenXcom is on Linux, there's even someone who wrote a bot that builds OXCE+ for a few different Ubuntu releases (https://lxnt.wtf/oxem/).  If you have the proper libraries (listed here (https://www.ufopaedia.org/index.php/Compiling_(OpenXcom)) on the wiki), compilation is a matter of using the provided Makefiles with something like
Code: [Select]
make -f Makefile.simple and waiting for it to finish.

There are plenty of people interested in running OpenXcom on Linux.
Title: Re: Multiple inventory templates
Post by: CanadianBeaver on August 19, 2016, 06:42:51 pm
There are plenty of people interested in running OpenXcom on Linux.

OK, I made a mistake, sorry. Two and a half men are interested in this.

Can somebody confirm it:
OpenXcom 1.0 and OpenXcom nightly (without attention to forks) do not allow different layouts for different armors? - Is it true or false?

If it is false, please, give the worked example from .rul file.
Title: Re: Multiple inventory templates
Post by: ivandogovich on August 19, 2016, 07:04:28 pm
OK, I made a mistake, sorry. Two and a half men are interested in this.

Can somebody confirm it:
OpenXcom 1.0 and OpenXcom nightly (without attention to forks) do not allow different layouts for different armors? - Is it true or false?

If it is false, please, give the worked example from .rul file.

From the quick check I just did, it looks like this ability is only in the OpenXcom Extended Branch.  So there you go.  It gives armor the same ability to define builtInWeapons: as units have.

As far as "only two and a half men..."  seems like you are a bit narrow in your view, as I get the sense that a lot of the developers and players enjoy working with linux, especially for building versions of the project.  I can't really speak to what linux variant works, and what doesn't and in which environments and why, but most of the linux users in the community often find ways to address their problems by adding lines to cmake and building their own.

Anyway, it seems like these are not the droids you are looking for.   I'm sorry you wasted your time looking for a feature that wasn't available in vanilla.
Title: Re: Multiple inventory templates
Post by: CanadianBeaver on August 19, 2016, 08:14:44 pm
a lot of the developers and players enjoy working with linux, especially for building versions of the project.

Yes, you are right. A lot of developers from two and half man do it for himself. These forks work good on the developer's PC, but outside... May I ask you, how many repositories of forks exist for Linux? Also, how many repositories of OpenXcom nightly exist for different Linux?

Anyway, I have got the answer for my main question about layouts. Thank you. I am so sorry that I do not share your enthusiasm about forks.
Title: Re: Multiple inventory templates
Post by: Meridian on August 19, 2016, 09:44:23 pm
Just for future reference, absolutely all forks in all repositories in all versions support linux.
Title: Re: Multiple inventory templates
Post by: hellrazor on August 19, 2016, 11:09:39 pm
Yes, you are right. A lot of developers from two and half man do it for himself. These forks work good on the developer's PC, but outside... May I ask you, how many repositories of forks exist for Linux? Also, how many repositories of OpenXcom nightly exist for different Linux?

Anyway, I have got the answer for my main question about layouts. Thank you. I am so sorry that I do not share your enthusiasm about forks.
ok, first and foremost. It does not matter which of the forks you use, they all originate here (https://github.com/SupSuper/OpenXcom) and oxce and oxce+ basically always pull in bugfixes and changes from the main tree.

Installation instructions for this can be found here (https://www.ufopaedia.org/index.php/Compiling_(OpenXcom)#Linux.2FBSD) and here (https://www.ufopaedia.org/index.php/Compiling_with_CMake_(OpenXcom))
Read learn and adept and dont throw around your attitude here.
If you have questions you can always ask. Even visit the irc #openxcom @ freenode
people will certainly help you.
Title: Re: Multiple inventory templates
Post by: Stoddard on August 20, 2016, 12:21:10 am
OXCE+ for linux is being continuosly built here https://lxnt.wtf/oxem/

Between minimal dependencies and three ubuntu flavours one surely can find a binary that would work on some other linux.
Besides I can add another dozen builds no problem, I just don't know which ones are wanted.