Accept hexadecimal input for numbers / Add the ability to type "16k" so it autocompletes to "16000"

Suggestions that have been added to the game.

Moderator: ickputzdirwech

Boogieman14
Filter Inserter
Filter Inserter
Posts: 778
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Accept hexadecimal input for numbers / Add the ability to type "16k" so it autocompletes to "16000"

Post by Boogieman14 »

TL;DR
Extend the numerical input parser/validator to also accept hexadecimal values (using the 0x prefix). No changes are requested in the display of these numbers (and internally, a number is just a number anyway)

Detail
Say I have a map with a lot of outposts. I want to provide all these outposts with supplies, but I don't want to have an excess number of trains running around. So I assign each outpost a number and put the outpost's number onto a circuit when supplies run low. My main base then automatically sends a train to the requesting outpost (assume for the moment, there's a mod that provides this exact functionality - it isn't there yet, but it's been hinted at). However, just using sequential numbers will lead to problems. Say both outpost 3 and 5 are requesting supplies: wire values add up, so the base sees an 8. How is the base supposed to know where to send the supplies?

Enter bitmapped fields.
Instead of assigning values 3 and 5 to these outposts they get assigned bits 3 (1000 binary, 8 decimal) and 5 (100000 binary, 32 decimal). Now when both outposts request materials, the circuit sees 40 (101000 binary) and there's no room for confusion.

Why hexadecimal inputs?
Small numbers are easy enough, anyone familiar with computer programming will know the sequence of powers of 2 for the first 10 to 16 bits by heart (in a distant past, even Factorio used powers of 2 for stacksizes! :o ). It gets a bit more difficult beyond that, when you're up to the 28th outpost or so. Remembering and accurately entering 134,217,728 is a lot harder than entering 0x800 0000 (and the steady sequence of 0x1, 0x2, 0x4, 0x8 followed by a number of 0's makes it easier still)

Why no changes to display of numbers?
I realize this suggestion is probably only interesting for a rather niche audience and this niche audience will likely be perfectly capable of recognizing what bit a displayed decimal value corresponds to.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by ratchetfreak »

Or you use a address line (on signal 0 for example) and a reply line and cycle over all outposts.

at the outpost you use a combinator signal 0 = Outpost ID output everything input-count and transmit that output over the reply line.

then when there is a train ready to depart you cycle over all outposts and you can check each individually and put the train sending logic at the departure station
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Accept hexadecimal input for numbers

Post by MF- »

I think hexadecimal input would be useful in many other applications of combinators.
User avatar
TuckJohn
Filter Inserter
Filter Inserter
Posts: 335
Joined: Sat Jul 04, 2015 4:11 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by TuckJohn »

Agree with you that it is a very specialized need. I think that it would add complexity that would not nessisarily be needed.
As for your outpost 'problem', I would've recommend having the outposts on separate circuits, so the values do not get mixed up.
~1200+ hours clocked in factorio. Avid KSP and Factorio player
Tinyboss
Filter Inserter
Filter Inserter
Posts: 564
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by Tinyboss »

TuckJohn wrote:Agree with you that it is a very specialized need. I think that it would add complexity that would not nessisarily be needed.
As for your outpost 'problem', I would've recommend having the outposts on separate circuits, so the values do not get mixed up.
Does it add any complexity, though? If you don't know that hexadecimal numbers are written with a "0x" prefix, then you would literally never know the feature existed at all.
Boogieman14
Filter Inserter
Filter Inserter
Posts: 778
Joined: Sun Sep 07, 2014 12:59 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by Boogieman14 »

Exactly, it changes nothing for players that don't know/need/use it.

And the outpost problem is just one example that made me think of this, I'm fairly certain minds far smarter than me can come up with lots of other ways to leverage a feature like this.
I don't have OCD, I have CDO. It's the same, but with the letters in the correct order.
Tinyboss
Filter Inserter
Filter Inserter
Posts: 564
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by Tinyboss »

Boogieman14 wrote:Exactly, it changes nothing for players that don't know/need/use it.

And the outpost problem is just one example that made me think of this, I'm fairly certain minds far smarter than me can come up with lots of other ways to leverage a feature like this.
Yeah, bitmasking is kind of a big deal.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Accept hexadecimal input for numbers

Post by ratchetfreak »

Tinyboss wrote:
Yeah, bitmasking is kind of a big deal.
but useless without bit-wise operators

With the current operators doing bitwise operations give no advantage to binary over tertiary or decimal.
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 304
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Allow hexadecimal entry for constant values in combinators

Post by justarandomgeek »

Given that Combinators now support many bitwise operations, it would be very useful to be able to enter, "0xff" or "0xff00" or "0xFE800000" or such as the constant second-argument of an arithmetic or decider combinator, or as the values on a constant combinator. Currently I have to flip over to the windows calculator and convert these values to decimal, and they become opaque blobs that then need further labelling (for non-trivial powers of two, at least) for future maintainability of the circuits.
Roxor128
Fast Inserter
Fast Inserter
Posts: 168
Joined: Sun Oct 02, 2016 9:48 am
Contact:

Re: Allow hexadecimal entry for constant values in combinators

Post by Roxor128 »

Yes, please! This would be hugely useful when trying to implement more computer-like systems. Decimal is great for many things, but computing isn't one of them.
Tekky
Smart Inserter
Smart Inserter
Posts: 1040
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: Allow hexadecimal entry for constant values in combinators

Post by Tekky »

I agree that it would be nice to be able to toggle between decimal and hexadecimal entry of numbers. But it should also be possible to toggle the display.
ratelslangen
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jul 20, 2020 10:27 pm
Contact:

Hex signal view, hex and mathematical input in constants

Post by ratelslangen »

Dear development team,

I would like to suggest three things:
  • I want to be able to enter numbers in this form "2 ^ 24" and have it be converted to 16777216.
  • I want to be able to enter numbers in hex form (eg, 0xFF is 255).
The points above would help tremendously with complex circuitry.
  • I would like to have a toggle in the options to display circuit numbers in hex form, to aid in debugging.
Thank you.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by ssilk »

Why in hex? Not very useful. Is for 0xABCDE76 the 15th Bit set or not? If that will be implemented I would add binary input.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
bormand
Fast Inserter
Fast Inserter
Posts: 201
Joined: Fri Jun 05, 2020 9:59 am
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by bormand »

ssilk wrote: Tue Jul 21, 2020 3:42 am Why in hex? Not very useful.
Because hex is very compact and people with programming background usually can convert between bin and hex on fly.

So, I vote for both 0xFF and 0b11111111.

P.S. Bit 17 of 0xABCDE76 is 1100 and bit 15 is 1101. Now try to find them in the 1010 1011 1100 1101 1110 0111 0110.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by ssilk »

It’s about comparability. Let’s say you want to program a LTN station, what’s easier?

Compare the wagon-mask with 0x0020000 to find the 17th wagon unloader. And 0x0040000 for the 18th. You need to think it all the time: 1, 2, 4, 8, then the next digit...

Or compare by using 0b0000 0000 0010 0000 0000 0000 0000 for the 17th, then copy that into buffer, go to next stop, paste, remove one 0 at front and add one 0 at the end. I would prefer this method, because I can’t make stupid mistakes. :)

... Ah. Now I see the sense of the other form you want to make inputs. “2^17”, “2^18”... and for bitmasks you can say “2^17 + 2^18” ...hm. Yes. :) I still think binary has it’s usecases, especially when taking an output and copy/paste it as input for something else. :P

BTW printing such numbers seems to be much more complex... but that’s normally not needed, and that is a completely different story - very old suggestions about seeing the actual non-abbreviated value and so on.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
bormand
Fast Inserter
Fast Inserter
Posts: 201
Joined: Fri Jun 05, 2020 9:59 am
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by bormand »

ssilk wrote: Wed Jul 22, 2020 4:32 amYou need to think it all the time: 1, 2, 4, 8, then the next digit...
You don't need to think about 1, 2, 4 and 8. Think in groups of 4 bits. You can look at the number 0xABCDE67 and see that unloaders for wagons 19 and 18 are active and for 17 and 16 are not (C=1100). And wagons 15, 14 and 12 are active too (D=1101). It takes a little practice to remember mapping between hex digits and their binary representations. But then you can read and write hex masks almost instantly.

In fact, binary is much more error prone to me. I always make stupid mistakes while counting those digits, especially if they aren't grouped.

That's why I suggest to add both formats. Both have their upsides and downsides.
foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by foamy »

bormand wrote: Wed Jul 22, 2020 5:52 am
ssilk wrote: Wed Jul 22, 2020 4:32 amYou need to think it all the time: 1, 2, 4, 8, then the next digit...
You don't need to think about 1, 2, 4 and 8. Think in groups of 4 bits. You can look at the number 0xABCDE67 and see that unloaders for wagons 19 and 18 are active and for 17 and 16 are not (C=1100). And wagons 15, 14 and 12 are active too (D=1101). It takes a little practice to remember mapping between hex digits and their binary representations. But then you can read and write hex masks almost instantly.

In fact, binary is much more error prone to me. I always make stupid mistakes while counting those digits, especially if they aren't grouped.

That's why I suggest to add both formats. Both have their upsides and downsides.
This. Hex translates easily and directly to binary, is more compact, and more readable and usable in nearly all cases. Memorizing the sixteen binary representations each hex digit encodes isn't difficult (and can be pretty easily worked out from first principles anyway), and anyone who wants to encode binary or hex numbers almost certainly knows how to do it.
coppercoil
Filter Inserter
Filter Inserter
Posts: 504
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by coppercoil »

I think the player cannot memorize sixteen representations if he uses them occasionally. Yes, he will know how to convert it using exernal tools, how about embedded tools? If we would have two display modes, why not to add the third one?

BTW every bit can be numbered, therefore no problems locating 15th bit.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by steinio »

I would prefer a converter combinator which gets a value as input, has a setting for the target digit system (2/10/16) and outputs the value converted.

This has the advantage that it can be put everywhere in the circuit where a specific value is needed in an other digit system.
Image

Transport Belt Repair Man

View unread Posts
netmand
Filter Inserter
Filter Inserter
Posts: 302
Joined: Wed Feb 22, 2017 1:20 am
Contact:

Re: Hex signal view, hex and mathematical input in constants

Post by netmand »

Is this not possible as a mod?
Post Reply

Return to “Implemented Suggestions”