Hex signal view, hex and mathematical input in constants

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

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: 12888
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: 12888
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 am
You 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 am
You 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: 472
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: 2633
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?

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 »

coppercoil wrote:
Wed Jul 22, 2020 8:20 am
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.
I'd have no problems with a binary encode as well, but if I had to choose between hex and bin for a human-facing interface, it'd be hex every single time.

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 »

netmand wrote:
Wed Jul 22, 2020 2:32 pm
Is this not possible as a mod?
Sure. Modded combinator that can set and display values in any format is certainly possible, at least.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

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

Post by Optera »

Having a combinator showing signals as bin or hex would already be a big qol improvement.

Entering numbers as hex though would make binary logic with circuits much simpler. I might even put windows calc away for generating overflow values.

Hannu
Filter Inserter
Filter Inserter
Posts: 850
Joined: Thu Apr 28, 2016 6:27 am
Contact:

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

Post by Hannu »

coppercoil wrote:
Wed Jul 22, 2020 8:20 am
I think the player cannot memorize sixteen representations if he uses them occasionally.
Probably significant part of Factorio players have some programming experience. In work, in studies or as a hobby. Programmers are familiar with hex system and can easily count bits. I prefer hex numbers over binaries if there is more than 8 bits, because it is somewhat difficult and very error prone to count for example 10 zeros before single set bit (10000000000 or 400). They need also less room to show. Factorio uses 32 bit integers and such binary number is very inconvenient compared to 8 number hexadecimal number.
If we would have two display modes, why not to add the third one?
This is true. It is good idea to include both if such modification is made. Additional work is small.

coppercoil
Filter Inserter
Filter Inserter
Posts: 472
Joined: Tue Jun 26, 2018 10:14 am
Contact:

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

Post by coppercoil »

Hannu wrote:
Fri Jul 24, 2020 9:56 am
Programmers are familiar with hex system and can easily count bits.
Programmers are familiar with hex system - yes.
Can easily count bits - no. Most programmers don't use bits often, thereby have no need to memorize them.

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 »

coppercoil wrote:
Fri Jul 24, 2020 4:59 pm
Hannu wrote:
Fri Jul 24, 2020 9:56 am
Programmers are familiar with hex system and can easily count bits.
Programmers are familiar with hex system - yes.
Can easily count bits - no. Most programmers don't use bits often, thereby have no need to memorize them.
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1111

Twenty seconds, mostly for typing.

coppercoil
Filter Inserter
Filter Inserter
Posts: 472
Joined: Tue Jun 26, 2018 10:14 am
Contact:

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

Post by coppercoil »

Opening the calculator is even faster. But why?

Hannu
Filter Inserter
Filter Inserter
Posts: 850
Joined: Thu Apr 28, 2016 6:27 am
Contact:

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

Post by Hannu »

coppercoil wrote:
Fri Jul 24, 2020 4:59 pm
Can easily count bits - no. Most programmers don't use bits often, thereby have no need to memorize them.
You may be right. I began (hobby when I was a kid) at 80's and then everyone began learing binary and hexadecimal numbers on third day after getting first computer. I could disassemble 6510 code from hex dump on screen (not practical level, because I did not remember all rare instructions) and it was not unusual nerd skill on those days.

It may be better that I do not say my opinions of modern so called "programming languages" and so called "programmers". And especially their awful so called "commercial products" (I do not talk about Factorio now, it's quality is excellent). :)

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

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

Post by ssilk »

When I read over this, I thought it would be much more useful and easier to implement to have each number input field added two buttons:

Button 1 switches the displays of numbers: decimal, hex, binary and so on. By default always at dec. You can input numbers in dec/hex/bin and the mode switches automatically to that format. If you can do calculation inline here (see OP), it should display current result somewhere in the choosen format.

Button 2 opens a calculator window. How the calculator works is open, but for the first implementation it should have basic operators in decimals.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Qon
Smart Inserter
Smart Inserter
Posts: 2119
Joined: Thu Mar 17, 2016 6:27 am
Contact:

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

Post by Qon »

ssilk wrote:
Sat Jul 25, 2020 3:42 am
How the calculator works is open, but for the first implementation it should have basic operators in decimals.
What is a decimal operator?

User avatar
jamiechi1
Fast Inserter
Fast Inserter
Posts: 196
Joined: Wed Jan 03, 2018 10:12 pm

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

Post by jamiechi1 »

I think unit conversions to various bases might be useful for some mods that provide a virtual processor that one can use in the game and write code for it. But in general, without mods, I don't see the need for it. Although if you add binary and hexadecimal, I want Octal conversions as well. :D

Post Reply

Return to “Ideas and Suggestions”