Author Topic: How to optimize wheel spin for game station theme  (Read 4868 times)

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
How to optimize wheel spin for game station theme
« on: March 01, 2016, 06:07:30 PM »
Hi,

I would like to speed up game station theme. The current script is original running num_arts = 10. How to update as below script to work on "exactly" num_arts = 5 instead of 10? I think it is effect the performace. Thanks.


My ideal code should be :
 
 local wheel_x = [ flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822,]; 
 local wheel_y = [ 0, fly*-0.08, fly*0.152,, fly*0.384, fly*0.616 ];
 local wheel_w = [ flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, ];
 local wheel_a = [ 205,  205,  255,  205,  205,];
 local wheel_h = [ flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23, ];
 local wheel_r = [ 0, 0, 0, 0, 0, ];
 local num_arts = 5;


Code: [Select]
{
 fe.load_module( "conveyor" );
 local wheel_x = [ flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, flx*0.822, ]; 
 local wheel_y = [ 0, fly*-0.08, 0, fly*0.152, 0, fly*0.384, 0, fly*0.616, 0, fly*0.848, 0, 0, ];
 local wheel_w = [ flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, flw*0.179, ];
 local wheel_a = [ 0,  205,  0,  205,  0,  255, 0,  205,  0,  205, 0,  0, ];
 local wheel_h = [ flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23, flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23,  flh*0.23, ];
 local wheel_r = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ];
 local num_arts = 5;

class WheelEntry extends ConveyorSlot
{
constructor()
{
base.constructor( ::fe.add_artwork( my_config["orbit_art"] ) );
}

function on_progress( progress, var )
{
local p = progress / 0.1;
local slot = p.tointeger();
p -= slot;
slot++;

if ( slot < 0 ) slot=0;
if ( slot >= 10 ) slot=10;

m_obj.x = wheel_x[slot] + p * ( wheel_x[slot+1] - wheel_x[slot] );
m_obj.y = wheel_y[slot] + p * ( wheel_y[slot+1] - wheel_y[slot] );
m_obj.width = wheel_w[slot] + p * ( wheel_w[slot+1] - wheel_w[slot] );
m_obj.height = wheel_h[slot] + p * ( wheel_h[slot+1] - wheel_h[slot] );
m_obj.rotation = wheel_r[slot] + p * ( wheel_r[slot+1] - wheel_r[slot] );
m_obj.alpha = wheel_a[slot] + p * ( wheel_a[slot+1] - wheel_a[slot] );
m_obj.video_flags = Vid.NoAudio;
}
};

 local wheel_entries = [];
 for ( local i=0; i<num_arts/2; i++ )
wheel_entries.push( WheelEntry() );

 local remaining = num_arts - wheel_entries.len();


// we do it this way so that the last wheelentry created is the middle one showing the current
// selection (putting it at the top of the draw order)
 for ( local i=0; i<remaining; i++ )
wheel_entries.insert( num_arts/2, WheelEntry() );
« Last Edit: March 01, 2016, 06:11:49 PM by kent79 »

omegaman

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 880
    • View Profile
Re: How to optimize wheel spin for game station theme
« Reply #1 on: March 01, 2016, 07:50:30 PM »
Kent-

You, can also try tweaking the wheel speed a little bit. Regardless, whether it's 5 or 12, you are still going through the draw list. It might make a small improvement but probably not that noticeable.  Anyway, I think you had things working pretty good with the update.

I think I've tried what you are asking about but with 7 arts. And, it really didn't make that much of a difference.