Author Topic: MODULE: Easy mirrors 2.0  (Read 11596 times)

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
MODULE: Easy mirrors 2.0
« on: 11 Jul 2013, 10:24 »
Quote
IMPORTANT NOTE :
- This module was created before late_repeatedly_execute_always was introduced
- If you replace repeatedly_execute_always with late_repeatedly_execute_always it should procude better results (no latency in character frame mirrored)




This allows you to create small mirrors in your game very quickly.

FEATURES:
- three types of symmetry: front/back (the mirror is facing you), left/right (the mirror is turned 90° from your viewpoint), none (the character is repalced with any character of your choosing, allowing upside-down symmetry of any crazy idea you have).
- you can choose the opacity of the mirror: 0.0 means it reflects perfectly. 1.0 means it doesn't reflect anything.
- Custom-shaped mirrors : just pick a sprite as a mask and your mirror can have any shape. It also uses alpha (you can have cracks in your mirrors, a soft outline, etc.).
- Attenuation: when the player moves away from the mirror, his reflection becomes less and less visible.
- Moving reflection : you can make the character's reflection move around to simulate a moving mirror (water surface, etc.)
HOW TO USE
- See the demo game and the header script. It's as simple as possible : choose an object as the mirror, another object as its symmetry center, and a region to trigger it on or off when the player walks on it.

KNOWN ISSUES
- [version 1.x only] [It's quite slow. It's meant for small mirrors. I'd say no more than 200x100 pixels reflecting simultaneously.
- [version 1.x only] There are tiny rendering bugs (sometimes the mirrored image is late one frame, or sometimes it's not aligned properly -- but the player won't really notice). Those will be fixed in next version.

- It only reflects the player character. It doesn't reflect any object or animated background or anything else. But it's easy to tweak the module and make it reflect one or several NPCs.

HISTORY
- 2013: uploaded version 1.x which work with per-pixel computation (allows shaders)
- 31 july 2014 : uploaded version 2.0 which drops the whole per-pixel thing and uses standard AGS characters as the reflection.

>>> DOWNLOAD 1.1 (obsolete, per-pixel computation) <<< (sources + compiled demo game)
>>> DOWNLOAD 2.0 (faster, more reliable) <<< (sources + compiled demo game)

Also you might like the private jokes for point-n-click lovers in the demo ;)


==================

UPDATE: You know the way you always learn new things in AGS scripts?
Well, you'll notice that my module uses the following silly technique to get sprites Width and Height :
Code: Adventure Game Studio
  1.       //not the actual code in the module
  2.       DynamicSprite* s sprite= DynamicSprite.CreateFromExistingSprite(something.Graphic);
  3.       int width=s.Width;
  4.       int height=s.Height;
  5.  

Well, feel free to replace it with this, which will be much faster and memory-savy:
Code: Adventure Game Studio
  1.       width = Game.SpriteWidth[something.Graphic];
  2.       height = Game.SpriteHeight[something.Graphic];
  3.  
« Last Edit: 16 Apr 2018, 13:07 by Monsieur OUXX »
 

Re: MODULE: Easy mirrors 1.1
« Reply #1 on: 11 Jul 2013, 11:52 »
Nice work, sounds great! :)

Re: MODULE: Easy mirrors 1.1
« Reply #2 on: 11 Jul 2013, 12:47 »
Seems like an amazing job! Not tested it yet, but I had to implement a mirror too in an AGS game and never figured out how I could make a module with it. So I'm pretty impressed by the customizable and yet user-friendly aspects of this module.

But where is the mirror on the screenshot you posted? Is it the golden stone? If so, what does it reflect?

Ghost

  • AGS Baker
  • Rottwheelers
  • Nerf on!
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: MODULE: Easy mirrors 1.1
« Reply #3 on: 12 Jul 2013, 00:12 »
But where is the mirror on the screenshot you posted? Is it the golden stone? If so, what does it reflect?
The golden nugget, a section of the icy wall and the icy ground all reflect; in the screenshot this doesn't show though- but it looks beautiful in action.

Well done, Monsieur; I never thought I'd need mirrors. Now I will put them everywhere!

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 1.1
« Reply #4 on: 12 Jul 2013, 00:13 »
But where is the mirror on the screenshot you posted? Is it the golden stone? If so, what does it reflect?

Just run the demo already! :)
There are 5 mirrors, just not on the screnshot (yes, I know, that's silly)


Well done, Monsieur; I never thought I'd need mirrors. Now I will put them everywhere!

Thanks!
 

Gribbler

  • I'm selling these fine leather jackets.
    • Gribbler worked on a game that was nominated for an AGS Award!
      Gribbler worked on a game that won an AGS Award!
Re: MODULE: Easy mirrors 1.1
« Reply #5 on: 12 Jul 2013, 23:31 »
I always avoided rooms with potential mirrors while game designing. Now I don't have to. Thanks so much!

Re: MODULE: Easy mirrors 1.1
« Reply #6 on: 13 Jul 2013, 01:00 »
That looks absolutly amazing I was gonna have to figure out how to make some mirrors for my game but wow this is awsome , I wonder if it works well with animated background or water

Adeel

  • Cavefish
Re: MODULE: Easy mirrors 1.1
« Reply #7 on: 13 Jul 2013, 10:58 »
    This is really handy, Monsieur. Played your demo. Loved the reference :D. Now I can implement it my game.
-

Re: MODULE: Easy mirrors 1.1
« Reply #8 on: 13 Jul 2013, 17:03 »
Yes that was definitely a bad screenshot if you wanted to display what this module does. I recommend changing it.

As for the demo game, that was pretty impressive. What is the scanlines.txt for, and with that question, why do you output it as a txt with raw ints instead of a binary file? That way the player is not wondering what this text file is and if they should read it.

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 1.1
« Reply #9 on: 13 Jul 2013, 17:40 »
I recommend changing the screenshot.

Updated screenshot :



What is the scanlines.txt for, and with that question, why do you output it as a txt with raw ints instead of a binary file? That way the player is not wondering what this text file is and if they should read it.

Wooops! That was meant for debugging only! Now I understand why the demo game suddenly got so slow! :D
It's just a matter of commenting out the line calling the function dumping of the text file.

I wonder if it works well with animated background or water
It's not compatible with animated backgrounds. Animated backgrounds are evil anyway! ;)
 

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 1.1
« Reply #10 on: 15 Aug 2013, 01:51 »
Bumping to remind Iceboty to move this to the modules forum.
 

Gilbert

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
    •  
Re: MODULE: Easy mirrors 1.1
« Reply #11 on: 15 Aug 2013, 02:58 »
Oh it wasn't? It is NAO.

Re: MODULE: Easy mirrors 1.1
« Reply #12 on: 02 Nov 2013, 12:27 »
The download link is broken :( Think you can fix it please? :)

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with web design
    •  
    • selmiak worked on a game that was nominated for an AGS Award!
Re: MODULE: Easy mirrors 1.1
« Reply #13 on: 02 Nov 2013, 12:49 »
maybe someone moved stuff around on the dropbox? ;)
try this link instead pls.

Re: MODULE: Easy mirrors 1.1
« Reply #14 on: 02 Nov 2013, 13:08 »
Thanks :)

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #15 on: 31 Jul 2014, 20:30 »
Uploaded version 2.0 (see first post for downloading the demo game)

Gets rid of most issues, especially it's much faster (even though less flexible) since it drops the whole per-pixel computation approach.

 

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on a game that was nominated for an AGS Award!
Re: MODULE: Easy mirrors 2.0
« Reply #16 on: 31 Jul 2014, 21:27 »
Hey! Great module! Don't currently have any mirrors planned, but it's nice to have the option. :)

BTW, how do I get to the Ice Cave? Whenever I click on the arrow that says "Go to ice cave", I just get the harbor. :(
Only changed from 3x to 2x in winsetup.
There are those who believe that life here began out there...

Ghost

  • AGS Baker
  • Rottwheelers
  • Nerf on!
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: MODULE: Easy mirrors 2.0
« Reply #17 on: 01 Aug 2014, 08:18 »
Whenever I click on the arrow that says "Go to ice cave", I just get the harbor. :(
You can debug into that room- Indy then states that it is unused and has no mirrors, so you are not missing out on anything ;)

Love the update, Monsieur! All those tiny extras are great to have (tints et al); in my opinion this should be included into the AGS download. It may not be used THAT often, but whenever someone needs a mirror the module covers it (nod)
« Last Edit: 01 Aug 2014, 08:19 by Ghost »

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #18 on: 01 Aug 2014, 14:15 »
Fixed the "to ice cave" thing and updated the download link. But as Ghost stated, there is nothing in that room, it's just there for legacy from version 1.X (it's a pretty room ;-) )
 

Mehrdad

    • I can help with animation
    •  
    • I can help with characters
    •  
    • I can help with story design
    •  
    • I can help with web design
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #19 on: 01 Aug 2014, 15:07 »
I see a little bug:

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on a game that was nominated for an AGS Award!
Re: MODULE: Easy mirrors 2.0
« Reply #20 on: 01 Aug 2014, 19:28 »
I see a little bug:

Now that you mentioned it, I noticed that one when I was moving around, but then I couldn't reproduce it, and thought that maybe it was me who saw it wrong...
There are those who believe that life here began out there...

Ghost

  • AGS Baker
  • Rottwheelers
  • Nerf on!
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: MODULE: Easy mirrors 2.0
« Reply #21 on: 01 Aug 2014, 22:06 »
I see a little bug:
Now that you mentioned it, I noticed that one when I was moving around, but then I couldn't reproduce it, and thought that maybe it was me who saw it wrong...

Could be a not-correctly-assigned view though. I set up a mirror scene in a Game-in-production, and didn't get that bug with fully assigned views. In the "ocean" scene it is stated that some views are "lazily assigned".
« Last Edit: 01 Aug 2014, 23:21 by Ghost »

AnasAbdin

  • Peace, Love and AGS
Re: MODULE: Easy mirrors 2.0
« Reply #22 on: 02 Aug 2014, 17:23 »
I see a little bug:


I don't think so. With all the dangers around.. he grew a pair of eyes in the back of his head...

I'll see my way out.

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #23 on: 03 Aug 2014, 03:13 »
Hey guys, it's not a bug*.

As explained in the demo game (when you click on Brandon to get his explanations) :

"You might notice that sometimes, the reflection does not match the character sprite. That's not because of the module. That's because our sprite artist was too lazy to draw an original sprite 0 for some loops".

In the screenshot above, all sprites 0 for loops "up,down,left and right" of view "idle" are the same. Hence the glitch! But then again it's not because of the module.

* unless proven otherwise.
« Last Edit: 03 Aug 2014, 03:15 by Monsieur OUXX »
 

Re: MODULE: Easy mirrors 2.0
« Reply #24 on: 28 Feb 2015, 13:02 »
Would it be ok to use this module in my commercial game? I dont see any licensing documentation for your module.

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #25 on: 03 Mar 2015, 10:11 »
Would it be ok to use this module in my commercial game? I dont see any licensing documentation for your module.

I believe the files headers say it's absolutely free to use.
But anyway: yes, you may use it, as long as you credit "Monsieur Ouxx and the 'Indiana Jones and the Seven Cities of Gold' contributors" somewhere in your manual or on-screen crédits.
 

Re: MODULE: Easy mirrors 2.0
« Reply #26 on: 04 Mar 2015, 21:41 »
no probs, ill make sure that i credit you and Indiana Jones and the Seven Cities of Gold' contributors in the credits and in the game readme/manual docs.

Alen101

  • Look behind you! A three-headed monkey!
Re: MODULE: Easy mirrors 2.0
« Reply #27 on: 19 Dec 2015, 22:31 »
It seems to be a cool module, but it gives me an arror in this line:
   LabelDebug.Text = String.Format("transp=%d", c.Transparency);
Any ideas of what could be happening?

Ive downloaded the zip file with the Indy game, then enter the game and export the module Mirror2.0
Then go to my game and import it, i did that because i was not able to find the .scm file.
Maybe some archive in the indy game folder i have to copy to my game folder?
???


Alen101

  • Look behind you! A three-headed monkey!
Re: MODULE: Easy mirrors 2.0
« Reply #28 on: 02 Jan 2016, 16:28 »

I keep getting this error in the mirror module, any ideas?
anything would help!

The error is in this line of the mirror2.0.asc code:
Code: Adventure Game Studio
  1. LabelDebug.Text = String.Format("transp=%d", c.Transparency);
  2.  

this is the output message:

mirror2.0.asc(461): Error (line 461): Undefined token 'LabelDebug'

Calin Leafshade

  • AGS Project Tracker Admins
  • Long live King Cat!
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • Calin Leafshade worked on a game that was nominated for an AGS Award!
      Calin Leafshade worked on a game that won an AGS Award!
Re: MODULE: Easy mirrors 2.0
« Reply #29 on: 02 Jan 2016, 16:39 »
It's trying to set a label for debugging. Presumably the module author left it in by mistake.

Just remove that line.

Alen101

  • Look behind you! A three-headed monkey!
Re: MODULE: Easy mirrors 2.0
« Reply #30 on: 02 Jan 2016, 23:16 »
Thank you!!

Re: MODULE: Easy mirrors 2.0
« Reply #31 on: 06 May 2017, 00:12 »
I have the error:

Failed to save room room1.crm; details below
guiscript.ash(145): Error (line 145): function 'Character::FaceDirection' is already defined


And in line 145, I see the following code:
Code: Adventure Game Studio
  1.     import function FaceDirection (this Character*, eDirection dir);


--- EDIT ---

Ok, I deleted FaceDirection definition from both guiscript.asc and guiscript.ash . Now it works! :]


--- EDIT 2 ---

Does someone have any idea on how to have eSymmetryHoriz that also flips horizontally the image? My character isn't horizontally symmetric.

Made my own small hack for now...

Code: Adventure Game Studio
  1. Character* c; //the reflection will be...
  2.   if (data[mir_index].c != null) { //...the mirror's own. It looks exactly like the player
  3.     c = data[mir_index].c;
  4.     if(player.View != 1){
  5.       c.ChangeView(player.View);
  6.     } else {
  7.       c.ChangeView(49);
  8.     }
  9.   }
« Last Edit: 07 May 2017, 23:14 by eri0o »

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: MODULE: Easy mirrors 2.0
« Reply #32 on: 16 Apr 2018, 13:07 »
Update : edited first post to recommend using late_repeatedly_execute_always
 

Re: MODULE: Easy mirrors 2.0
« Reply #33 on: 17 May 2018, 13:23 »
Hey OUXX :)

You stated it would be easy to mirror more characters...
What would one have to do, to make that work?