Override background

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Override background

#1

Post by Lobby »

Screenshot_20171130-204326.png
Hi, as proposed here it's now possible to change the color of the background. The background basically persists out of a tile frame that's drawn over and over again. Unfortunately it's a bit less simple, as there are some special cases due to elevated coast lines. As a result you have to provide 3 frames to override the background:
image.png
image.png (1.62 KiB) Viewed 6140 times
Frames b and c are used to draw the background above water at the edges. This is crucial as ocean is drawn everywhere and has to be overdrawn at the correct positions.

Starting with game version 1.11.08 you should also provide a fourth frame that will be used for more optimized drawing:
image.png
image.png (1.15 KiB) Viewed 6140 times
It should represent a 4x4 tile grid of frame a.

The original frames look like:
frames_orig.png
frames_orig.png (369 Bytes) Viewed 6140 times


This sample replaces the background with a black one:
frames.png
frames.png (361 Bytes) Viewed 6140 times
frames_tiled.png
frames_tiled.png (1.14 KiB) Viewed 6140 times
For your own background, just recolor these images :)

The code to override the background looks like:

Code: Select all

[
  {
    "override":true,
    "id":"$anim_blank00",
    "type":"animation",
    "frames":[
      {"bmp":"frames.png","w":32,"h":16,"handle y":8},
      {"bmp":"frames.png","x":32,"w":16,"h":16,"handle y":8},
      {"bmp":"frames.png","x":48,"w":16,"h":16,"handle x":-16,"handle y":8},
      {"bmp":"frames_tiled.png","handle y":32}
    ]
  }
]
As you are responsible for setting the frame handles properly I recommend to just reuse this code instead of writing it on your own.
own_background.zip
(2.9 KiB) Downloaded 183 times

User avatar
mdk_813
Inhabitant of a Country
Posts: 857
Joined: 16 Dec 2016, 02:38
Location: Germany
Plugins: Showcase Store

Platform

Re: [383]Override background

#2

Post by mdk_813 »

@Lobby
Thank you! :thumbsup:

User avatar
KINGTUT10101
1,000,000 inhabitants
Posts: 2226
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: [383]Override background

#3

Post by KINGTUT10101 »

Is it possible to have multiple frames for the background?

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [383]Override background

#4

Post by Lobby »

no

User avatar
BruceWillis24
Villager
Posts: 21
Joined: 09 Aug 2015, 00:42
Location: USA
Plugins: Showcase Store
Version: Beta

Platform

Re: [383]Override background

#5

Post by BruceWillis24 »

@Lobby I really like the brown background in the first image you posted in this topic. Could you post that as well?

Thank you in advance!

User avatar
CommanderABab
AB
Posts: 11185
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [383]Override background

#6

Post by CommanderABab »

There it is!  :)
There it is! :)

User avatar
Bearbear76
Former Bearbear65
Posts: 5730
Joined: 10 Feb 2017, 14:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: [383]Override background

#7

Post by Bearbear76 »

You can change the background
In winter by using "frames winter":[{}],
Something i discovered yesterday

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [383]Override background

#8

Post by Lobby »

Yes, you can do that everywhere where you have to provide frames :)

User avatar
Bearbear76
Former Bearbear65
Posts: 5730
Joined: 10 Feb 2017, 14:53
Location: L2 cache
Plugins: Showcase Store

Plugin Creator

Platform

Re: [383]Override background

#9

Post by Bearbear76 »

IMG_20171226_085022.jpg

User avatar
Tyteam
Settler
Posts: 1
Joined: 29 Jan 2021, 15:45

Re: Override background

#10

Post by Tyteam »

can someone help me i dont know how to do it i want to make it like the sea color

User avatar
Lobby
Developer
Posts: 3713
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Override background

#11

Post by Lobby »

The first post was updated to reflect new functionality in 1.11.08. Your background should basically provide a 4x4 tiled frame as well for the game to use to draw big chunks of the background at once. This reduces draw calls significantly if a lot of background is visible on the screen.

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”