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 - jumpjack

#21
Engine Development / Re: AGS engine Web port
Sat 14/01/2023 11:38:31
I have another installation of AGS 3.6.0 RC4 in another PC (but reading/writing the game in same cloud folder of the other PC), and it does not create the "phantom" my_ags_game.ags , so I don't know what is going on.
In  the AGS-3.6.0.39-RC4.zip file there is no my_ags_game.ags file.
I started with 3.6.0 RC3 but I see it is no more downloadable so I cannot check.

I see that if I put a .ags file in data folder, upon compiling it's copied to web fodler and added to the list of files in my_game_files.js. But why should I add a .ags file in data folder? And can a game be made of multiple .ags files?
#22
Engine Development / Re: AGS engine Web port
Fri 13/01/2023 21:04:42
it's even listed in my_game_files.js , and I didn't create it!

https://github.com/jumpjack/Space1999Adventure/blob/main/AGSdebug2/my_game_files.js

I am using 3.6.0 RC4.
#23
I changed my code as suggested above, no more flickering now.  :)

https://github.com/jumpjack/Space1999Adventure/tree/main/AGSdebug2

This solution also saves some of memory, using just 100 overlays rather than 400.

Code: ags
  ///// Build room tile by tile
  int layerNumber = 0;          
  int overlayIndex = 0;
  int tileIdInt[4];
  for (int isoX = 0; isoX < mapwidthTiles; isoX++) {
    for (int isoY=0; isoY < mapheightTiles; isoY++) {
      isoToCartesian(isoX, isoY,  tilewidth * (mapwidthTiles/2));
      tileIdInt[0]  = mapTiled[isoX].elements[isoY];
      tileIdInt[1] = mapTiled1[isoX].elements[isoY];
      tileIdInt[2] = mapTiled2[isoX].elements[isoY];
      tileIdInt[3] = mapTiled3[isoX].elements[isoY];

      DynamicSprite* tileLayersContainer = DynamicSprite.Create(24, 200); // will hold all tiles stacked on same isox, isoy location
      DrawingSurface *tileLayersContainerSurf = tileLayersContainer.GetDrawingSurface();

      /////// Build the room by stacking on same isoX, isoY coodinates all the tiles from all the layers, 
      /////// and storing them into a room overlay; overlay is drawn only once all tiles have been drawn in it.
      ////
      //// # Create temporary sprite "tileLayersContainer"
      //// # Gets its drawingsurface into "tileLayersContainerSurf"
      //// # For each (isoX,  isoY) location:
      //// #    For each layer:
      //// #      Paste the layer tile into the drawing surface, at an Y level depending on layer number (Layer 0: y=0,  layer 0: y=7, ...)
      //// #    Create a RoomOverlay from the final sprite drawingsurface, and assign it a ZOrder as follows:
      //// #    Should be like this...
      //// #              0        
      //// #            1  1      
      //// #          2  2  2
      //// #        3  3  3  3  
      //// #      4  4  4  4  4 
      //// #    5  5  5  5  5  5  
      //// #    ....                  
      //// #    But player should be placeable between levels,  so multiply this ZOrder by half tile height:
      //// #                      
      //// #              0        
      //// #            6  6      
      //// #          12  12  12
      //// #        18  18  18  18  
      //// #      24  24  24  24  24
      //// #    30  30  30  30  30  30 
      //// #    ....                  
      
      for (int currentLayer = 0; currentLayer < 4; currentLayer++) {
        if (currentLayer == 0) { // Draw floor tile under all tiles,  empty or not.
          non_flipped = DynamicSprite.CreateFromDrawingSurface(floorTileSurf, 0, 0, floorTileSurf.Width,  floorTileSurf.Height);
          DrawingSurface *non_flippedSurf = non_flipped.GetDrawingSurface();  // Put sprite graphic into surface to draw it onto container surface
          tileLayersContainerSurf.DrawSurface(non_flippedSurf, true, 0, TILEDOWN + YFACT + 12); // Paste tile into container      
        }        
        if (tileIdInt[currentLayer] > FACTOR) { // Tile to be flipped  
          tileIdNorm = tileIdInt[currentLayer] - FACTOR - 1; 
          flipped = DynamicSprite.CreateFromExistingSprite(tileIdNorm,  true); // clone the sprite to flip it
          flipped.Flip(eFlipLeftToRight); 
          DrawingSurface *flippedSurf = flipped.GetDrawingSurface();  // Put sprite graphic into surface to draw it onto container surface
          tileLayersContainerSurf.DrawSurface(flippedSurf, true, 0, TILEDOWN - 7*currentLayer); // Paste tile into container      
  //debugPrint(String.Format("FLIPPED Overlay n. %d is located at ISO %d, %d, has normalized id %d (original id: %d, flipped slot: %d) and Z=%d", overlayIndex, isoX,  isoY,  tileIdNorm, tileIdInt[currentLayer],  flipped.Graphic, roomOverlay[overlayIndex].ZOrder), false);
        } else { // Don't flip tile
          if (tileIdInt[currentLayer] !=0) { // Regular tile
            tileIdNorm = tileIdInt[currentLayer];
            non_flipped = DynamicSprite.CreateFromExistingSprite(tileIdNorm,  true); // clone the sprite to flip it        
            DrawingSurface *non_flippedSurf = non_flipped.GetDrawingSurface();  // Put sprite graphic into surface to draw it onto container surface
            tileLayersContainerSurf.DrawSurface(non_flippedSurf, true, 0, TILEDOWN - 7*currentLayer); // Paste tile into container      
  //debugPrint(String.Format("normal  Overlay n. %d is located at ISO %d, %d, has default    id %d (                                ) and Z=%d", overlayIndex, isoX,  isoY,  tileIdNorm, roomOverlay[overlayIndex].ZOrder), false);          
          } else {  // Empty tile (=walkable area)
  //debugPrint(String.Format("normal  Overlay n. %d is located at ISO %d, %d and is empty", overlayIndex, isoX,  isoY), false);                    
            tileIdNorm = 0;
          }
        }
              
        if (currentLayer == 0) {    // Draw walkable areas only for base layer        
  //      1
  //    3  2
  //    5  4
  //      8

  // ymargin needed above tile for better handling adiacent tiles occluding player
        int x1 = screenx;                          int y1 = screeny + YFACT - YMARGIN/2;
        int x2 = screenx + tilewidth/2;            int y2 = (screeny + tileheight/2 + YFACT)  - YMARGIN/2;
        int x3 = screenx - tilewidth/2;            int y3 = (screeny + tileheight/2 + YFACT)  - YMARGIN/2;

  // ymargin needed below tiles to prevent apparent player walking over objects
        int x4 = x2;                                int y4 = y2 + YMARGIN; 
        int x5 = x3;                                int y5 = y3 + YMARGIN; 
        int x6 = screenx;                          int y6 = screeny + tileheight + YFACT + YMARGIN;
      

        if ((tileIdNorm != 0) && (tileIdNorm != 10) && (tileIdNorm != 23)  && (tileIdNorm != 45)  && (tileIdNorm != 46)) {
          // 0 = walkable:
          //    10 = doors (debug: open/closed)
          //    23 = glass floor (used between stairs)
          //    45, 46 = stairs      
          // !=0 = not walkable
    
          walk.DrawingColor = 0; // Drill non walkable areas
        
          ///// drill nonwalkable holes in walkable area:
          walk.DrawTriangle(x1, y1,  x2, y2,  x3, y3);
          walk.DrawRectangle(x3,  y3,    x4,  y4);
          walk.DrawTriangle(x4, y4,  x5, y5,  x6, y6);
          /////////        
          
        } else {
          //// Draw special regions (stairs and glass floor)
          if ((tileIdNorm == 45) || (tileIdNorm == 46)) { // stairs: not directly walkable,  but player.z must be increased
            myRegions.DrawingColor = REGION_STAIRS;
            myRegions.DrawTriangle(x1, y1,  x2, y2,  x3, y3);
            myRegions.DrawRectangle(x3,  y3,    x4,  y4);
            myRegions.DrawTriangle(x4, y4,  x5, y5,  x6, y6);
          }
  
          if (tileIdNorm == 23) { // glass floor (slightly above base level)
            myRegions.DrawingColor = REGION_GLASS;
            myRegions.DrawTriangle(x1, y1,  x2, y2,  x3, y3);
            myRegions.DrawRectangle(x3,  y3,    x4,  y4);
            myRegions.DrawTriangle(x4, y4,  x5, y5,  x6, y6);
          }
        }    
      }
        //Wait(5);
    }
    roomOverlay[overlayIndex] = Overlay.CreateRoomGraphical(screenx - tilewidth/2, screeny - 2*tileheight + YFACT - TILEDOWN,  tileLayersContainer.Graphic,  0,  true);
    roomOverlay[overlayIndex].ZOrder = (isoX + isoY + 1)*6 + YFACT ;
    overlayIndex++; 
    } // isoY  
  } // isoX
  walk.Release();    
  Debug(5, 0); // show path of player  
#24
Engine Development / Re: AGS engine Web port
Fri 13/01/2023 13:53:44
Quote from: eri0o on Thu 12/01/2023 08:41:39There's no standard name, if there's an extra .AGS file in the directory either you put there or you put in the Data directory.
I didn't do anything manually, all files have been created by AGS. I also tried deleting all of them, but upon compiling it recreates both .ags files.
#25
 
Quote from: Khris on Fri 13/01/2023 07:42:45If two overlays have the same z-order, their per-frame order is based on the cosmic rays hitting the earth and the energy flowing through ley lines in that precise quantum moment, which makes them flicker to the front and back.

:-D  Funny... but I think this is not the case: if you watch carefully you can see that flickering is not random, it always happens at same moment on same overlay when player is in same position. There is something in the engine code which makes player position influence overlays draw order.  ???
#26
Quote from: Crimson Wizard on Thu 12/01/2023 22:42:14Another solution that could be tried here, in my opinion: merging multiple static tiles, that are located in the same position, on a single overlay, instead of creating a separate overlay for each tiny element.
This is an interesting idea: rather than  drawing whole layer at once, I should draw all layers of each tiles at once.

Now:




Then:

Draw/create order:



ZOrder assignment:

#27
Quote from: Khris on Thu 12/01/2023 22:34:21The parts that disappear and reappear seem to be in the same spot as a bunch of background overlays; is it possible they have the same z-order value? As in, cannot be sorted reliably?
Yes, I assigned same Zorder to all objects which in "real world" would lie down on same floor tile. But they are drawn bottom-up, so I don't get why the final result is not as I would expect.

Guess I have to rethink my isometric algorithm. ???
#28
Quote from: Crimson Wizard on Thu 12/01/2023 20:37:37Alternatively, is it possible to download a game.ags file somewhere, to let me test this under debugger?
I don't  know if web version of AGS can be opened and viewed in editor, anyway it's in the same folder of main page:
https://jumpjack.github.io/Space1999Adventure/AGSdebug/my_ags_game.ags
https://jumpjack.github.io/Space1999Adventure/AGSdebug/004.ags
#29
My game is behaving weirdly again. :-)
I define ZOrder of all my overlays only once at room creation, but I see various overlays changing draw order while character moves around them: sometimes overlay A is drawn over overlay B, other times B gets over A while character moves around; how do character movements influence overlays zorder?

This is the web version (continuously changing, so it could be not working at all when you run it...):
https://jumpjack.github.io/Space1999Adventure/AGSdebug/  (press CTRL+F to unlock the character)

Note:
the room is drawn by layers: layer 0 for floor, then further 3 layers for various objects; the flickering objects, for example windows, are on layer>0.

I seacrhed for "ZOrder" in whole project, but it only occurs in room script, at room creation.
#31
I need that my character Y position is constantly added a fixed quantity as long as character remains inside a region.

I tried with this:

Code: ags
function region1_Standing() {
  //if (!raised) {
    cEgo.y -= 10;
    raised = true;
  //} else {
    // already raised
  //}
}

If  lines are commented, character flickers between "normal" and raised position.
If they are not commented, character Y position is changed only at the beginning, then turns back to the one calculated by pathfinder.
#32
Engine Development / Re: AGS engine Web port
Thu 12/01/2023 08:11:46
I see that in the WEB folder two .ags files are created: one is the copy of the .ags game, named as I called my game (for example pacman.ags), the other has the "standard" name my_ags_game.ags . Why are both needed? They differ only by 1KB, but it looks like a waste of space..
#33
Wait a moment... I also just found a solution for both the issues of online manual not finding substrings and CHM engine not finding substrings!

Online manual (https://adventuregamestudio.github.io/ags-manual/): it's set by default for "full word matching", which can be disabled by clicking on the underlined "ab" in rhe searchbox.

CHM file: it needs wildcards! Searching for "createfrom*" shows multiple results.

#34
I created a script which turns the raw .md files of the AGS manual into a single, searchable HTML file, you can find it here:

https://github.com/jumpjack/Space1999Adventure/blob/main/markdown-converter.html

The html file created is very raw: no styles, just the raw output of pandoc tool applied to all single .md files,  but all links (both internal and external) are active.

The final result is available here:

https://github.com/jumpjack/Space1999Adventure/blob/main/ags-manual.zip

If anybody can suggest an Unix equivalent for the DOS batch file which creates the html  files from .md files, I can add it to my page.

The DOS batch file is as follows, and must be save in same folder of .md files:

Code: ags
for /r .\ %%M in (*.md) do (
  pandoc %%M -o %%~nM.html
)

Of course the final objective is just to make the whole manual searchable for free text.
Now I know that there are 51 occurrences of "createfrom" and 320 of "dynamic"  ;)

#35
Quote from: Nahuel on Mon 09/01/2023 17:47:25What are you trying to search for exactly, there' no match for that in the manual, google doesn't find = correct. What's the final outcome on this new thread question?
It's the opposite of what you say.

And it looks like its a github "feature": https://stackoverflow.com/a/43911827/1635670
"Currently, we do not support substring matching in our search"
#36
This google query should return any page containing "createfrom" substring, but id does not work with adventuregamestudio.github.io:

site:https://adventuregamestudio.github.io/ags-manual CreateFrom

Maybe there is some access flag to be enabled on github?


And I cannot search free text in the searchbox of the usermanual , as it returns "no match".


So how do I search for free text?
#37
I don't get it: can I do it or not?
How can I create "something" on which I can use these functions?
#38
I can't find any suitable function to add/create room objects at runtime, is it possible? If not, can I "hookup" an overlay or a sprite (the only things I know how to create at runtime) to an object created in editor, so as to be able to use object functions on it?
#39
Quote from: Khris on Sat 07/01/2023 11:26:19I'm sorry, but can you clarify what you're asking for exactly?
The solution to this issue is to either
a) create an array of dynamic sprites so each overlay has its own
b) use the clone option so each overlay has its own

The github post seems to just restate the original problem, which in my book is thoroughly analyzed and solved already?
my script is working fine, I don't need any further help, thanks.
#40
I added further info and a screenshot in the issue, but it is closed and discussion should continue here:

https://github.com/adventuregamestudio/ags/issues/1882#issuecomment-1374435160
SMF spam blocked by CleanTalk