Custom Biomes

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Custom Biomes

Post by KINGTUT10101 » Sun Jul 15, 2018 18:03

Screenshot_20180715-103533.png
An example of what you could create while using this technique. As you can see, there are multiple ground types in this map, which isn't normally possible through map generation

In this tutorial, I'll be showing you how to make custom biomes. Using this technique, you'll have full control over the biome's size, position, and decorations. This will also allow you to have more than one ground type in map generation. This process uses a combination of decoration spawning and basic fun. Using the decoration spawning, we can put decorations in world generation that place a new ground type underneath them in order to create new biomes. You will also be able to provide some decorations to have spawned in your biome as well.

Some Sample Code

Code: Select all

[
	{
		"author":"Kingtut101",
		"autobuild":false,
		"borderframes":[
			{
				"count":16,
				"h":16,
				"w":32,
				"x":0,
				"y":32
			}
		],
		"edgeborderframes":[
			{
				"count":32,
				"h":32,
				"w":16,
				"x":0,
				"y":144
			}
		],
		"edgeframes":[
			{
				"count":12,
				"h":48,
				"w":16,
				"x":0,
				"y":96
			}
		],
		"frames":[
			{
				"bmp":"stoneground.png"
			}
		],
		"height":1,
		"id":"stoneground.kt101",
		"text":"Hard,graygroundforyourcities.",
		"title":"Stone",
		"type":"ground",
		"water":false,
		"width":1
	},
	{
		"author":"Kingtut101",
		"category":"$cat_terrain00",
		"drawground":true,
		"framealignmentarea":true,
		"frames":[
			{
				"bmp":"blank.png"
			},
			{
				"steal":"$searocks00"
			}
		],
		"fun":[
			{
				"actions":[
					{
						"id":"stoneground.kt101",
						"type":"build"
					},
					{
						"type":"remove"
					}
				],
				"condition":{
					"inner":[
						{
							"invert":true,
							"type":"wire"
						},
						{
							"frame":0,
							"type":"building"
						}
					],
					"type":"and"
				},
				"p":1
			},
			{
				"actions":[
					{
						"id":"stoneground.kt101",
						"type":"build"
					}
				],
				"condition":{
					"inner":[
						{
							"invert":true,
							"type":"wire"
						},
						{
							"frame":1,
							"type":"building"
						}
					],
					"type":"and"
				},
				"p":1
			}
		],
		"height":1,
		"hidden":false,
		"id":"rocks.kt101",
		"price":100,
		"pricefactor":0,
		"spawn":{
			"height":300,
			"p":1,
			"radius":150
		},
		"title":"Rocks",
		"type":"decoration",
		"width":1
	}
]
Before you start creating your own custom biomes there are a few things that are needed:
-Blank frames
-Decoration frames (optional)
-A ground type
-A decoration that will be spawned in map generation

All of the custom biome's functionality rests in the decoration code, so don't worry too much about the ground code. Next I'll begin to talk about how this all works in more detail.

Code: Select all

"fun":[
			{
				"actions":[
					{
						"id":"stoneground.kt101",
						"type":"build"
					},
					{
						"type":"remove"
					}
				],
				"condition":{
					"inner":[
						{
							"invert":true,
							"type":"wire"
						},
						{
							"frame":0,
							"type":"building"
						}
					],
					"type":"and"
				},
				"p":1
			},
			{
				"actions":[
					{
						"id":"stoneground.kt101",
						"type":"build"
					}
				],
				"condition":{
					"inner":[
						{
							"invert":true,
							"type":"wire"
						},
						{
							"frame":1,
							"type":"building"
						}
					],
					"type":"and"
				},
				"p":1
			}
		],
Here is the fun code. This is the part that creates the biome. What this is doing is detecting what frame the decoration is using and acting accordingly. In the first json I provided some frames called "blank.png". Because this frame was provided first, this becomes frame 0. What this fun code will do if it detects that the decoration is on frame 0 is make it place the Stone ground and then delete itself. However, as you might have noticed, I provided another frame. This is what will be used to decorate my biome. This frame will be frame 1. The fun code will detect if it is on frame one and if it is it will make it place the Stone ground, but instead of deleting it it will keep it. This is how we can get some decorations in our biomes.

The next part requires you to add decoration spawning code. You can find the tutorial here:
viewtopic.php?f=41&t=1355

Of course, this is just an example of how to accomplish custom biomes and I'm sure that there are better ways to code such a thing. There are probably an endless amount of combinations for custom biomes. However, this tutorial should get across the basic points. I will be providing the example plug-in below and if you don't understand this concept I would recommend that you take a look at it and tweak it to your liking. Feel free to reuse this plug-in code in your own plug-ins. Just make sure to credit me.
Attachments
Stone Ground.zip
(1.48 KiB) Downloaded 25 times
Last edited by KINGTUT10101 on Mon Jul 16, 2018 16:54, edited 1 time in total.

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Custom Biomes

Post by KINGTUT10101 » Sun Jul 15, 2018 18:07

Here is another example of what you can accomplish with this concept. For those of you who would like to use this plug-in, it will be released as part of a future plug-in pack.
Attachments
Screenshot_20180715-110551.png

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Custom Biomes

Post by KINGTUT10101 » Sun Jul 15, 2018 18:53

That could work, but would you be able to build stuff on it?

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Custom Biomes

Post by KINGTUT10101 » Sun Jul 15, 2018 20:46

I don't think they can spawn in world gen though.

User avatar
yusuf8a684
Inhabitant of a Megalopolis
Reactions:
Posts: 703
Joined: Sun Dec 10, 2017 22:09
Location: Turkiye
Plugins: Show
Phone model: Discovery One

Re: Custom Biomes

Post by yusuf8a684 » Sun Jul 15, 2018 21:18

Kingtut, it is awesome! I hope you can make mountains plugins with that idea. It doesn't need to look like 3D, just rock decals and trees cant grow on it. If there is a plugin about that can i have a link, please?
I born in Turkiye, i will die for Turkiye! Proud to be Muslim

Discord=EZGsP3n
*Eğer Türksen kesinlikle gel* If you aren't Türk... No matter, you can join ;)

My plugins

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Custom Biomes

Post by KINGTUT10101 » Mon Jul 16, 2018 3:31

yusuf8a684 wrote:
Sun Jul 15, 2018 21:18
Kingtut, it is awesome! I hope you can make mountains plugins with that idea. It doesn't need to look like 3D, just rock decals and trees cant grow on it. If there is a plugin about that can i have a link, please?
There isn't anything like that yet, but I'm sure someone might make it someday

User avatar
yusuf8a684
Inhabitant of a Megalopolis
Reactions:
Posts: 703
Joined: Sun Dec 10, 2017 22:09
Location: Turkiye
Plugins: Show
Phone model: Discovery One

Re: Custom Biomes

Post by yusuf8a684 » Mon Jul 16, 2018 11:26

KINGTUT10101 wrote:
Mon Jul 16, 2018 3:31
yusuf8a684 wrote:
Sun Jul 15, 2018 21:18
Kingtut, it is awesome! I hope you can make mountains plugins with that idea. It doesn't need to look like 3D, just rock decals and trees cant grow on it. If there is a plugin about that can i have a link, please?
There isn't anything like that yet, but I'm sure someone might make it someday
Where can i find this Kingtut?
Attachments
download.png
download.png (203.1 KiB) Viewed 371 times
I born in Turkiye, i will die for Turkiye! Proud to be Muslim

Discord=EZGsP3n
*Eğer Türksen kesinlikle gel* If you aren't Türk... No matter, you can join ;)

My plugins

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1729
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Re: Custom Biomes

Post by KINGTUT10101 » Mon Jul 16, 2018 16:52

It's at the bottom of the tutorial

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”

Who is online

Users browsing this forum: No registered users and 1 guest