Mindustry icon indicating copy to clipboard operation
Mindustry copied to clipboard

Extend logic `read` and `write`,support targeting `LogicBuild`

Open way-zer opened this issue 1 year ago • 14 comments

If your pull request is not translation or serverlist-related, read the list of requirements below and check each box:

  • [x] I have read the contribution guidelines.
  • [x] I have ensured that my code compiles, if applicable.
  • [x] I have ensured that any new features in this PR function correctly in-game, if applicable.

way-zer avatar Feb 14 '24 07:02 way-zer

what

BasedUser avatar Feb 21 '24 07:02 BasedUser

what

Allow processor to transfer variable to another directly, including Unit, Building...

way-zer avatar Feb 21 '24 07:02 way-zer

Problem: This allows for processors to act as memory storage, possibly greater than 64, rendering all memory storage useless

The4codeblocks avatar Feb 25 '24 20:02 The4codeblocks

Problem: This allows for processors to act as memory storage, possibly greater than 64, rendering all memory storage useless

Yeah, the processor is more powerful than memory storage, as it can store not only number but object.

But processor don't support string concat, so the read is not indexable. and it's more complex.

The feature of this PR is much powerful, that allow many complex logic design. (like function store processor, mulitiprocessing)

way-zer avatar Feb 26 '24 05:02 way-zer

Problem: This allows for processors to act as memory storage, possibly greater than 64, rendering all memory storage useless

Yeah, the processor is more powerful than memory storage, as it can store not only number but object.

But processor don't support string concat, so the read is not indexable. and it's more complex.

The feature of this PR is much powerful, that allow many complex logic design. (like function store processor, mulitiprocessing)

@counter arrays:

The4codeblocks avatar Feb 27 '24 15:02 The4codeblocks

Problem: This allows for processors to act as memory storage, possibly greater than 64, rendering all memory storage useless

Yeah, the processor is more powerful than memory storage, as it can store not only number but object. But processor don't support string concat, so the read is not indexable. and it's more complex. The feature of this PR is much powerful, that allow many complex logic design. (like function store processor, mulitiprocessing)

@counter arrays:

I know that, but it can't stop using that without this pr as it can use inside the same one processor. And this pr is also a enhancement for many advanced players like ones using @counter arrays.

Read&Write memory is simple and effictive. Read&Write processor allow more complex design and usage.

PS: @couter arrays for multiprocessor is more complex than single processor, as you need wait to sync. It is still better to use @couter arrays just in one processor. If you use processor to replace memory block with @couter arrays style, you need 2+2 line to implement, so that only allow lower than 1000/4 variables.

way-zer avatar Feb 27 '24 16:02 way-zer

Random idea: make the textbuffer in processors usable

The4codeblocks avatar Feb 29 '24 18:02 The4codeblocks

Random idea: make the textbuffer in processors usable

I has thinked that, it sounds good. A special variable points to the textbuffer StringBuilder and can be used in read and write.

way-zer avatar Mar 01 '24 01:03 way-zer

Reading from the text buffer implies making an allocation to copy the string to a variable, which is not acceptable.

Anuken avatar Mar 01 '24 02:03 Anuken

Reading from the text buffer implies making an allocation to copy the string to a variable, which is not acceptable.

welp

though that should also mean string variables would be unacceptable?

The4codeblocks avatar Mar 01 '24 15:03 The4codeblocks

Strings in logic are immutable. You can reassign the variable to a difference reference of a string, but you can't modify what it points to.

Anuken avatar Mar 01 '24 15:03 Anuken

Strings in logic are immutable. You can reassign the variable to a difference reference of a string, but you can't modify what it points to.

yeah, strings in logic are like java.lang.String, not java.lang.StringBuilder.

The4codeblocks avatar Mar 01 '24 20:03 The4codeblocks

possibly greater than 64, rendering all memory storage useless.

Somehow, but hasganter already made a processor handle 321 variable inside, and be perfectly usable, acting like memory bank with a bit less variables but way more compact

Yarplay1 avatar Jul 30 '24 16:07 Yarplay1