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

Topics - Monsieur OUXX

#181
Hi people,

I don't know if it's generally accepted that the engine should succeed with loading only files that have the same colors-depth as the current game. But just in case. Here is a small test to reproduce the issue :

1. Open MS Paint, create some random drawing.
2. Save it as a 24-bits BMP (name it "bmp24.bmp", for example). Save it again as a 256-colors BMP (name it "bmp8.bmp").
3. CReate a 32-bits game in AGS. Put the BMP files in its "compiled" folder.
4. Go to the "room after fade-in" script and add this :

Code: ags

  DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
  DynamicSprite* s = DynamicSprite.CreateFromFile("bmp8.bmp"); //...or bmp24.bmp, as you wish.
  ds.DrawImage(0, 0,  s.Graphic);
  ds.Release();


You'll see that the images are unproperly rendered.
Just sayin'. (it's not vital, but it would have saved me some trouble with a module I'm currently writing, that reads and writes 8-bits BMP files, to work with the AGS feature that loads walkbehinds/Walkareas/etc. masks from 8-bits files)


EDIT: Forget it. Every time I get pawned by the same old trick: The game was 32-bits, but the 9-verb template's sample background was still 16-bits. Hence the issues. After I exported it and re-imported it, effectively turning it into a 32-bits background, everything went fine.
That said, the "DrawImage" function might want to throw an error when the source and target sprites don't have the same color depth. OR The Editor might want to throw warnings for every sprite in the game that doesn't have the same color depth as the game itself.

#182
Apprently, after all these years, I still have issues managing non-blocking events.
In the code below, why does "player" walk THEN r walks??? (and player says "wut?" at the same time as r starts walking)  Shouldn't they be walking simultaneously?


Code: ags

    //"WaitSeconds" is a conveninent function from the Tween module but I could as well do "Wait(200);"

    // Note: this code is triggered by an Interaction event on "r".
    r.SetWalkSpeed(r.WalkSpeedX*3, r.WalkSpeedY);
    Wait(1);
    player.Walk(player.x - 100, player.y, eNoBlock);
    r.Walk(r.x - 200, r.y, eNoBlock);
    WaitSeconds(2.0); 
    player.Say("wut?");
#183
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];

#184
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();
}
#185
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]
#186
Who's up to try reproducing that kind of algorithm in AGS with me? Even a simplified version of it would be deadly. Imagine your player carrying a torch around!!!!11!!!!

https://www.kickstarter.com/projects/finnmorgan/sprite-lamp-dynamic-lighting-for-2d-art
#187
[AGS 3.3.0]
I'm struggling with a paradigm that doesn't seem to have a straightforward solution in AGS.

- I have a sprite s1 (it has some transparent pixels, i.e. a custom shape).
- I have another sprite s2 that also has alpha: I use only for its shape.

I want s1 to be "recut" with the shape of s2: Its transparent bits should remain transparent, but the non-transparent bits should become transparent if s2 is transparent in that location. (s2 would be some sort of transparency mask for s1).

I thought I was a smart guy by doing CopyTransparencyMask of s2 over s1... what I didn't anticipate, though, is that the alpha channels are not additive -- that means everything transparent in s2 becomes transparent in s1, and that's cool,  BUT everything that was transparent in s1 becomes pink. Dang.

Is there a simple way to do that? Or am I doomed to process the sprites pixel by pixel??? I've scripted that solution already but I don't reach sufficent performance rates.


#188
[AGS 3.3.0 stable]

I just started a mockup game from the VerbCoin template, and changed its resolution to suit my needs (I don't think it's the cause of the issue but I'd rather mention it).
- when the character is not walking, he's at normal size.
- When the character is walking, the walk cycle gets scaled up (x2). That shouldn't happen!

To be sure that wasn't caused by the initial resolution change  (I know it's rarely a good idea to do that after importing some assets), I created a brand new room, re-imported all sprites, recreated the walk view.
But the issue is still there. I suspect it's caused by some general setting, but I wouldn't know which one.
#189
I'm using the stable build of 3.3.0 : Build 3.3.0.1156

The following scenario is extremely easy to reproduce.

1) Create a 32-bit game
2) import a sprite with alpha into it
3) in your room's or module's repeatedly[_execute_always], put the following code :

Code: ags

  int MYSPRITE = 6; //whatever sprite slot was given for the sprite.
                    //We assume the sprite is larger than 20x20
  DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
  ds.DrawImage(0, 0, MYSPRITE , 0, 20, 20);
  ds.Release();



PROBLEM 1: The game crashes with following error:

An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00000000 ; program pointer is +1004, ACI version 3.3.0.1156, gtags (6,37)

This is fixed by using "DrawImage" with a transparency of 1 instead of 0. That's a lame hack but it works.

PROBLEM 2: Corrupted sprite drawn

Even after the hack described above, no image gets drawn. Just a pattern of vertical stripes. That drawing has the expected size (20x20 in the example above).


Please note that I tried in both DX5 and D3D9. But I have an old notebook running XP, with an integrated chipset, so I'm not sure how much is hardware-accelerated and how much is software in the process. Anyway it looks like a wrong pointer gets involved in the process, inside the Engine.



SOLUTION: your room must have a background set in the editor. If there's no background, AGS doesn't create an image for it, neither a surface, therefore any attempt to draw onto that surface creates unexpected issues.
#190
Here's the repeatedly_execute function of a module :

Code: ags


Character* charPool[NPC_MAXCHAR]; //some code somewhere else puts Characters there

function repeatedly_execute()
{
  int i=0;
  while (i<NPC_MAXCHAR) { //we iterate through all possible NPC's

        if (!charPool[i].Moving) { //only if the character has stopped walking
        
            int x = Random(320); int y = Random(200);
            charPool[i].Walk(x, y, eNoBlock, eWalkableAreas); //THIS LINE IS CALLED AT EVERY GAME CYCLE!!!
          
        }
        i++;
    
  }
}


It turns out the line commente "//THIS LINE..." is called at every game cycle. A walk action keeps being initiated. I don't understand why : Character.Moving should be false as soon as the character starts walking?!?
#191





FEATURES:
- the lamest Dennis sprites to-date
- Dennis finally meets his mom
- a very bad impersonation of the Angry German kid
- FMV! (Full Motion Video, for those born after the 90's. Yes, I'm talking about you. Shame on you.)
- Lots and lots of DLC's
- Lots and lots of hairgel
- A big sword... and the possibility to use it to cut stuff!
- no J-RPG fight at all (or your money back)
- ALL CHARACTERS HAVE RECORDED VOICES! ...But not the way you imagine ;)

I NEED A MUSICIAN! I'm doing the whole game by myself but I just can't make music ;-D One or two silly tunes in the style of Goblins 3 would be awesome, deadly, and utterly exhilerating.
#192
I can't figure out how to change the font that AGS uses to display the dialog options. Even with a custom GUI. Is it even possible?
#193
I've got this at program startup.
I tried to put a breakpoint in function game_start even before anything else, but it still occurs.
I don't know why it happens. Could it be a missing resource? If yes, of which type?


An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x004852BB ; program pointer is -7, ACI version 3.3.0.1156, gtags (0,1)
#194
Hi everyone,

At the moment we have a few cool particle engines around (akumayo's particles engine, the weather module, snowRain module, etc.).
But all of these were created before AGS got really up-to-speed with alpha blending. Unless I'm mistaken, none of them handles alpha (only full transparency).

If one of you skilled gentlemen decided to look into it, I and others would be eternally grateful.
#195
I just found that while lurking on the Interwebz : https://www.kickstarter.com/projects/cyaninc/obduction
They have $1,300,000 out of 1,100,000 requested.
#196
Could someone either direct me to a place where it's explained how the new sound system works (not in terms of scripting or channels, but in terms of concepts: 1. sounds types: music, ambient, etc. 2. volume management) ,..or briefly walk me through it?

I've never been very familiar with the old system either. I just new how to play a music, or a sound, and repeat them, but I never knew how to control the volumes of sound and music separately, etc.
#197
I have this gui. It's "normal, initially on" (not modal). Inside of it there's a listbox.
When I click on the listbox, the selection doesn't change.

Since I have a shitload of scripts managing gui events, I fail to see what could be "intecepting" the clicks:
- i don't have an on_event
- I don't have a function bound to "on selection change", but by AGS design the graphical gui should still react to the click by changing the selection
- the game is paused, but I've tested AGS' behaviour and it normally doesn't prevent listboxes from reacting to clicks.
- there is no other gui on top of it
- I test mouse.IsButtonDown in repeatedly_execute_always for other reasons, but I doubt that would "consume" the click?


PS (unrelated) : ProcessClick is only for simulating a click in a game scene, not on a gui, right?
#198
I had my game working fine.
Then I decided to tidy up my gazillion Editor folders and started moving assets around inside the game Editor: subfolders, etc.
Now I run my game and I get this : "script link failed: runtime error: unresolved import 'cMainCharacter'.

cMainCharacter is my main character in the game. It's character 0. It's still here, I can open it and view it.
Moreover, I believe character aliases are global (by AGS design). So I fail to see how it could not be imported somewhere.

Could AGS be complaining that this character is unknown to a specific script? Or is it complaining that the character doesn't exist altogether? I hope I didn't corrupt my game.


#199
Hello,

I'm planning on using the new "Replace sprite(s() from source" feature, but I'm wondering: how is the path to the original files stored? Is it an absolute path, or is it relative to the game file's directory?

<crossing fingers for it to be relative>
#200
Hello everyone.

I'm using 3.3.0, and I put some of my (many) scripts in folder, to tidy up my project.

My two questions :
- I can only see how to create folders at the top of the scripts list - that is: in first position of a folder or subfolder. I can't seem to find how to create, let's say, the folder at the end of the scripts lists, after some individual scripts. Is it possible?
- Dependencies: does the dependencies order still rely on the order of the scripts in the list (if all the folders were flattened)?
SMF spam blocked by CleanTalk