Page 1 of 1

Override background

Posted: 30 Nov 2017, 21:55
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 2962 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 2962 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 2962 times


This sample replaces the background with a black one:
frames.png
frames.png (361 Bytes) Viewed 2962 times
frames_tiled.png
frames_tiled.png (1.14 KiB) Viewed 2962 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 88 times

Re: [383]Override background

Posted: 30 Nov 2017, 22:15
by mdk_813
@Lobby
Thank you! :thumbsup:

Re: [383]Override background

Posted: 01 Dec 2017, 02:01
by KINGTUT10101
Is it possible to have multiple frames for the background?

Re: [383]Override background

Posted: 01 Dec 2017, 11:10
by Lobby
no

Re: [383]Override background

Posted: 24 Dec 2017, 18:57
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!

Re: [383]Override background

Posted: 24 Dec 2017, 19:23
by CommanderABab
There it is!  :)
There it is! :)

Re: [383]Override background

Posted: 26 Dec 2017, 01:45
by Bearbear76
You can change the background
In winter by using "frames winter":[{}],
Something i discovered yesterday

Re: [383]Override background

Posted: 26 Dec 2017, 01:45
by Lobby
Yes, you can do that everywhere where you have to provide frames :)

Re: [383]Override background

Posted: 26 Dec 2017, 01:50
by Bearbear76
IMG_20171226_085022.jpg

Re: Override background

Posted: 01 Feb 2021, 13:43
by Tyteam
can someone help me i dont know how to do it i want to make it like the sea color

Re: Override background

Posted: 07 Aug 2023, 11:35
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.