Road decoration

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
Lobby
Developer
Reactions:
Posts: 3377
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Road decoration

#1

Post by Lobby » Mon May 14, 2018 16:21

Since 475 there is a new type of object in the game: Road decorations.
Those are basically road alignment aware frames that can be attached on top of any road, similar to animations that are defined directly by a road.

How it may look like :img
Screenshot_20180514-154312.png
This one is simple for the purpose of demonstration. I'm confident that you can come up with something that is way better.

The frame we want to use as decoration :img
frames.png
frames.png (535 Bytes) Viewed 4546 times
The usage is supposed to follow this scheme :teach
frames_usage.png
frames_usage.png (3.94 KiB) Viewed 4546 times
The basic structure of road decorations is to define all the needed frames as animation obejcts which can then be referenced in the road decoration object. So here they may look like :json

Code: Select all

{"id":"$anim_roaddeco_sample00_00","type":"animation","frames":[{"bmp":"frames.png","x":0,"w":32,"handle y":8}]},
{"id":"$anim_roaddeco_sample00_01","type":"animation","frames":[{"bmp":"frames.png","x":32,"w":32,"handle y":8}]},
{"id":"$anim_roaddeco_sample00_02","type":"animation","frames":[{"bmp":"frames.png","x":64,"w":32,"handle y":8}]},
{"id":"$anim_roaddeco_sample00_03","type":"animation","frames":[{"bmp":"frames.png","x":96,"w":32,"handle y":8}]}
⚠Although we're talking about animation objects they aren't animated here because each animation has only one frame.

So now we have 4 animation objects that hold our frames that we want to put on top of roads. The basic road decoration structure looks like :json

Code: Select all

{
  "id":"$roaddeco_sample00",
  "type":"road decoration",
  "title":"Sample deco",
  "text":"I am a road decoration.",
  "price":100,
  ...
}
For drawing frames 1 and 3 should be used in the foreground while frames 0 and 2 should be drawn behind cars. We can say so by using animation and animation fg respectively in the road decoration object :json

Code: Select all

"animation":[
  {"id":"$anim_roaddeco_sample00_00"},
  {"id":"$anim_roaddeco_sample00_02"}
],
"animation fg":[
  {"id":"$anim_roaddeco_sample00_01"},
  {"id":"$anim_roaddeco_sample00_03"}
]
The last part is the most important one: We have to tell the game when to show which animation object. By default, all animations are drawn for every frame (so we don't use frame/alignment awareness yet). Normal roads have 16 frames (as defined here), so we have to tell for each frame manually which of the provided animation obejects to use. That can be done by populating the arrays frame animation indices and frame animation fg indices with 16 sub arrays. Each of these sub arrays contains a list of the corresponding animation objects that should be used (indexed by 0 and 1 as we have only two animations for animation and animation fg) :json

Code: Select all

"frame animation indices":[
  [0,1],[0,1],[1],[1],
  [0],[0],[],[],
  [0,1],[0,1],[1],[1],
  [0],[0],[],[]
],
"frame animation fg indices":[
  [0,1],[0],[0,1],[0],
  [0,1],[0],[0,1],[0],
  [1],[],[1],[],
  [1],[],[1],[]
]
Dependent on your project your can just reuse this code and don't have to worry about the meaning.

Here you can get the whole plugin:
roaddeco_sample.zip
(58.31 KiB) Downloaded 97 times
Road decoration objects also support the basic fun attributes fun, on click fun and random fun.

Since 476: The attribute "speed" can be used to apply a speed multiplier to the underlaying road. Default value is 1.0

:66:
New attributes are
Show
required flag *
You can now use road flags to specify on which roads the decoration should be buildable. The default is

Code: Select all

"required flag normal":true
which means that it can only be built on regular roads.

E.g. use

Code: Select all

"required flag normal":false,
"required flag train":true
to define a decoration that can only be placed on rails.
See this thread for more information about flags.
Show
min dirs
This is basically a filter to limit where the decoration can be built. It states the minimum required amount of connected neighboring roads that's required for the decoration to be built.
For example:

Code: Select all

"min dirs":1
would mean that the decoration cannot be built on roads that aren't connected to any other roads. The default value is 0 meaning that no lower limit is given.
Show
max dirs
Works like min dir but specifies an upper limit of to how many neighboring roads the targeted road has to be connected.
Example:

Code: Select all

"max dirs":2
would mean that the decoration cannot be built on roads with 3 or 4 neighbors. This effectively excludes all kinds of crossings (T crossings have 3 neighbors, X crossings have 4). The default value is 4 meaning that no upper limit is given.
Show
symmetric dirs
This is another filter for road decoration placement. If set to true the road has to be connected to neighboring roads in a symmetric way. This is only the case for not connected roads, a line of road and X crossings.
For example:

Code: Select all

"min dirs":2,
"max dirs":2,
"symmetric dirs":true
only allows the road decoration to be built on a line of road without crossings (using the "min dirs" and "max dirs" attributes to filter out other symmetric cases).
Show
line tool
By default road decorations are built per road tile, now. However, you can enable the line tool by using

Code: Select all

"line tool":true
...Have a nice stay

User avatar
Artem_123
Townsman
Reactions:
Posts: 63
Joined: Sun Apr 22, 2018 15:51
Plugins: Show
Version: Beta
Phone model: 89521124584

Platform

Re: Road decoration

#2

Post by Artem_123 » Mon May 14, 2018 17:47

(((:
Aga ugu my site created today https://theoplugins.simdif.com me russian phone!!!!!! :bd

User avatar
CommanderABab
AB
Reactions:
Posts: 7913
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#3

Post by CommanderABab » Mon May 14, 2018 19:23

:)
777!777Currently using alpha 777. 777 What's new? :)
online maps!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
khadafi laidi
Inhabitant of a Planet
Reactions:
Posts: 1303
Joined: Fri Dec 16, 2016 13:11
Location: Ternate, Indonesia
Plugins: Show
Version: Beta
Phone model: Xiaomi note A5

Platform

Re: Road decoration

#4

Post by khadafi laidi » Tue May 15, 2018 2:44

Lots of mathematical formulas
Fact about me:
-President of FINDONEZIA
-Im rarely active right now
-Subscribe my channel:
https://www.youtube.com/channel/UCWS1fz ... 4syaxcA74A

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

Plugin Creator

Platform

Re: Road decoration

#5

Post by yusuf8a684 » Fri May 25, 2018 16:30

Woah thats beatufull but hard

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1605
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone model: Vivo V7
Contact:

Platform

Plugin Creator

Re: Road decoration

#6

Post by -LeoLeo- » Wed May 30, 2018 10:54

Excuse me, but how do you make animation fg go under vehicles???

Like the crosswalks and the bumps??
• I'm one with the Lombaxes •

Have you ever seen anybody be so excited about new icons for transit!??!?!!!?❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
CommanderABab
AB
Reactions:
Posts: 7913
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#7

Post by CommanderABab » Wed May 30, 2018 20:27

-LeoLeo- wrote:
Wed May 30, 2018 10:54
Excuse me, but how do you make animation fg go under vehicles???

Like the crosswalks and the bumps??
You don't use it. :)

You would use

Code: Select all

"animation indices" 
for that.
777!777Currently using alpha 777. 777 What's new? :)
online maps!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
danekbel
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2774
Joined: Thu May 05, 2016 9:33
Location: in your dreams
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#8

Post by danekbel » Sun Jun 03, 2018 23:59

can i make a road change its flag with the deco?
for example, can i write in deco's json "flag bus:false" and the road on which would be this deco placed would be able to pass buses through itself?
some text.

User avatar
danekbel
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2774
Joined: Thu May 05, 2016 9:33
Location: in your dreams
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#9

Post by danekbel » Mon Jun 04, 2018 15:25

some text.

User avatar
danekbel
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2774
Joined: Thu May 05, 2016 9:33
Location: in your dreams
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#10

Post by danekbel » Wed Jun 06, 2018 8:03

OK, if it's not supported, is there a possibility to add it into a game? @Lobby
some text.

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1605
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone model: Vivo V7
Contact:

Platform

Plugin Creator

Re: Road decoration

#11

Post by -LeoLeo- » Thu Jun 07, 2018 2:57

danékbel wrote:
Wed Jun 06, 2018 8:03
OK, if it's not supported, is there a possibility to add it into a game? @Lobby
He's probably busy...(?)
Last edited by -LeoLeo- on Thu Jun 07, 2018 6:30, edited 1 time in total.
• I'm one with the Lombaxes •

Have you ever seen anybody be so excited about new icons for transit!??!?!!!?❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
CommanderABab
AB
Reactions:
Posts: 7913
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#12

Post by CommanderABab » Thu Jun 07, 2018 3:43

Using the fun from the road decoration, you could build a different road that would allow the busses in the same spot.
777!777Currently using alpha 777. 777 What's new? :)
online maps!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

User avatar
Ølsken
Former Bearbear65
Reactions:
Posts: 4782
Joined: Fri Feb 10, 2017 14:53
Plugins: Show
Version: Beta
Phone model: Samsung S10

Platform

Plugin Creator

Re: Road decoration

#13

Post by Ølsken » Sat Jun 09, 2018 11:24

Just if you wanted to know the difference between animation & animation fg.
In animation the cars will overlay the frame. Simply think that it will be behind the cars like a background.
On the other hand animation fg is the opposite of animation, it will be in front of the car.
So the frame will overlay the cars.


Correct me if I'm wrong with any of this information. :json
ImageJust my opinion

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

Platform

Plugin Creator

Re: Road decoration

#14

Post by KINGTUT10101 » Sat Jun 09, 2018 19:46

Would it be possible to spawn vehicles using these decorations?

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

Plugin Creator

Platform

Re: Road decoration

#15

Post by yusuf8a684 » Sat Jun 09, 2018 19:49

KINGTUT10101 wrote:
Sat Jun 09, 2018 19:46
Would it be possible to spawn vehicles using these decorations?
I hope.it is possible

User avatar
Pounkiller
Inhabitant of a Megalopolis
Reactions:
Posts: 601
Joined: Mon Jan 15, 2018 15:53
Location: Turkey
Plugins: Show
Phone model: Huawei Mate 10 Lite

Platform

Re: Road decoration

#16

Post by Pounkiller » Sun Jun 10, 2018 9:05

Mann,these are so complicated.
¡Probably not actively sustaining following the forum nor its alternative side-platforms!
≈Out of Place, Out of Time≈

User avatar
CommanderABab
AB
Reactions:
Posts: 7913
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#17

Post by CommanderABab » Sun Jun 10, 2018 17:32

KINGTUT10101 wrote:
Sat Jun 09, 2018 19:46
Would it be possible to spawn vehicles using these decorations?
No, or not yet. You choose. It doesn't really make sense for a road to spawn vehicles.
777!777Currently using alpha 777. 777 What's new? :)
online maps!!
:)

Telegram - t.me/
🆎️🆎️🆎️🆎️Commander🆎️🆎️

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

Platform

Plugin Creator

Re: Road decoration

#18

Post by KINGTUT10101 » Sun Jun 10, 2018 18:29

There's a lot of things in this game that don't make sense...

User avatar
-LeoLeo-
Inhabitant of a Solar System
Reactions:
Posts: 1605
Joined: Sat Jul 08, 2017 12:46
Location: Planet Fastoon, Polaris Galaxy // Th
Plugins: Show
Version: Beta
Phone model: Vivo V7
Contact:

Platform

Plugin Creator

Re: Road decoration

#19

Post by -LeoLeo- » Sun Aug 05, 2018 10:38

Excuse me, @Lobby.
I know tagging is very annoying, sorry.

The new updates added the "Traffic lights crossing" and they actually stop cars!

I mean.... How did you code that????
Can i have some documentation on that?

Also, the ability to place decorations on a 4-way intersections (crosswalks) and the texture changed completely, is beyond me... Can you also tell me about that?
• I'm one with the Lombaxes •

Have you ever seen anybody be so excited about new icons for transit!??!?!!!?❤️ |ℹ️|
¤ The P.M. of Attobaxia.
¤ The CEO of Leopolis Corp.
¤ Love Ratchet&Clank

;) :space

User avatar
Lobby
Developer
Reactions:
Posts: 3377
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Road decoration

#20

Post by Lobby » Sun Aug 05, 2018 11:31

Maybe the code can help you :json

Code: Select all

  {"id":"$anim_roaddeco_trafficlights00_00","type":"animation","frames":[{"x":0,"y":469,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights00_01","type":"animation","frames":[{"x":32,"y":469,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights00_02","type":"animation","frames":[{"x":64,"y":469,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights00_03","type":"animation","frames":[{"x":92,"y":469,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {
    "id":"$roaddeco_trafficlights00",
    "type":"road decoration",
    "price":100,
    "animation":[
      {"id":"$anim_roaddeco_trafficlights00_00"},
      {"id":"$anim_roaddeco_trafficlights00_02"}
    ],
    "frame animation indices":[
      [0,1],[0,1],[1],[1],
      [0],[0],[],[],
      [0,1],[0,1],[1],[1],
      [0],[0],[],[]
    ],
    "animation fg":[
      {"id":"$anim_roaddeco_trafficlights00_01"},
      {"id":"$anim_roaddeco_trafficlights00_03"}
    ],
    "frame animation fg indices":[
      [0,1],[0],[0,1],[0],
      [0,1],[0],[0,1],[0],
      [1],[],[1],[],
      [1],[],[1],[]
    ],
    "fun":{
      "condition":"day%10>=8",
      "action":{"type":"build","id":"$roaddeco_trafficlights01"}
    }
  },

  {"id":"$anim_roaddeco_trafficlights01_00","type":"animation","frames":[{"x":0,"y":368,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights01_01","type":"animation","frames":[{"x":32,"y":368,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights01_02","type":"animation","frames":[{"x":64,"y":368,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {"id":"$anim_roaddeco_trafficlights01_03","type":"animation","frames":[{"x":92,"y":368,"w":32,"h":16,"handle y":8,"offset y":3072}]},
  {
    "hidden":true,
    "id":"$roaddeco_trafficlights01",
    "type":"road decoration",
    "title id":"draft_roaddeco_trafficlights00_title",
    "text id":"draft_roaddeco_trafficlights00_text",
    "price":100,
    "enter speed":0,
    "animation":[
      {"id":"$anim_roaddeco_trafficlights01_00"},
      {"id":"$anim_roaddeco_trafficlights01_02"}
    ],
    "frame animation indices":[
      [0,1],[0,1],[1],[1],
      [0],[0],[],[],
      [0,1],[0,1],[1],[1],
      [0],[0],[],[]
    ],
    "animation fg":[
      {"id":"$anim_roaddeco_trafficlights01_01"},
      {"id":"$anim_roaddeco_trafficlights01_03"}
    ],
    "frame animation fg indices":[
      [0,1],[0],[0,1],[0],
      [0,1],[0],[0,1],[0],
      [1],[],[1],[],
      [1],[],[1],[]
    ],
    "fun":{
      "condition":"day%10<8",
      "action":{"type":"build","id":"$roaddeco_trafficlights00"}
    }
  }
There are actually two decorations that use different frames. One of them stops incoming cars by using "enter speed":0. They replace themself with the other variant at specific days (namely when the remainder of absolute day divided by 10 is <8 or >=8).
...Have a nice stay

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”