Register    Login    Forum    FAQ    PinSimDB.org

Board index » Resources » Tutorials, how-to's, bug report and docs




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Multi-Color Light Demo
 Post Posted: Thu Apr 02, 2015 5:49 am 
Offline
User avatar

Joined: Fri Sep 09, 2011 9:14 pm
Posts: 142
I made a simple Multi-Color Light Demo using my C_Array script.
I was inspired by the Space Cadet top lights system, which is very basic (well, in that case it was in bumpers), but other pinballs use a more complex version of the same system (for example Stern's Star Trek), so I hope it will be useful.

Image

My method uses multiple lights, one over the other. If you ever tried to do that, you will know their colors are additive, so the only way to make them look fine is using a totally black color for their unlit color. To solve that, I used an additional light without halo (dark gray in this case), which lits up automatically when the others are unlit.

Use T on the demo to swap between the 4 colors of the light.

Edit: Download Mutli-Color Light Demo v1.2

To use it on your table, first you have to define the LightGroup (in this case Light1) with a C_Array of strings (LightArray).

Code:
Dim LightArray : Set LightArray = New C_Array

Dim Light1 : Set Light1 = New LightGroup

LightArray.index(0) = "Light1Off"
LightArray.index(1) = "Light1Red"
LightArray.index(2) = "Light1Yellow"
LightArray.index(3) = "Light1Green"
LightArray.index(4) = "Light1Blue"

Light1.Define(LightArray)
LightArray.Clear


The first light of the list will be always the unlit light.

Methods:

Light1.BulbOff ' Set the state of the current color light to 0
Light1.BulbOn ' Set the state of the current color light to 1
Light1.BulbBlink ' Set the state of the current color light to 3

Light1.CurrentColor ' Get the current color ID. By default, 1
Light1.State ' Get the state of the current color (0, 1 or 3)
Light1.Length ' Get the number of lights defined on this group

Light1.SetBlinkInterval 100 ' Change the blink interval of every light
Light1.SetBlinkPattern "100101" ' Change the blink pattern of every light
Light1.SetCurrentColor 3 ' Change the current color

Hope you enjoy it!

[Youtube] Stern Star Trek Gameplay - Multi-Color Lights Example


Last edited by Wecoc on Sun Apr 12, 2015 11:14 am, edited 1 time in total.

Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Sun Apr 05, 2015 1:25 pm 
Offline
User avatar

Joined: Fri Sep 09, 2011 9:14 pm
Posts: 142
New version v1.1 available! (Link updated)

I created a new class (C_Timer) which works similar to the Larsboy's Timer Classes, but based on C_Array and C_Hash, so is a bit different. I believe it can be useful in many cases but I confess it's a bit chaotic. :?

In any case, that script allows to assign temporized actions to our lights, and so use FlashForMs on this system, but with some limitations.

- The timer has a "resolution" of 10 to avoid lag, so the light timings must be multiple of 10.
- C_Hash has a limit of 99 on it's current version, that means:
FlashForMs 1000, 100, BulbOff ' 1000 / 100 = 10 < 99, it works
FlashForMs 1000, 10, BulbOff ' 1000 / 10 = 100 > 99, it doesn't work
As I said on their topic, I'm planning to make a new version of C_Array and C_Hash to break the 99 limit, but lag worries me.
- Even with that, there's a bit of lag, I would deny to use FlashForMs on this type of light groups for now. The current "FlashForMs" is a set of BulbOn() and BulbOff() ordered in time. I'm almost sure using a real FlashForMs on the Current Light and a real FlashForMs delayed on the Off-Light (that's why we need the timer) would be enough. I'll try that on the next version.

Want to emphasize that this can look like there's so much complex code for a little function, but C_Array, C_Hash and C_Timer can be used in other things with no change, and also executed as external codes. So at last, it's not that complicated!

The features made on the previous version still remain exactly as before.

New methods:

Light1.FlashForMs 1000, 100, Light1.State ' Applies FlashForMs to the current light

I'll make another version soon. Suggestions are welcome.
((For now nobody has shown signs of interest :|))


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Sun Apr 05, 2015 2:08 pm 
Offline

Joined: Mon Jan 27, 2014 12:36 pm
Posts: 2859
Location: Ontario, Canada
Quote:
I'll make another version soon. Suggestions are welcome.
((For now nobody has shown signs of interest ))


Thanks Wecoc for the models and templates
you are doing

They are excellent resources !

It gives hackers like myself a fighting
chance :)


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Sun Apr 05, 2015 3:26 pm 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 415
Location: Abbotsford
Thanks, it's something useful that I am sure people could use, like me. The only problem would be the object limit, but multicolored lights would be a nice effect

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: fpxEngine


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Sun Apr 05, 2015 4:37 pm 
Offline
User avatar

Joined: Sun May 08, 2011 4:57 pm
Posts: 1071
Location: Turin-ITALY
Thank you for this work on the lights multicolor
Gianfranco


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Sun Apr 05, 2015 8:08 pm 
Offline
User avatar

Joined: Mon Feb 27, 2012 10:39 am
Posts: 1908
Isn't that easier to simply use an overlay with an image sequence to achieve the same effect?

_________________
add me to SKYPE : steve.paradis49


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Mon Apr 06, 2015 12:17 am 
Offline
User avatar

Joined: Fri Sep 09, 2011 9:14 pm
Posts: 142
Gimli & franzleo: Thanks buddies :D

Blue: Sure it's a problem, but we are not talking about all the lights of the table. Also, there are limit breakers, I have seen pinballs with over 800 objects. The problem here is lag, but I'm trying to minimize it.

HappyCab: It's easier with Overlays, but the effect is not exactly the same. Also, with Overlays you can't use Light methods (BulbBlink, FlashForMs... or join it to light sequencers). And you can't do a multi-color light directly with a Light Image object.

I believe this way is better, you still use lights, with their halo, and even don't need image (I always loved the default light image, lol)

With this you have to define the light group in the start of the code, but after that it's nearly "plug & play", because the methods are practically the same you can use on a light.

--------

I will not implement Light Sequencing on the script but you still can use it, you have to define a LightList for every color, and play it depending on Light1.CurrentColor. And also play the same effect but "Off" on the Off-Light. It's a bit of extra work but it's easier than trying to script that.

Anyway, you would have to define all this LightLists in any case, because this lights have virtually the same coords, and the Light Sequencer has a restriction of 1 light per cell.

So the only missing thing is the FlashForMs fix. I will also make a simple method to redefine the Off-Light, in case you want to BulbBlink between 2 colors or this type of things.

Other suggestions are welcome.


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Mon Apr 06, 2015 3:41 am 
Offline

Joined: Tue May 01, 2012 11:13 pm
Posts: 415
Location: Abbotsford
I stick to the 800 limit to prevent all those people from complaining the game doesn't work if they use stock FP, and are incapable of reading that they would need a different exe.

As to your comments about images vs lights, you can put a halo around a image, just use a unrendered bulb, like I did with Playboy. It actually brightens the lights (Light object is pretty dark) and if you can tie in the overlays to the unrendered bulb, you would get the best of both worlds with lightsync. Just a thought really, though not sure how to do that. VP does have it's advantages, FP is so rigid and inflexible with a lot of things.

Multicolored (color changer) lights though... hmm

_________________
_____________________________________

Latest projects and rants at My Facebook Page
_____________________________________

Latest Project: fpxEngine


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Mon Apr 06, 2015 5:04 am 
Offline
User avatar

Joined: Mon Feb 27, 2012 10:39 am
Posts: 1908
Exactly blue, and on multiple occasions I have uses hologram to enhance the halo of said lights.This being said, your method is one more tool to achieve a certain effect, so thank you for that. :)

_________________
add me to SKYPE : steve.paradis49


Top 
 Profile  
 
 Post subject: Re: Multi-Color Light Demo
 Post Posted: Mon Apr 06, 2015 7:15 am 
Offline
User avatar

Joined: Fri Sep 09, 2011 9:14 pm
Posts: 142
Blue: Light halos and bulb halos look a bit different, somehow... I confess it was my first idea to make these, indeed. But when I tried, I was a little disappointed..
Also, using a bulb for each color halo doesn't solve the object limit problem, you still using the same number of objects :?

HappyCab: I didn't thought about using holograms to replace halos. Wow, HappyCab you still thinking out the box! :D
I still finding it a bit difficult to work with, if you want to set on that light a blinking effect, or a light list. But I like it, you have a bunch of possibilities to play with that.

At all events we have different methods with their pros and cons, so it's great we can choice depending on the situation.

Wecoc wrote:
I will also make a simple method to redefine the Off-Light, (...)

Done!

Blue wrote:
Multicolored (color changer) lights though... hmm

Stern uses them. And Stern is my bible. :mrgreen:


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

Board index » Resources » Tutorials, how-to's, bug report and docs


Who is online

Users browsing this forum: No registered users and 5 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to: