Author Topic: Proposed "Find Planet" screen  (Read 751 times)

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Proposed "Find Planet" screen
« 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.

Offline x4000

  • Chris Park, Arcen Games Founder and Lead Designer
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 30,645
Re: Proposed "Find Planet" screen
« Reply #1 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.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark IV
  • *****
  • Posts: 3,905
Re: Proposed "Find Planet" screen
« Reply #2 on: June 18, 2017, 02:11:39 PM »
Brilliant. :)

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Re: Proposed "Find Planet" screen
« Reply #3 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?

Offline x4000

  • Chris Park, Arcen Games Founder and Lead Designer
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 30,645
Re: Proposed "Find Planet" screen
« Reply #4 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.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline eRe4s3r

  • Core Member Mark II
  • *****
  • Posts: 2,800
Re: Proposed "Find Planet" screen
« Reply #5 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
Proud member of the Initiative for Bigger Weapons EV. - Bringer of Additive Blended Doom - Vote for Lore, get free cookie

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Re: Proposed "Find Planet" screen
« Reply #6 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?

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: Proposed "Find Planet" screen
« Reply #7 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.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris Park, Arcen Games Founder and Lead Designer
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 30,645
Re: Proposed "Find Planet" screen
« Reply #8 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!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Re: Proposed "Find Planet" screen
« Reply #9 on: June 19, 2017, 10:35:46 AM »
Neat. I should be able to do tab-completion of planet names now!

Offline keith.lamothe

  • Arcen Games Staff
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,250
Re: Proposed "Find Planet" screen
« Reply #10 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.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Re: Proposed "Find Planet" screen
« Reply #11 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.

Offline x4000

  • Chris Park, Arcen Games Founder and Lead Designer
  • Administrator
  • Zenith Council Member Mark III
  • *****
  • Posts: 30,645
Re: Proposed "Find Planet" screen
« Reply #12 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!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Online BadgerBadger

  • Hero Member
  • *****
  • Posts: 570
  • BadgerBadgerBadgerBadger
Re: Proposed "Find Planet" screen
« Reply #13 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?

Offline WolfWhiteFire

  • Full Member Mark II
  • ***
  • Posts: 180
Re: Proposed "Find Planet" screen
« Reply #14 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.