Arcen Games

Games => AI War II => Private Alpha Discussion => Topic started by: BadgerBadger on June 18, 2017, 01:55:27 PM

Title: Proposed "Find Planet" screen
Post by: BadgerBadger on June 18, 2017, 01:55:27 PM
So one thing I really wanted in AIWC was a way to quickly find a particular planet. It was hard on a large planet map to quickly find a planet of interest, especially when I had loaded a game I hadn't touched for a while.

To solve this problem, I have extended the "Planet" menu to have a "Find Planet" button; clicking this button pops up a new menu with a box to type the name in. One types the name in and then clicks the "Find" button and the galaxy map centers on the planet.

I previously had opened Mantis bug 0019030, but this seemed like a fun and easy weekend project.

I am attaching some pictures and the code.
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 18, 2017, 02:10:01 PM
SWEET!  This is why I suddenly love the moddability of all this even more.  People coming up with ideas like this and figuring out ways to accomplish it is absolutely awesome.
Title: Re: Proposed "Find Planet" screen
Post by: Draco18s on June 18, 2017, 02:11:39 PM
Brilliant. :)
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 18, 2017, 02:27:28 PM
Hey Chris/Keith, I wasn't able to get this feature to block out all in-game hotkeys (Tab, WASD). Is there an easy way to do that which I am missing?
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 18, 2017, 02:30:54 PM
Kinda-sorta? We have a thing that checks for that sort of blockage, but I'm not sure we have a generalized hook that allows it to be turned on.  That's a Keith-area thing, though, so he should be able to expose that as a general hook I'd think.
Title: Re: Proposed "Find Planet" screen
Post by: eRe4s3r on June 18, 2017, 03:54:51 PM
I feel like this interesting coding achievement warrants that I point back to my original sidebar proposal... which you can read here
https://forums.arcengames.com/ai-war-ii/ship-icons/msg213862/#msg213862 (and that thread is interesting for many other reasons as it was, afaik, the only centralized place where we talked exclusively about GUI elements....

figure it might be worth to bring that old mockup back up because when you got search functionality already in there, then keith doesn't have to code it and the sidebar can get to be "there" faster ;p
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 18, 2017, 11:22:57 PM
Okay. @Keith, I'm looking for a hook that says "When someone has a text box highlighted, ignore all hotkeys they type and just put all input toward the text box". How doable is that?
Title: Re: Proposed "Find Planet" screen
Post by: keith.lamothe on June 19, 2017, 08:32:54 AM
Okay. @Keith, I'm looking for a hook that says "When someone has a text box highlighted, ignore all hotkeys they type and just put all input toward the text box". How doable is that?
I don't know yet, I didn't get it doing that for the uniterm console, hence why the camera tends to pan around as one is typing into that. I think those camera controls are particularly embedded in the configuration-of-unity side of things (rather than code files), so it's likely to be trickier to get a hook in there for if(TextboxHasFocus)return;

But I'm sure we'll figure something out; wouldn't really be shippable if you can't type a console command without the camera going everywhere.
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 19, 2017, 10:21:30 AM
Okay. @Keith, I'm looking for a hook that says "When someone has a text box highlighted, ignore all hotkeys they type and just put all input toward the text box". How doable is that?
I don't know yet, I didn't get it doing that for the uniterm console, hence why the camera tends to pan around as one is typing into that. I think those camera controls are particularly embedded in the configuration-of-unity side of things (rather than code files), so it's likely to be trickier to get a hook in there for if(TextboxHasFocus)return;

But I'm sure we'll figure something out; wouldn't really be shippable if you can't type a console command without the camera going everywhere.

Oh, whoops.  Yeah, actually I fixed that a while ago and put in some code that can easily be checked for that.

There's Engine_Universal.IsAnyTextboxFocused in the Arcen.Universal namespace.  That is a raw bool, so changing its value is inadvised; but that's a case of stripping off a layer of protection for a layer of speed.  At any rate, checking its state should be all you need.


Actually, hang on.  This actually just falls under me needing to add one more thing, because this should automatically work and just wasn't looking for the newer class properly.

* Put in a fix that should prevent keybinds from triggering while a textbox is focused.  We'd already done this for regular textboxes, but since moving over to TextMeshPro textboxes that was busted.  If it doesn't work properly now, please do let us know.

Thanks!
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 19, 2017, 10:35:46 AM
Neat. I should be able to do tab-completion of planet names now!
Title: Re: Proposed "Find Planet" screen
Post by: keith.lamothe on June 19, 2017, 02:51:39 PM
Neat. I should be able to do tab-completion of planet names now!
Quote
AI: ... why did you just nuke Lampson? I didn't even have anything there.
Player: Autocomplete. Meant Lamport.
AI: Oh. Yea, I hate it when that happens.
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 23, 2017, 01:26:42 PM
Characters like WASD no longer affect typing in text boxes, which is great! It looks like Tab still swaps between planet/galaxy view when typing in text boxes, but I think that's fine.

I have done a bit more to enhance this. I now correctly prevent you from finding planets for which you don't have BasicIntel. Also I've enabled autocomplete for unique prefixes. In the picture I attached, hitting ~ will now automatically finish the planet name "Dunkels" for you, so you don't have to type the whole name in for long planet names.
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 23, 2017, 01:30:57 PM
The fact that tab still does that just means that wherever the tab code is, isn't properly checking to see if there's a textbox highlighted.  That should be easily fixed, although Keith would know where that is better.  It's one for mantis.

Awesome that autocomplete and those other features are working, though!  I would advise against ~ simply because a lot of keyboards don't have that -- German, for instance, lack that at all. And it's in an odd place on a variety of others.

Super cool, at any rate!
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 23, 2017, 01:37:26 PM
The autocomplete character is set as a variable in the code, so I can make it anything y'all would prefer. Any recommendation? Maybe I'll let y'all fix Tab with textboxes, then use that?
Title: Re: Proposed "Find Planet" screen
Post by: WolfWhiteFire on June 23, 2017, 03:33:15 PM
At the rate BadgerBadger is going, you are going to have to add him to the credits as an assistant/volunteer coder or something like that. So far I have seen BadgerBadger code some new map types, though I don't know if they will be in the base game, added the ability to name save games, and now this.
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 27, 2017, 09:32:37 AM
At the rate BadgerBadger is going, you are going to have to add him to the credits as an assistant/volunteer coder or something like that. So far I have seen BadgerBadger code some new map types, though I don't know if they will be in the base game, added the ability to name save games, and now this.

No kidding!
Title: Re: Proposed "Find Planet" screen
Post by: Dominus Arbitrationis on June 27, 2017, 10:08:23 AM
For the record, as of when I'm writing this, he has reported 76 issues. The person behind him has reported 9 issues.
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 27, 2017, 10:20:35 AM
How did you get 76? What search criteria did you use?
Title: Re: Proposed "Find Planet" screen
Post by: Dominus Arbitrationis on June 27, 2017, 10:38:42 AM
How did you get 76? What search criteria did you use?

https://bugtracker.arcengames.com/plugin.php?page=MantisGraph/reporter_graph.php I'm not sure if you can see it, but I can pull up a bunch of different graphs that show stuff. Mantis internally says you have submitted 76 issues that were resolved.
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 27, 2017, 10:50:40 AM
Ah, that page says "Access Denied" for me. Cool. I like graphs.
Title: Re: Proposed "Find Planet" screen
Post by: x4000 on June 27, 2017, 11:44:13 AM
For the record, as of when I'm writing this, he has reported 76 issues. The person behind him has reported 9 issues.

Yup.  Special MVP credits are indisputably due.
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on June 27, 2017, 01:13:00 PM
Aww, thanks guys!
Title: Re: Proposed "Find Planet" screen
Post by: keith.lamothe on June 27, 2017, 01:22:26 PM
The help has been a great encouragement :)
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on July 06, 2017, 11:45:16 AM
I just realized I'd never actually uploaded the code for this. There are 3 files changed. The InGamePlanetActionMenu adds the FindPlanet button. FindPlanetMenu.cs implements the actual work, and the UIWindows sets up the location of UI elements.

I set autocomplete to be "@", but it's easily modified; check out the autoCompleteChar in FindPlanetMenu.

I believe you can basically drop this onto a build of .500 and recompile and have it work cleanly. Feel free to include it in the game (or tell me how you'd like it changed to make it worthy of inclusion)
Title: Re: Proposed "Find Planet" screen
Post by: keith.lamothe on July 06, 2017, 01:51:55 PM
This is in for 0.501, many thanks :)

I made a few refinements, like "if you try to type into the box while the default text is still there, it clears out that text first rather than trying to add onto it" and "autocomplete doesn't require a case-sensitive match". I think it also now moves the caret to the end of the line after an autocomplete, but I'm not sure I remember correctly.

I also tried to have it focus on the textbox when you open the window, but none of the usual suspects made that happen. If you're curious the code is at:
//TODO: make this actually select the element so that the user can type in the planet name without having to click on the element or navigate to it using WASD (which seems to work, oddly)

That last piece would go a long way, combined with an "enter clicks the button" behavior (which I could add, just gotta run for now), as I could then type 0,5,3,(characters of planet name),enter and it would take me straight there if there was a match.

But even with the mouse interaction this is a big win, thanks again :)
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on July 06, 2017, 04:47:59 PM
Great, all of those modifications sound good to me.

I have a few enhancements I'd like to make eventually. For example, I'd like it to be able to quickly find the Devourer Golem, Dyson Sphere, Zenith Trader, Superterminal, and other such things.
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on August 14, 2017, 11:49:29 AM
Okay, I've added some code to allow the Find Planet menu to find things that aren't just planets (currently the SuperTerminal, Devourer, Zenith Trader, Dyson Sphere and Nanobot hive). Adding new things is extremely easy. Also it will be easy to add a description of all the shortcuts later. Sometimes you just gotta know where the Devourer Golem is....
Title: Re: Proposed "Find Planet" screen
Post by: BadgerBadger on August 21, 2017, 03:43:13 PM
Also, I have some proposed tweaks to the Galaxy Map View. These are three modes, one that shows AI Progress Reducers (Data Center, Coprocessor, etc), one that shows AI Defenses (Ion Cannon, Raid Engine, etc) and one that shows "Cool Capturable Things" (Golems, Fabs, Adv Starship Constructor, etc).

To do this I added a tag to the structures that I was interested in.