Loading multiple positions within a pair of Save nodes

Okay, this kinda is an thought for loading the positions for many things through just two save behaviors- say we have a random world generator. It will have to be finite in size no matter what.

Up to 81 positions (a 9 by 9 square) could be saved with a pair of Saves, one for each axis. And if you want it to support multiple blocks- up to 9 types.

Say our first block was in the position 1,1

Save X: 1
Save Y: 1

Every block after 1,1, would have its position, then multiplied by 10^x, then added onto the save… depending on how far it is from the origin point, 1,1

So say we had the block at 1,1. But also wanted a block at 2,1 as well.

Save X: 21
Save Y: 11

Another at 3,2

Save X: 321
Save Y: 211

And when the saves are loaded, the individual digits are unpacked and are spawned where they were the previous session.

And this alone is just for a 9 by 9 tile chunk. To expand your game, youd have to make multiple save pairs as well. Using expressions to add offsets to the spawning objects to allow everything to be placed without overlapping.

@“Mhx Ar” Eureka

Can I get a tester to confirm this? This very idea could lead us to much more complex games.

My main thought, will integer overflow stop a save from saving 999999999?

Because if so that could limit this, although I imagine all of the tiles saved in a single position would be pretty impractical.

Hey @Wizardry with your 3D raycast example, we might be able to pull off a wolfenstein clone, where you build a fort, and defend something from enemies. You can SAVE the forts configuration!

Unfortunately, this would be very limited, as 9*9 is 81, so that means in order for every tile to be loaded, youd have to have 81 different tiles loaded, can the engine handle this @grazer?

So I came up with a formula that works with a couple of expressions nodes

(A*10^b)+C

Where A is the position of the tile on the axis.

B is the amount of tiles before it.

The number you get out of this is added to the number string before it ©, the sum of this is your new number string

@“Mhx Ar”, remember that calculator you made? Think of that.

Heres what I havent figured out yet- unpacking said string. Youd have to reverse the order of packing, but thats trickier than it sounds… for me atleast

I’m not a math guy, so it doesn’t quite make sense to me. I would be using individual saves for each block type. It sounds cool to grid the stuff around, but how would you decide if it is grass water or tree? My version writes grass, draws tiles that on collision turn grass into hillsides, and then draws water that turns grass into riverbanks and hillsides into waterfalls.

Actually, I saw someone else do a map generator, was it PixelPizza or wizardry? It’s cool to see everyone coming up with their own versions.

@“Mhx Ar”

If you wanted to do types, it would only work with up to 9.

Instead of just a pair of Saves, it would be a trio- with each type being assigned a #.

Literally the same thing goes for it.

Also, this could be used in conjunction with a world generator, it is simply saving a bunch of objects positions with a pair/trio of number strings.

If you were to combine this with the way you have your world generator, it would be INSANE, because now you have a detailed world, that not only remembers the way it was
generated, but also rewrites itself according to how it was when it saved

The best thing I ever designed was an Animal Crossing random town generator, fully functioning, even the fruit trees are random and the clock and music would change with night, day, and rain.

81 random map blocks sounds insane to me

I could easily pull it off in flowlab, but last thing I need is to spend weeks on something for no reason, then get sued by Nintendo lol

If you pull it off, I’d love to see the logic behind it

@“Mhx Ar” I have an engineering class, and Im going to bring it up with my teacher, and see if we can come up with an equation to unpack a string

Being that Im 15, I may not be able to do this, as I still have much more to learn…

Maybe, we should get an older string saved as well, so we can undo it

Grazer said the max int was 2,147,483,647 not 999,999,999 but 9 complete decimal places is easier I guess.

Also I don’t see how 9 decimal places equates to 81 locations if you use 1 decimal place per location going by your description, so at best it only works for a 3x3 grid or 9 positions.

I thought of a way to pack 27 bits into a single Number component though, using 9 decimal places as the max. Imagine a 27x1 grid:

A B C - D E F - G H I - J K L - M N O - P Q R - S T U - V W X - Y Z !

for location A or 1,1 we can record a location by using value 1 if there is something there, or 0 if nothing
for location B or 2,1 we can record a location using value 2 or 0
for C we can record a location using 4 or 0

These three bits are added together or multiplexed into a single decimal place that records all three position’s data. For example this is all the possible outcomes:

0 means A B and C contain nothing.
1 means A contains something, and B and C contain nothing. A=1
2 means B contains something, and A and C contain nothing. B=2
3 means A and B contain something, C nothing. A=1 + B=2
4 means C contains something, and A/B nothing. C=4
5 means A and C contain something, B nothing. A=1 + C =4
6 means B and C contain something. B=2 + C=4
7 means A B and C contain something. A=1 + B=2 + C=4

So this first decimal place can be between 0-7 and represent 3 positions. For the second decimal place you use the same values but multipled by increasing values of ten.

the next group D E F uses 10,20,40. the third uses 100,200,400. the fourth 1000,2000,4000, and so on with the final 9th group uses 100,000,000 200,000,000 and 400,000,000.

The way I imagined this being done was having recording blocks spaced out every 27 blocks, or alternatively and probably easier just a single recording block that moves throughout the map grid writing the data into Number components. Every 27 blocks it just restarts and writed onto the next Number component. After everything is done being written down these numbers can be saved and when it’s tome to start the map and load, it reads these numbers in reverse to spawn out blocks in the location as it moves around the map grid. Each block type would potentially have to have its own write/read system though, but it should be as easy as making anew object, copy/pasting the code, changing the specific block type to the new block.

so 81 digits would definitely Overflow, so 3 by 3 would be far better? That works.

All this math hurts my head.

The reason 81 is present is because 9*9 is 81, so that means there are 81 posible positions, but because 81 digits goes far over the point where it overflows, 3 by 3 is 9, and 9 digits would not hit overflow, while 4 by 4 cant work because 16 digits would go over too, so it looks like we found our maximum

So lets see here, 333,333,333 would not hit the overflow point by any means, and that would be the max value for a chunck, but thats impractical again because all of the objects would be in one point, but by theory its possible.

So in theory if overflow wasnt a problem here, 9 by 9 could work, but 3 by 3 would be more suited because overflow exists.

Still gotta figure out that unpack equation, which means we have to be able to remove all of the digits one by one… this equation is going to be much much much larger than I had originally thought.

I reread your version, but unpacking it seems to be just as hard as this, although you wouldnt have to use it as much, because youre going by a single dimension at a time, where Im going by both.

I need to rest, Im fried…

This is beyond me. I gave up math after algebra and geometry. I joined flowlab because I’m a multimedia artist. I was a terrible LUA and C++ coder. I understand code logic and gates, because of it, but once you get to math, I can’t help at all lmao. It’s all on you guys and grazer.

This is keeping me up. @grazer any ideas?

I thought of a method to unpacking.

Ya pretty risky, as You might end up with an endless loop.

@grazer how do you do exponents. ^ doesnt want to work

Use Math.pow(x,y) for x to the power of y

Error, unexpected eof

It’s case-sensitive and kind of annoying to type out but I mean it works

I got it. Thanks