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

#1481
General Discussion / Re: This is frustrating
Fri 17/04/2015 09:27:55
Quote from: Crimson Wizard on Thu 16/04/2015 19:35:43
I've beaten two first bosses after enabling "controlling mouse with keyboard" in Windows and using numpad 5 key instead of left click.

Yes, we've reached the point where we actually share aimbots tricks for flappy bird clones.
#1482
The solution(s) with the negative coordinates works very well. The thing with AGS built-in functions is that I never know which ones have cropping-checking or which ones will throw exceptions with the wrong coordinates.

#1483
I wanna know what's under that sheet!
#1484
For the record here is the implementation using the tiles :
(I still have no idea why it's so slow)
Code: ags


DynamicSprite* bits_array[]; //because of AGS low performance, we'll actually save the background as an array of tiles.
struct BgBits {
  //DynamicSprite* bits_array[];  //this array cannot be placed here because of AGS language limitations 
  int bits_w;
  int bits_h;
  
  int nbBits_horiz; //how many tiles columns
  int nbBits_vertic; //how many tiles rows.  
                    // nbBits_horiz*nbBits_vertic give the total number of tiles making up the background
};
BgBits bgBits;







void DrawGrid(DrawingSurface* ds)
{
  //draw some stuff onto ds, that we'll want to paste onto the original background
}

//Restores the original background (into the viewport only) using a tiles-based system
void ClearBackground(DrawingSurface* ds)
{

  int i1 = GetViewportX()/bgBits.bits_w;
  int ofs_x = (i1+1)*bgBits.bits_w - GetViewportX();
  int j1 = GetViewportY()/bgBits.bits_h;
  int ofs_y = (j1+1)*bgBits.bits_h - GetViewportY();
  
  int i2 = i1+ System.ViewportWidth/bgBits.bits_w;
  int j2 = j1+System.ViewportHeight/bgBits.bits_h;
  
  
  int i = i1; int j;
  int i_s,  j_s;
  while(i<i2) {
    j=j1;
    j_s = 0;
    while (j<j2) {
      int index = j*bgBits.nbBits_horiz+i;
      ds.DrawImage(GetViewportX()+ofs_x+ i_s * bgBits.bits_w, GetViewportY()+ofs_y+j_s*bgBits.bits_h, bits_array[index].Graphic);
      j++;
      j_s++;
    }
    i++;
    i_s++;
  }

}



bool BackgroundInitialized; //flag to save the room's background and perform all associated computing (drawing grid, etc.) only once


void InitBackground()
{
  if (!BackgroundInitialized)
  {
    SetViewport(25, 13); //DEBUG
  
    DynamicSprite* backgroundBackup = DynamicSprite.CreateFromBackground(); //Create a copy of the room's background
    
    //create a new empty sprite where we draw the grid
    DynamicSprite* g = DynamicSprite.Create(Room.Width,  Room.Height, false);
    DrawingSurface* gS = g.GetDrawingSurface();
    gS.Clear(COLOR_TRANSPARENT);
    DrawGrid(gS);
    gS.Release();
    
    //create a second copy of the room's bg, then we render the sprite with the grid onto that one (with transparency)
    DynamicSprite* bgWithGrid = DynamicSprite.CreateFromExistingSprite(backgroundBackup.Graphic, false);
    DrawingSurface* s2 = bgWithGrid.GetDrawingSurface();
    s2.DrawImage(0, 0,  g.Graphic,  100-grid.opacity);
    
    //delete the grid sprite, we needed it only for transparency drawing
    g.Delete();
    
    //and now... CHOP IT INTO BITS!
    bgBits.bits_w = System.ViewportWidth /10;
    bgBits.bits_h = System.ViewportHeight /10;
    
    bgBits.nbBits_horiz = Room.Width / bgBits.bits_w;
    bgBits.nbBits_vertic = Room.Height / bgBits.bits_h;
    
    bits_array = new DynamicSprite [bgBits.nbBits_horiz * bgBits.nbBits_vertic];
    int i=0; int j = 0;
    while (j<bgBits.nbBits_vertic) {
      i=0;
      while (i<bgBits.nbBits_horiz) {
        bits_array[j*bgBits.nbBits_horiz+i] = DynamicSprite.CreateFromDrawingSurface(s2, i*bgBits.bits_w,  j*bgBits.bits_h, bgBits.bits_w,  bgBits.bits_h);
        i++;
      }
      j++;
    }
    
    s2.Release();
    
    backgroundBackup.Delete();
    bgWithGrid.Delete();
    
    BackgroundInitialized = true;

  }
}


void Render()
{
  InitBackground(); //This will be done only once, at first game loop
  

    DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
    ClearBackground(ds);
    ds.Release();
    
}
void repeatedly_execute()
{
  Render();
}




void game_start()
{

}
#1485
Quote from: Snarky on Thu 16/04/2015 13:20:37
Keep a viewport-sized dynamicSprite in memory, draw the original bg to that, and then draw the sprite to the bg.
Quote from: Calin Leafshade on Thu 16/04/2015 12:22:01
just make a new bitmap that is screen size, attach it to a GUI and draw on that.
You sggested the same thing , combined with CW's idea of using negative coordinates. Calin's idea requires one less DrawImage (it's the engine that draws the GUI's image automatically).
I'll try it and let you know. EDIT: wrote this message while Snarky was writing an implementation. I'm trying asap.

#1486
In the meantime I've tried out a workaround relying on splitting the giant background into tiles and then drawing only the required tiles depending on the viewport position. Even with 100 tiles (32x20 pixels) fitting in the viewport, that's also very slow. Dammit!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#1487
General Discussion / Re: This is frustrating
Thu 16/04/2015 13:19:16
Quote from: selmiak on Thu 16/04/2015 10:55:38
http://benjaminsoule.fr/games/flappy%20pong/
as the name says, flappy pong, unforgiving as always!

I just HATE YOU because not only I cannot stop playing this, but it reminds me how bad I am at arcade games( I can't even beat the second guy!!!)
#1488
Quote from: Crimson Wizard on Thu 16/04/2015 11:32:20
E: By the way, try NOT to using System.ScreenWidth and ScreenHeight, like EVER. These are not game size, these are game size + black borders. Use System.ViewportWidth and System.ViewportHeight instead.

Woops! Thanks. For the rest of what you wrote, I'll have a look asap.

Quote from: Crimson Wizard on Thu 16/04/2015 11:32:20
Code: ags

  ds.DrawImage(..., ..., bgWithGrid.Graphic); //Let's redraw the original background

Don't you think it will be even slower to redraw the entire giant background, like this?


Tracker: http://www.adventuregamestudio.co.uk/forums/index.php?issue=664.0
#1489
I'm trying to find the best way to perform the following process:
- have a very large room (like 5000x5000) in a 320x200 game.
- at game's startup, I save the orginal background to a dynamicSprite
- then at every game cycle, I'll manually draw stuff into the view port. In order to do that, I need to restore the bit of background that's visible in the Viewport. So I just need to redraw a 320x200 area.

I've yet to find a fast way to do that. It's horribly slow, as if the performance dropped because the room is very large. Yet, it can't be the room's fault, because if I just let the game run normally (without doing any of my custom drawing operations), it runs at normal speed.

So I'm trying to fnd the culprit. Could it be GetDrawingSurface? I believe that behind the scenes it just sets a pointer to the memory location where the RGB values of the sprite are stored -- I don't think (I hope!!!) that it duplicates the whole sprite in memory. But I could be wrong.

Here is the code I run in repeatedly_execute:
Code: ags

DynamicSprite* bgWithGrid; //Global variable. It's a backup of the original room's background.

  ...

void repeatedly_execute()
{
  DrawingSurface* ds = Room. GetDrawingSurfaceFromBAckground();
  DrawingSurface* source = bgWithGrid.GetDrawingSurface();
  DynamicSprite* s = DynamicSprite.CreateFromDrawingSurface(source,  GetViewportX(),  GetViewportY(),  System.ScreenWidth,  System.ScreenHeight);
  ds.DrawImage(GetViewportX(), GetViewportY(), s.Graphic); //Let's redraw the original background
  
  source.Release();
  s.Delete();
  ds.Release();
}





#1490
*insert giant Q-tip into giant head's ear*
#1491
Quote from: Snarky on Wed 15/04/2015 12:14:32
0) The PNG of the object sprite is saved with an alpha channel and no opaque background
1) Your game color depth is set to 32 bit
2) When you import the sprite and it asks whether you want to keep the alpha channel, you say yes
3) ... and on the import window, you select "keep existing" transparency

...And you didn't change the game color depth to 32-bits after importing your background and sprites (e.g. your background was imported as 24-bits). In that case, re-import your background and sprites to be sure they're 32-bits.
#1492
What needs to be understood, though, is :
1) You'll need to write your data structures yourself and many graphical functions yourself if you plan to do something "exotic" (example: if you write a platformer, then AGS doesn't offer a "tiles grid" feature, so you'll need to devise a data structure to store the tiles, and to write the function that draws the tiles onto the screen -- it's not too complicated and been done before, you'll find several platformer engines on the forum -- but if you're a complete beginner in programming, you can't).
2) You'll never meet the performance of engines such as Unity. The AGS script and rendering routines are much slower. But that's enough for most uses, especially if you go low-res (320x200).

Oh, other cool examples of non-adventure games are :
- Red Hot Overdrive (an 'Outrun' clone) : http://www.adventuregamestudio.co.uk/forums/index.php?topic=51045.0
- AGS Kart (a 'Mario Kart' clone) : http://www.adventuregamestudio.co.uk/forums/index.php?topic=45834.msg615552#msg615552
- The art of theft (an arcade/stealth platformer) Really really cool
#1493
BOOM. Updated. New screenshot, new version.
#1494
Quote from: Gurok on Tue 14/04/2015 23:38:02
The notes say otherwise, but I believe the for() loops mean this requires 3.4.0.3+.
Wait what? Are you saying there is a "for" in my script? If there is one, I'd be utterly surprised. :D I didn't even know it was possible in AGS.

Quote from: Gurok on Tue 14/04/2015 23:38:02
I'd like to see variable density.
As I indicated in the script's header the basic code is inspired from someone else so I'm not exactly sure what defines the points' density but I believe it's simply the number of points you define for the curve rendering. So it's only a matter of calling 'Bezier.Init(666, 5000);' instead of 'Bezier.Init(666,50)' to increase the density by a factor of 100 (50-->5000).
EDIT: implemented in version 1.1

Quote from: Gurok on Tue 14/04/2015 23:38:02
Could you just draw a line between points to avoid holes?
Oh yes that would actually be very easy to implement, using array 'curve' in the module at rendering time. That's also the array you may expose using a little export/import.
Spoiler

Code: ags

//in the module's header
import float curve[]; //never sure of the syntax: maybe you need to remove the brackets

//in the module's body
float curve[];
export float curve[]; //never sure of the syntax: maybe you need to remove the brackets

[close]
EDIT: implemented in version 1.1



I did that just for fun in one hour and I wans't intending on upgrading the module but you guys made interesting suggestions, I might have a look ;) Can't promise though.
#1495
Beziers curves are a (not too slow) way of representing curves onto a screen. Look them up in Wikipedia. Not to be confused with Splines.
This module lets you define the settings of a curve and then render it onto a drawing surface.
The demo lets you see in real time how different settings render the curves.

Code: ags

//
//  AGS BEZIER MODULE
//
//  Summary : Draws Bezier curves onto the drawingSurface of your choice. (see http://en.wikipedia.org/wiki/B%C3%A9zier_curve )
//
//  AGS version: tested on AGS 3.3.0 RC1 (but also surely works with 3.2+ and 3.4+)
//  Author : 'Indiana Jones and the Seven Cities of Gold' development team. Support contact : 'Monsieur Ouxx' on the AGS forums
//  AGS was originaly created by Chris Jones, greatest benefactor of mankind. There, I said it. Special thanks to the newer support team!
//
//  LICENSE
//  This code free of rights, provided you credit Tolga Birdal on one hand, and the 'Indiana Jones and the Seven Cities of Gold' development team on the other hand.
//
//  HOW TO USE:
//  - Either leave the 'Bezier.Init(50);' present in the module, or call it yourself from some other place.
//  - Call Bezier.AddPoint(x,y); each time you want to add a point to the curve
//  - Call Bezier.Render(drawingSurface); to render the curve onto that DrawingSurface.
//  - Call Bezier.ClearAll(); to erase all previously-defined points and start a new curve.
//
//  PLEASE NOTE: you can define only one curve at a time.
//
//  HISTORY : Version 1.1 adds on-demand density change and connects the dots with straight lines.


(screenshot)




            >>> DOWNLOAD v1.1 <<<


Known issues:
- (version 1.0  only!) This is not a bug, this is by (poor) design : That is a very simple implementation, with a "fixed" density of rendered points --> It means that rendering a short line will create a very "dense" curve (with a lot of puffy pixels along the curve) while rendering a long line will create a very thin line with "holes" in it.
- (version 1.1) None.
#1496
That moment when you realize that the Space-Quest-]|[ fanbase is actually some sort of morbid blood-fetish cult.
#1497
Quote from: Creamy on Mon 13/04/2015 22:12:35
Quote@Stupot+: this reminds me of a french comic strip from my youth featuring a wizard's apprentice that kept wanting to go back to sleep while the wizard kept playing jokes on him...Disciplus Simplex or something like that...
Actually, the wizard is Leonardo Da Vinci. I loved that comic strip :)


One of the funniest and most crazy comics! "I SERVE SCIENCE AND IT'S MY JOY", says the apprentice (almost always just before being smashed to dust by some device Leonardo just invented).


...But I digress ;)

About the sleep topic:
#1498
Keep in mind, though, that in MI, the game is mostly centered on: a well-structured global plot (divided in four chapters) and well-designed puzzles. Therefore, the dialogs are just fillers, and the fact that it's a comedy game allows the writers to just insert gags as-they-come in those impromptu dialogs.
Tehrefore, it's the combination of : well-structured story+well-designed puzzles+comedy that allows improvisation. That wouldn't work if you overlooked one of those 3 ingredients.
#1499
Try to dose profanity -- you can put a lot of it in the game, but only where needed. For example if you have a very rude character, make him swear all the time, but if all characters end up saying fuck all the time, then they won't sound badass anymore, the game will just sound dull and vulgar.
#1500
Yeah I forgot to say it but the Bates motel is very cool and a great first entry!
SMF spam blocked by CleanTalk