Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: edmundito on Sat 13/09/2014 10:41:48

Title: The next Tween Module! (Preview)
Post by: edmundito on Sat 13/09/2014 10:41:48
A module in production! I like to keep a bit of a mystery about what it's all about. You'll have to download this AGS-created trailer to see it:

http://www.losmunditos.com/downloads/ags-tween/tween_announcement.zip

I was inspired by the work Grundislav did with tweens in A Golden Wake (http://www.adventuregamestudio.co.uk/forums/index.php?topic=47710.0) to start working on the module again.
Title: Re: The next Tween Module!
Post by: Adeel on Sat 13/09/2014 11:11:13
Yay! My all time favourite module is getting quite an excellent update! :cheesy: :cheesy: :cheesy: :cheesy:

Thank you so much, Edmundito. I'm quite impressed by this trailer! Keep it up! :cheesy:
Title: Re: The next Tween Module!
Post by: Darth Mandarb on Sat 13/09/2014 13:11:10
This is the GAMES in production board. Moving to the correct board...
Title: Re: The next Tween Module!
Post by: Ghost on Sat 13/09/2014 14:37:43
Very awesome! I've been using Tween ever since its first release and will surely update (nod)

Also, bounce animations? Dibs on Dead or Alive, the first click-and-bounce adventure game :=
Title: Re: The next Tween Module!
Post by: Dualnames on Wed 17/09/2014 11:38:05
Tween module, you are still exciting as f#$^ to me!!! Most useful module in existence.
Title: Re: The next Tween Module!
Post by: miguel on Wed 17/09/2014 12:17:30
CLAP!CLAP!CLAP!CLAP!CLAP!
Great stuff, fantastic work.
Title: Re: The next Tween Module!
Post by: selmiak on Wed 17/09/2014 17:22:09
wow, this is what it's all about! Looking very promising and the trailer is really cool!
Does the module also have audiotweens now?
Title: Re: The next Tween Module!
Post by: edmundito on Thu 18/09/2014 05:25:25
Audio Tweens are available in Tween 1.5, actually, for both strict and non-strict audio scripting. I did notice that while working on 2 it was missing a TweenMusicVolume for the pre-strict sound system, so that's new in Tween 2. If you see something that's missing, feel free to suggest!
Title: Re: The next Tween Module!
Post by: edmundito on Sat 20/09/2014 20:37:22
Still need some time to come up with an official release for it (update documentation, finalize code, etc.), but the current code is fairly stable at this point; I may change some little things here and there but I'm happy where it is.

If you're brave enough, you can download the source code and export/import the module into your own game right now. Would appreciate feedback as well!
https://github.com/edmundito/ags-tween/tree/master

You will need AGS 3.3 to open the project, although the module works for any 3.x version (It did drop 2.72 support, but you always have Tween 1.5.x)
If you're distributing your game commercially you will need to include the LICENSE file somewhere in the distribution.

If you have already a game in progress with Tween 1, you can also export and import the Tween1Compatibility module which makes Tween2's changes compatible with 1's. Make sure that Tween is at the top of your modules list, followed by Tween1Compatibility for this to work.

Here's also a reference to the new easing equations. The easing in Tween 1 were very close to the Sine easings:
http://easings.net/

One of the things that is still a work in progress is creating your own Tweens.

For example, to draw the graph like in easings.net, we'll need one tweenX for linear, and a tweenY for bounce. Here's how it's implemented so far, it can get pretty messy, and I'd like to improve it:
Code (AGS) Select

Tween.IncreaseGameSpeed();

Tween myTweenX;
Tween myTweenY;
myTweenX.Init(5.0, 0, 0, System.ViewportWidth, 0);
myTweenY.Init(5.0, 0, System.ViewportHeight, 0, 0, eEaseInOutBounceTween);
int previousX = 0;
int previousY = System.ViewportHeight;

while (!myTweenX.IsFinished() || !myTweenY.IsFinished()) {
  myTweenX.Update();
  myTweenY.Update();
  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  surface.DrawingColor = 15;
  surface.DrawLine(previousX, previousY, myTweenX.X, myTweenY.Y, 2);
  previousX = myTweenX.X;
  previousY = myTweenY.Y;
  surface.Release();
  Wait(1);
}

Tween.RestoreGameSpeed();
Title: Re: The next Tween Module! (Preview)
Post by: edmundito on Sun 21/09/2014 19:20:02
And here's a preview of all easing graphs:
http://www.losmunditos.com/downloads/ags-tween/tween2_easings.zip

For really cool results you want to only change the x easing or the y easing of the tween, although sometimes combining to really intricate easings can lead you to unexpected results. You can see this in the demo.
Title: Re: The next Tween Module! (Preview)
Post by: edmundito on Sat 01/11/2014 20:15:16
Update:

Still working on it. :) There's a couple of things left todo:
- Improve how you can create custom tweens.
- Documentation.

If you can move ahead without these things, feel free to download the source from Github. It's pretty stable at this point. I would hold on if you want to use custom tweens (they're mainly for DrawingSurface and your own while loops).
Title: Re: The next Tween Module! (Preview)
Post by: Monsieur OUXX on Mon 03/11/2014 10:44:14
Quote from: Edmundito on Sat 01/11/2014 20:15:16
If you can move ahead without these things, feel free to download the source from Github. It's pretty stable at this point.

EXCELLENT.
Title: Re: The next Tween Module! (Preview)
Post by: Cogliostro on Fri 14/11/2014 20:42:51
Downloading now!

- Cogliostro
Title: Re: The next Tween Module! (Preview)
Post by: Vincent on Tue 18/11/2014 15:45:59
Edmundito, you are a incontestable legend.
I wait impatiently to be able to use this masterpiece part II.
Continue with your GREAT work.
Title: Re: The next Tween Module! (Preview)
Post by: Icey on Thu 27/11/2014 07:51:47
Good lord I need this, this is by far the top module I use in like all my games so to see this new stuff I can do with it makes oh so jolly :3
I can't wait to get my hands on this.
Title: Re: The next Tween Module! (Preview)
Post by: edmundito on Wed 14/01/2015 07:03:51
Finally got around to finalizing the custom tween support! I also added the ability to tween the character Z. Please let me know if there are other properties that need to be added to Tweening.

You can download the source from:
https://github.com/edmundito/ags-tween/tree/8b64f9c6cac31d17fb28e9fdedc9758c07ae917e
(You will have to open the project in AGS 3.3 and export the module.)

Custom Tween support: You can now create your own tween objects an apply them to more advanced code (such as drawing surfaces). For example:

Tween.IncreaseGameSpeed();

Tween myTweenX;
Tween myTweenY;
myTweenX.Init(3.0, 10, System.ViewportWidth - 10);
myTweenY.Init(3.0, 10, System.ViewportHeight - 10, eEaseOutBounceTween);
int previousX = FloatToInt(myTweenX.FromValue);
int previousY = FloatToInt(myTweenY.FromValue);

// .IsPlaying() returns true if the the tween is not finished.
while (myTweenX.IsPlaying() || myTweenY.IsPlaying()) {
  // .Update() moves the tween one step forward in time.
  myTweenX.Update();
  myTweenY.Update();

  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  surface.DrawingColor = 15;
  surface.DrawLine(previousX, previousY, myTweenX.Value, myTweenY.Value, 2);
  surface.Release();
 
  // .Value contains the current value between the FromValue and ToValue.
  previousX = myTweenX.Value;
  previousY = myTweenY.Value;
 
  Wait(1);
}

Tween.RestoreGameSpeed();


Then you can do things such as your own custom Indy Jones-like map line:

function TweenIndyMapLine(int fromX, int fromY, int toX, int toY) {
  Tween.IncreaseGameSpeed();

  Tween myTweenX;
  Tween myTweenY;
  myTweenX.Init(3.0, fromX, toX);
  myTweenY.Init(3.0, fromY, toY);
  int previousX = FloatToInt(myTweenX.FromValue);
  int previousY = FloatToInt(myTweenY.FromValue);
  int drawColor = Game.GetColorFromRGB(255, 0, 0);
 
  while (myTweenX.IsPlaying() || myTweenY.IsPlaying()) {
    myTweenX.Update();
    myTweenY.Update();
   
    DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
    surface.DrawingColor = drawColor;
    surface.DrawLine(previousX, previousY, myTweenX.Value, myTweenY.Value, 3);
    surface.Release();
   
    previousX = myTweenX.Value;
    previousY = myTweenY.Value;
   
    Wait(1);
  }
   
  Tween.RestoreGameSpeed();
}


Next Up:
- Update the documentation
- Officially release it!

If you find any bugs or suggestions, please reply to this thread.
Title: Re: The next Tween Module! (Preview)
Post by: Julius Dangerous on Fri 23/01/2015 16:00:47
Thanks! The Best Module Ever! :grin::-D