Custom Biomes

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Custom Biomes

Post by KINGTUT10101 »

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:
https://theotown.com/forum/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.
You do not have the required permissions to view the files attached to this post.
Last edited by KINGTUT10101 on 16 Jul 2018, 14:54, edited 1 time in total.
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

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.
You do not have the required permissions to view the files attached to this post.
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

That could work, but would you be able to build stuff on it?
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

I don't think they can spawn in world gen though.
y
yusuf8a684
Reactions:

Re: Custom Biomes

Post by yusuf8a684 »

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?
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

yusuf8a684 wrote: 15 Jul 2018, 19: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
y
yusuf8a684
Reactions:

Re: Custom Biomes

Post by yusuf8a684 »

KINGTUT10101 wrote: 16 Jul 2018, 01:31
yusuf8a684 wrote: 15 Jul 2018, 19: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?
You do not have the required permissions to view the files attached to this post.
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

It's at the bottom of the tutorial
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by Yakka Works »

KINGTUT10101 wrote: 15 Jul 2018, 16: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.
Your nature pack beach
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by Yakka Works »

If you have lag problem try use
On built fun instead fun
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by KINGTUT10101 »

Ideally, you should use lua if possible. I've heard its faster than fun. Even if that's not true, it's much more flexible and powerful.
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Custom Biomes

Post by Yakka Works »

KINGTUT10101 wrote: 14 Sep 2021, 22:32 Ideally, you should use lua if possible. I've heard its faster than fun. Even if that's not true, it's much more flexible and powerful.
I know but im still trying to figure it out how to
Just know how to make gui and mixer tool based on tree planter tool
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
Previous topicNext topic