The next Tween Module! (Preview)

Started by edmundito, Sat 13/09/2014 10:41:48

Previous topic - Next topic

edmundito

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 to start working on the module again.
The Tween Module now supports AGS 3.6.0!

Adeel

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:

Darth Mandarb

This is the GAMES in production board. Moving to the correct board...

Ghost

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 :=

Dualnames

Tween module, you are still exciting as f#$^ to me!!! Most useful module in existence.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

miguel

CLAP!CLAP!CLAP!CLAP!CLAP!
Great stuff, fantastic work.
Working on a RON game!!!!!

selmiak

wow, this is what it's all about! Looking very promising and the trailer is really cool!
Does the module also have audiotweens now?

edmundito

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!
The Tween Module now supports AGS 3.6.0!

edmundito

#8
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

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();
The Tween Module now supports AGS 3.6.0!

edmundito

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.
The Tween Module now supports AGS 3.6.0!

edmundito

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).
The Tween Module now supports AGS 3.6.0!

Monsieur OUXX

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.
 

Cogliostro

"First things first, but not necessarily in that order." - Dr. Who

Vincent

Edmundito, you are a incontestable legend.
I wait impatiently to be able to use this masterpiece part II.
Continue with your GREAT work.

Icey

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.

edmundito

#15
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:
Code: ags

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:
Code: ags

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.
The Tween Module now supports AGS 3.6.0!

Julius Dangerous

___________________________________________________________

SMF spam blocked by CleanTalk