Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Monsieur OUXX

#1881
CW's solution seems good and not too CPU-consuming as far as AGS goes.
#1882
Quote from: ThreeOhFour on Mon 04/08/2014 08:02:07
Nice! I'm curious to see how you implemented this

Poorly. I tried to keep it to the simplest because I had bad experiences before when I tried to do fancy things. Therefore, here, it's only done by copying the character sprite and duplicating a few vertical slices of it (by using "Crop"), then scaling them horizontally (by using the DrawImage standard parameters). But it does the trick, so I'm happy.

I didn't test it with scrolling backgrounds
, but even if I forgot some Viewport thingie somewhere, it would be easy to add into the script, because, as I said, the implementation is quite primitive and simple.

PS: for those who want to have the reflected sprites flipped as in reality, here is a tip : fiddle with variable relX (take its negative) -- it's the variable that gives the position of the character relative to the icicle. Then, go to the section of script that uses DynamicSprite.Flip() and add the relevant "if (something.Flipped)" where needed. It should take you 5 minutes.

#1883
This module was inspired by the AGS game "The Reaper" (credit goes to Grundislav and Ben304).

WHAT DOES IT DO
It's a special effect: when the player walks at some specific coordinates in the room, the module draws a copy of him (into an object of your choice), but the copy is distorted to look like it is seen through a cylindrical glass object.

THAT'S NOT CLEAR. CAN YOU SHOW ME?
Video : You can see the effect in action in any Let's Play video of "The Reaper", when the character walks behind the two glass jars in the foreground.
Demo game: dowload it below



HOW TO USE

WARNING: Absolute pre-requisite: You will see nothing if the character sprites don't have the same color depth as the object's sprite. For example, both need to be 16-bits, or both need to be 32-bits.

Note:the module assumes that your distorted character sprite will not be larger than 100x100px. If it's not the case, then change variables WIDTH and HEIGHT (capital letters) inside the script.

Note 2 :Not tested with scrolling rooms. If needed, then you should add the "Viewport.X" where relevant.

1) import the module into your AGS game
2.a) Create an object in your room where the distorted sprite will be drawn. Your object should have its own graphic (with actual pixels or fully transparent). The distorted sprite will be drawn on top of that sprite. I didn't test of the object has no graphic(sprite 0).
2.b) Create a region (e.g. Region 1) inside the room. When the player walks on it, the icicle computation will be turned on. When the player walks outside of it, the icicle computation will be turned off.
3) Keep in mind that the module uses the center of that object to calculate the player's position, relative to the icicle. For example, it uses the object's center to calculate when the player is "exactly behind" the object. That behaviour cannot be changed using the provided functions.
4) Call Icicle.NewIcicle(object, x_center, y_top, region);
   'object' is the object mentionned above
   'x_center' gives an horizontal offset (inside the object) to draw the distorted character (it doesn't have to be drawn in the middle of the object)
   'y_top' gives a vertical offset (inside the object)  to draw the distorted character (it doesn't have to be drawn in the middle of the object)
   'region' is the region on which the player should be walking for the distorted sprite to be rendered. (that allows you to disable the drawing and thus use less CPU)

5) (optional) Call Icicles.SetScale(ICICLE icicle,    float horiz,  float vertic)
    'icicle' is the ID of the icicle. It's the result of previous function 'NewIcicle'
    'horiz' and 'vertic' are the horizontal and vertical distortion ratio. You can stretch the distorted sprite horizontally and vertically to match the size of your actual icicle or jar or whatnot. For example horiz=2.0 means that the distorted sprite will be drawn at twice the width.

6) (optional) Call Icicles.SetProportions(ICICLE icicle,    int x3_width,  int x2_width,  int x1_width)
     The distorted sprite is typically rendered in 3 phases :
     - The central part is a vertical strip of the character sprite.
       It has a width equal to 'x3_width' and is stretched horizontal-
       -ly (200% -- twice the original width).
     - On each side of it, there is one vertical strip of width
       'x2_width', which just copies the original sprite without
       strecthing it.
     - On the far sides, there are 2 more vertical strips (of width
       'x1_width'). They are stretched horizontally at 50% (half the
       original width).

       |<-- x1_width (50%) --><-- x2_width (100%) --><----- x3_width (200%) -----><-- x2_width (100%) --><-- x1_width (50%)-->|

    By changing x1_width, x2_width and x3_width, you can change the proportions of which parts of the original sprite are strecthed 50%, 100% and 200%.

DOWNLOAD
>>> DEMO GAME 1.0 <<<


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


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

      //not the actual code in the module
      DynamicSprite* s sprite= DynamicSprite.CreateFromExistingSprite(something.Graphic);
      int width=s.Width;
      int height=s.Height;


Well, feel free to replace it with this, which will be much faster and memory-savy:
Code: ags

      width = Game.SpriteWidth[something.Graphic];
      height = Game.SpriteHeight[something.Graphic];

#1884
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.
#1885
I found out that, as suspected, it's the areas taken outside of the sprite that contain dirty pixels (AGS Crop function just takes values from raw memory, hence the unpredictable values).

Here is a sanitized Crop function where everything outside the original sprite produces transparent pixels (as stated, it deals only with unproper "x" and "width" values, not "y" and "height", but you can easily add those to the behaviour)

Code: ags

// Crops a sprite, but also works if the requested area is larger
// or OUTSIDE of the original sprite. The areas outside of the sprite will just be blank.
// (the original AGS "Crop" function leaves dirty pixels in the unhandled areas)
//
// IMPORTANT: This function only fixes the "x" coordinates, not the y coordinates.
//           That means it works like the standard AGS "Crop" function regarding "y".
void CleanCrop(this DynamicSprite* ,  int x,  int y ,  int w,  int h)
{
  if (x>=this.Width || x+w<0) { //if the requested area is fully outside of s
    //we force-clear s to avoid dirty pixels from the RAM
    DrawingSurface* ds = this.GetDrawingSurface();
    ds.Clear();
    ds.Release();
  } else if (x+w>=this.Width  || x < 0) { //if the requested area is partially outside of s2
    //trick : we crop s THEN enlarge it to avoid dirty pixels from the RAM
    if (x < 0) {
      this.Crop(0, 0, w-x, this.Height);
      this.ChangeCanvasSize(w, this.Height, -x, 0);
    } else { //x+w>=s.Width 
      this.Crop(x, 0,  this.Width - x, this.Height);
      this.ChangeCanvasSize(w, this.Height, 0, 0);
    }  
  } else { //the requested area is fully inside s2
    this.Crop(x, 0, w, this.Height);
  }
  
}
#1886
I'm trying to write a function that takes a subpart of a sprite, but it can be in any location within the sprite, or even outside the sprite.

For example let's say that I have this DynamicSprite "s" that is 25x25 pixels.
And I want to create a copy of a 10x10 area within that sprite, located at (x,y).
It's easy if 0<=x<15 and if 0<=y<15 : I just do s.Crop(x,y,10,10);

I've experimented to see what happens when x<0 or x>=15 or y<0 or y>=15. Apparently it works (it doesn't crash the engine) and I almost even don't have any dirty pixels in the resulting sprite (in parts that were outside the original 25x25 area). It seems to introduce RAM shit only when the cropped area is fully outside the original sprite.

So my question is : how would you sanitize this?

My current code :
(please don't pay attention to the lifespan of pointer s. I've simplified the function to present it)
Code: ags


void Crop(DynamicSprite* s, int x, int y)
{
  s.Crop(x,y,10,10);
  //for testing I draw the cropped sprite onto the background at arbitrary location (160,100)
  DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
  ds.DrawImage(160, 100, s.Graphic,  0, s.Width,  s.Height);
  ds.Release();
  s.Delete();
}
#1887
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 ;-) )
#1888
Some news:
- we still work on our special effects (e.g. this completely refactored module)
- we produced a few more backgrounds, and scripted some more.
- we have a neat 3D animation for some apparatus in the game, that we'll show when the time comes.
#1889
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.

[imgzoom]http://33.media.tumblr.com/49776a07d6c33839e4b33cb35d89266a/tumblr_n9lcs53I9P1tsfksfo1_1280.png[/imgzoom]
#1890
EDIT: I'm a dumbass.
#1891
Another thing: the shading over her left eye (the eye on the right-hand-side) is a bit like "pillow shading" as they call it : you darkened the corners alongside the black lines, instead of darkening everything that's below the eyebrow and above the cheek.
The same comment goes for the hair's shadow : it should darken the whole upper part of her forehead.
#1892
AGS Games in Production / Re: Technobabylon
Sat 05/07/2014 16:50:11
WHAT THE ?!?
How did I not see that thread earlier???
Congrats Technocrat
#1893
LostTrainDude: if you really want to use design patterns in AGS, you may try the Lua plugin.
#1894
As far as I know, it's not possible.
AGS can handle instructions being split over several lines, but not when it's inside quotes (inside of a string)

The best workaround I can think of is :

Code: ags

  String s =    "Line #1";
  s = s.Append( "Line #2");
  s = s.Append( "Line #3");
  s = s.Append( "Line #4");
  s = s.Append( "Line #5");
#1895
Critics' Lounge / Re: Phil is perplexed
Thu 03/07/2014 13:31:25
Yes, orthographic camera. That's what I meant when I said "isometric" but used the wrong word. Not a "real" perspective anyway, that's the trick.
#1896
Quote from: Crimson Wizard on Tue 01/07/2014 19:37:32
Maybe Basic could do that? I couldn't find out how, and I have no idea even today :).
I believe you could do that witht he PEEK and POKE instructions, that were never explained in beginners and intermediate books, or terribly explained, as if the authors wanted to hide the concept of pointers.
#1897
Quote from: Gurok on Tue 01/07/2014 13:55:03
I think BASIC's going to feature pretty prominently in the answers here.

Yep. My experience is a weird mix of strong emotional and artistic shocks, interleaved with Basic ;)

When I was a kid there were those Amstrad ads on TV, along with Sega ads, but it didn't make much sense to me: it was all for fun and games, and it was all the same : "TV" video games. To me it was like toys. We never had one at home, to date.

But then one day I was at the house of one of my dad's friends, and I was bored so he loaded Cryo's Dune and said "OK have fun I'll be downstairs if you have a question". HALLELUIA! I was totally blown away by this.

At the time my parents had bought a home computer (a DOS-based 286 PC), and I was playing Gorilla and Nibbles on it, which were shipped as sample programs for QBASIC. I didn't really understand why one had to first go through those screens of yellow text on dark blue background in order to play, but the fact that these were games was an incentive to bother figuring it out.

Finally, the older brother of my neighbour and best friend started programming stuff on his computer. It were really crappy programs, like Tetris clones and stuff (even a poor Yie Ar Kung Fu clone, lol). They were terrible. But it was like magic to me.


And one day,
One day!
Blessed be that day:

I was at my city's public library. And I was waiting for something (can't remember what). And I was bored. And I came across this childrens' book: "Basic with dinosaurs". It was a very simple book to teach kids Basic. With very naive drawings of colourful dinosaurs. Really, really silly. No more than 2 sentences per page, no more than 20 pages. I was way too old for that. It looked as childish as a "little miss" book. But I started reading because, as I've said, I had already seen Basic before, and I was curious of all that programming wizardry.

And it suddenly started all making sense. Like in The Matrix: abstract figures and symbols turn into reality. That stupid book made me so curious, I borrowed it from the library. I started coding stupid things like crazy : multiple-choices text-based adventures (with billions of GOTO). Then a few months later, graphic things. Along the years, it became more and more complex, and I discovered many concepts by myself, with no external help: Geometric shapes and vectorial drawing. Sprites loading. Compression. Etc.

It's only years later, only after graduating, that I decided to study computer engineering.
If it weren't for Dune, for my neighbour, and for that crazy book that I could never find again anywhere afterwards, my life would have been SO different.
#1898
Critics' Lounge / Re: corridor shading (B&W)
Mon 30/06/2014 21:10:15
Quote from: Miez on Mon 30/06/2014 20:15:27
The shadows from the central hallway on the floor seem to be too divergent. .

You're right, I don't know why I did that, I got carried away with Photoshop. ;)
By the way, you're entirely responsible for this hallway, because your drawing made us ashamed of ours.

@Anian: what makes you think that?
#1899
Critics' Lounge / corridor shading (B&W)
Mon 30/06/2014 11:21:33
Since this corridor is slightly complex, shading-wise (two windows + several artificial lights + cast shadows), I've decided not to draw directly from sketch, but instead to try a technique that I've seen a long time ago (for the Journey Down maybe, I can't remember) : First, shading in Black and white, and only then surface coloring and light tinting.

Therefore, here is the black and white model.

READ THIS BEFORE YOU COMMENT:
- No, I don't want to model it in 3D. The shading doesn't need to be perfect, once you add all the objects and textures and details the small shading imperfections don't strike the eye anymore.
- Yes, I know that the light angle of the left window is inconsistent with the light angle of the right window. But since this is a scrolling background and the two windows are quite distant (not visible on-screen at the same time), I don't think it will shock the player. Does it really, really shock you?

Tell me what you think, and if anything is shocking you.

[imgzoom]http://33.media.tumblr.com/ca003bb84b7d0427bc2e3ed613d1338b/tumblr_n7z8cuLxck1tsfksfo1_1280.png[/imgzoom]
#1900
Critics' Lounge / Re: Phil is perplexed
Mon 30/06/2014 10:59:45
My advice:
- in your final AGS game, your character can only be rendered at ONE angle (you have only one walkcycle unless you do a real 2.5D game).
- Yet, if your scene was real 3D (as seen in the animation from your 3D tool), the angle would CHANGE ever so slightly as your character moves closer to the camera.
So there is clearly a conflict between the two.

In point n click games, designers work around this by doing two things :
1) cheating with the perspective of the background. That you can already consider done: Just pretend your drawn background is slightly isometric (only the floor is visible, it helps)
2) Choose a "neutral" angle to render your character : render it as if he was perfectly facing the camera, with his feet almost flat, like the drawn guy in your background). That usually works and it hurts the player's eye less than trying to render the character with an angle matching the floor's angle and ending up overdoing it.
SMF spam blocked by CleanTalk