Reassembly

Reassembly

Not enough ratings
Regions 101
By icky
This guide serves one of two purposes.
1. It is a quick refresher for region syntax
2. It is an in depth guide on basic region functionality
   
Award
Favorite
Favorited
Unfavorite
Intro
This section serves as a quick refresher of region syntax with very basic explanations. More complicated pieces of syntax will also have a more in depth chapter later. Attached below is also an example of a regions file with all the syntax included and groupId=123.

Basic Region information
These are the things that absolutely have to be in every region. Everything else is semi-optional. They are as follows:

ident= color= faction= count= position= radius= type=



ident= is the identifier for the region. It is usually a pretty good idea to simply use your factionId or groupId and add some zeroes. This is a unique number, and if you decide to use subregions then each ident must be different.
  • An example would be:
    ident=10201


color= defines the color that the region blob will show up as in the minimap. It is given as 0x followed by a six digit hex number. The game does not care if you use capital or lowercase characters, but consistency is nice.
  • An example of a white region would be:
    color=0xFFFFFF


faction= is the actual identifier for your faction, and is the number that you type into sandbox when you want parts or ships from that faction. It is also the group= in your blocks.lua.
  • Assuming the earlier group is 102, an example would be:
    faction=102


count= is the number of region blobs that will spawn for the defined region. It is an integer, and most likely has a maximum of 255. Note that the count is specifically for this region, so if you make another region it will have a separate count.
  • An example to only spawn one region blob would be:
    count=1


position= is how far away from the center the region spawns. This is usually given as a decimal from 0 to 1 although if you really wanted to, you can also go above this limit. The measurement is a percentage in decimal form of the radius of the galaxy. Therefore to spawn at the exact center you would write position=0, to spawn at the outer edge you would write position=1, and to spawn in between the middle and outer edge would be position=0.5. This value can either be given as a flat number or as a range.
  • An example to spawn a region blob at exactly 37.7% distance from the center to the outer edge would be:
    position=0.377
  • An example to spawn a region blob between 40% and 70% distance from the center to the outer edge would be:
    position={0.4,0.7}


radius= is how large the radius of the region is. This is usually given as a decimal from 0 to 1 although if you really wanted to, you can also go above this limit. The measurement is a percentage in decimal form of the radius of the galaxy. Therefore to have a region that is as big as the galaxy you would write radius=1, and to have a region with a radius that is half as big as the galactic region (making the region 1/4 as big) you would write radius=0.5. This value can either be given as a flat number or as a range. For most factions it is HIGHLY recommended to be bigger than 0.1 and smaller than 0.2, although personally I think the maximum should rather be 0.18.
  • An example to spawn a region blob with exactly 15% radius compared to the total galaxy size would be:
    radius=0.15
  • A pretty standard example to spawn a region blob between 12% and 16% radius compared to the total galaxy size would be:
    radius={0.12, 0.16}


type= is how the region spawns. There are three different types: 0, 1, and 2. Most factions use type=2. You can only have one type per region.
  • An example to spawn a circle region would be:
    type=2


Type 0 is voronoi. An example of this is shown to the right. This region will create a shape where any and all points on the outside edge are as far as possible to the originating region center. These points are a certain distance from the "center" of the region, and the average of all these distances will be equal to the radius given by "radius=".

The benefit to using this type of region is that you get a significantly more consistent region size because it tries not to overlap with other regions, but the downside is that the shape can become very wacky as seen in the picture.



Type 1 is splats. This is similar to the default red region, and will scatter a bunch of small randomly placed blobs in the defined radius. This is usually not used for modding, because it is incredibly hard to control, and many factions with tiny splatted regions usually end up using type 2 with a very high count as opposed to type 1.

Type 2 is circles. This is how most modded factions are defined, and it will simply spawn a circle at the defined position with the defined radius. The benefit to using circle regions is that it is easy to understand, and the shape tends to be very consistent, although unfortunately this type of region can get overlapped.
Fleets
Fleets are the backbone of most regions and allow for most ships to spawn. Unless you are making a gimmicky region for your faction, the vast majority of your time will be spent finetuning these bits of code. I have also written a more in depth guide that goes over fleet density/diversity. The syntax required is as follows:

fleets= fleetCount= fleetFraction=




fleets= is the field where you specify the groupId, and then spawn radii and allocated p. If you do not include a radius explicitly, it will be grouped into the closest defined one.
The format is as follows:
fleets={ {groupID, { {radius, allocated p}, {next radius, allocated p}, etc. } } }




Here is an example for a faction with groupID 30 that has 1000p of ships on the outer edge, 2000p of ships halfway away from the center of the region, and 3000p of ships at the center area of the region:




fleets={ {30, { {0, 3000}, {0.5, 2000}, {1, 1000} } } }




fleetCount= is directly related to your fleets section. It specifies the amount of ships that can spawn for the p amount given in fleets=. You can have one general fleetCount all the way up to one fleetCount per each fleets group. The first fleetCount corresponds to the first fleets group and so on. If you have less fleetCount groups than fleets groups, the last fleetCount group will apply to the rest of the fleets groups (citation needed).
Note that this example has only 10 p allocated for each fleets group, which normally won't be remotely close enough to work well. This is just for space purposes.

Each fleetCount group is given as a range between two numbers. Here is a fleetCount that spawns between 1 and 3 ships for the first fleets group and between 3 and 6 for the rest:
fleetCount= {1, 3}, {3, 6}




fleetFraction= is how often unique groups spawn. The ingame map is made up of many large pixels, and each pixel is considered its own "sector". The fleetFraction is given as a decimal percent chance for a unique group to spawn in each sector owned by the given region.
  • As an example, if you want your fleet group to spawn in 50% of the sectors in your region, then you would use the code:
    fleetFraction=0.5
  • It is usually best to stick with fleetFraction=1, but if you are having troubles with too many ships spawning or you want to experiment then this is a good place to do that.
Fortresses
Fortresses are ships specified to spawn around broken stations when you are playing as a different faction entering a region. The syntax required is as follows:

fortress= fortressCount= fortressRadius=


fortress= is the field where you specify the ships you want to spawn as a fortress group. These ships will still be able to spawn from regular fleets. A ship name is given by the faction ID, an underscore, and then the shipname. Here is an example of a fortress group with ships from faction 20 called ship1 and ship_2:
fortress={ "20_ship1" "20_ship_2" }
These ships are ones that will be chosen from when creating a fortress group. Lower cost ships have a slight spawn priority.


fortressCount= is the amount of ships that will spawn within a fortress group. These are chosen from the fortress= list.
  • An example of a fortressCount that spawns 3 defending ships per broken station is:
    fortressCount=3 or fortressCount={3}
  • An example of a fortressCount that spawns between 3 and 6 defending ships per broken station is:
    fortressCount={3,6}


fortressRadius= is the maximum distance (in reassembly units) that ships will spawn away from the broken station. Make sure that this is far enough to accomodate the ships you want.
  • An example of a fortressRadius that spawns defending ships 30 blocks away from a broken station is:
    fortressRadius=300
Unique
Unique is used to define some very specific ships and spawn them independently regardless of anything else in the regions file. There are only two pieces of syntax to know.

unique= uniqueFraction=


unique= is the field where you specify the ships you want to spawn as a unique group. These ships will still be able to spawn from regular fleets. A ship name is given by the faction ID, an underscore, and then the shipname. Here is an example of a unique group with ships from faction 20 called ship1 and ship_2 (note the extra brackets):
unique={ { "20_ship1" "20_ship_2" } }
When a unique group is spawned, every defined ship within that group is spawned. This means that if you write a unique group with 20 of the same ship, it will spawn 20 copies of that ship.

It is also possible to choose from multiple unique groups.
unique={ { "20_ship1", "20_ship_2"} { "20_ship1"} { "20_ship1", "20_ship1", "20_ship_2"} }
This unique field will spawn either:
  • one ship1 and one ship_2
  • one ship1
  • two ship1 and one ship_2


uniqueFraction= is how often unique groups spawn. The ingame map is made up of many large pixels, and each pixel is considered its own "sector". The uniqueFraction is given as a decimal percent chance for a unique group to spawn in each sector owned by the given region.
  • As an example, if you want your unique group to spawn in 50% of the sectors in your region, then you would use the code:
    uniqueFraction=0.5
Ambient
Ambient tags are used to define asteroid and plant/building spawns within your region. The corresponding flags are as follows:

ambient= asteroidDensity= asteroidSize= asteroidFlags=


ambient= defines what kinds of plants/buildings can spawn within your region. There are 4 different ambient "tags."
0 will spawn green plants
1 will spawn blue plants
2 will spawn pink plants
-1 will spawn faction buildings. This only works if this is the only tag you use. Also you actually have faction buildings in the ident= fleetpallete and they must be made correctly.
If you don't have an ambient=, no plants will spawn. Order doesn't matter.
It is technically possible for faction buildings to spawn with any or no ambient tags, but it is fairly rare (especially if buildings have higher costs).
  • An example of a region with only green plants is
    ambient={0}
  • An example of a region with pink plants and blue plants is
    ambient={2, 1}
  • The only possible region with faction buildings is
    ambient={-1}


asteroidDensity= defines how often asteroids show up in your region. It goes from 0 to 1, where 0 means no asteroids and 1 means the screen looks something like this (ignore the asteroids with brown blocks in them. these are custom created/spawned with unique regions) (note how asteroids made of similar shapes are grouped together)
.png]
  • An example of a region with a fair amount of asteroids is
    asteroidDensity=0.5 or asteroidDensity={0.5}
  • An example of a region with a range of asteroids is
    asteroidDensity={0.2, 0.5}
  • Giving a range generally yields better looking regions. I strongly suggest messing around with different combinations to achieve desired results. As an example, my mod "Chalce Collective" uses
    asteroidDensity={0, 0.0001} and looks very different than asteroidDensity=0


asteroidSize= defines how many blocks each asteroid is made of. It can be given as a number or as a range. This usually works very well, but occasionally there will be asteroids in the region well outside the given range. This usually happens with penrose asteroids as there are very specific numbers that make up complete asteroids, but for some reason square asteroids with 4 blocks also happen fairly often.
  • An example of a region with asteroids made up of 30 blocks is
    asteroidSize=30 or asteroidSize={30}
  • An example of a region with asteroids made of between 30 and 70 blocks is
    asteroidSize={30,70}



asteroidFlags= is a list of traits that asteroids can have. Contrary to popular belief, these do not actually have to be capitalized, but it is a good idea to do so because of consistency. Here is a full list:
EXPLOSIVE|HEXAGON|OCTAGON|PENROSE|SQUARE|TRIANGLE|UNIFORM_SIZE|UNIFORM_TYPE

The flags given here: HEXAGON|OCTAGON|PENROSE|SQUARE|TRIANGLE|UNIFORM_TYPE technically allow for all or at least a greater portion of the regions asteroids to be made up of the specified shape. Unfortunately this doesn't really work. These tags are basically useless.

EXPLOSIVE will change all asteroid blocks into a pink material that explodes on contact when touched or damaged enough.

UNIFORM_SIZE will make asteroid clusters have the same amount of blocks. This means that if you define an asteroidSize, it will keep asteroids between those block amounts, but also each asteroid will have the exact same number of blocks in it. However there can be multiple asteroid "clusters" in a region, and each "cluster" will have its own block amount.
  • An example of a region with one asteroid flag is
    asteroidFlags=EXPLOSIVE
  • An example of a region with multiple asteroid flags is
    asteroidFlags=EXPLOSIVE|UNIFORM_SIZE
  • Because there are only two working asteroid flags, its usually better to just leave them entirely out of your regions unless you want something specific.
Conclusion
Note that this is a guide to help you get started making regions on your own. There isn't really a good way of doing them, and even the way specified in my other guide isn't going to be perfect. When you are making a faction, you are going to have to open reassembly and make sure what you made works well. Here are some pointers:

The map is a liar. When making a new galaxy, literally none of the information on the map is remotely correct. As an example, here is a picture of a map(left) and how to world generated(right).

While the faction circled in red looks tiny in the first image, it has an okay size in the second image. Also while it still looks small, that is because it is being compared to a lot of mods with unacceptably big regions (remember to keep them at a MAXIMUM of 0.18 radius).

Play with voronoi and circles and see which one makes your region look nicer ingame. Its generally a good idea to stay away from splats unless you have a good idea of what you are doing (especially because splats tend to overlap other regions a lot).

Try to have the most possible ships from your fleetpallete spawn. Being lazy when making regions is going to bite you when people unsubscribe from your mod because the regions were boring.

Whitespace is good. You want there to be a reasonable amount of space between ships in your region. If everything is packed in together, you aren't going to have a good time.

Here is a link that goes over region diversity and some more complicated region mechanics
2 Comments
icky  [author] 14 Jun, 2021 @ 10:36am 
Still in progress. Also fleetCount is not the same as palette number.
cocaine scout 6 Jun, 2021 @ 9:14am 
why is there absolutely nothing under fleets? I looked at the files and in the vanilla regions.lua file the fleet count is just equal to the palette number