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

#2382
I did a plugin that gives sqlite capabilities for ags. GitHub repo is here and already includes the dll and so for download under Releases->Assets.

I wonder if anyone has any suggestions regarding reading the resulting SQL requests when searching the database, right now it will return pure text with the results.

Probably no one will answer this right now, but someday in the future when someone browses around for sqlite and AGS I will get an answer. :)

You can create a table using

Code: ags

AgsSQLite* db = AgsSQLite.Open("test.db");
  
  String sql = "";
  
  sql = sql.Append("CREATE TABLE CHARACTERS(");
  sql = sql.Append( "ID INT PRIMARY KEY     NOT NULL,");
  sql = sql.Append("NAME           TEXT    NOT NULL,");
  sql = sql.Append("ROOM            INT     NOT NULL,");
  sql = sql.Append("X               INT     NOT NULL,");
  sql = sql.Append("Y               INT     NOT NULL);");
  
  SQLiteQueryStatus rc = db.ExecuteQuery(sql);
    
  Display(db.GetQueryStatusText());  


Apparently I need to conceive some sort of table object so that the result of a query is easier to traverse. I imagine the simplest object would be something like:

Code: ags

managed struct Table {
  import attribute String Cell[];
  int RowCount;
  int ColumnCount;
};


And it would be accessible with something like:

Code: ags

Table* result = db.GetQueryResult();
Display(result.Cell[x+y*result.RowCount])


Still need to think a little more.
#2383
Ok, I gave it some thought, and Navigation (the class in router_finder_jps.inl) has map and mapNodes. Somehow I think navmesh is something more similar to a Navigation alternate class that has these Nodes as a first class element, where a node could be connected to N nodes, and you are solving this path problem for a group of nodes that don't necessarily map to... A map, a thing with X,Y positions. (Example, like the the levels on super Mario world connect as nodes.)

I feel for X,Y positions the concept of navmesh could be abstracted to a navmap. The difference is the navmap is this object that the Nodes are actually mapNodes, and then derived from an input map, similar to the walkable bitmap, but a sprite, or a 2D matrix, or similar.

So, in examples, something like this.

Code: ags

// Initializes from an int sprite 
Navmap* myMap = Navmap.CreateFromSprite(2);

// find path from source x,y to destination x,y
Point path[] = myMap.FindPath(20, 64, 100, 300);
if (path == null)
     return; // no path found
for (int i = 0; path[i] != null; i++)
{
}


The above would still only require storing the sprite number instead of the full map. Also it would be reasonable provide a myMap.Update() that regenerates the map for the original sprite identifier in case it gets edited by drawing on it's surface or something.

Then on Navmesh, in my mind, it's a bit more complex...



Code: ags

Navmesh* myMesh = new Navmesh;

myMesh.AddVertex(/* id */ 1);
myMesh.AddVertex(/* id */ 2);
myMesh.AddEdge(/*p1 id */ 1, /* p2 id*/ 2, /* "effort" */ 5);
myMesh.AddVertex(3);
myMesh.AddEdge(1, 3, 25);
myMesh.AddVertex(4);
myMesh.AddEdge(3, 4, 1);
myMesh.AddEdge(2, 4, 1);

int mesh_path[] = myMesh.FindPath(1,4);
//mesh path will be an array containing [1,2,4,0]


Don't know if my notation makes sense... But when I read on, mesh is just squares on 2D games, so I think you are right. Just giving some thoughts on what I imagined. Note: I have no experience with contemporary engines.
#2384
Uhm, I mean, just keep the same api as you said, but if the number is the same as previous, do not regenerate the map. If someone loads a save, the sprite will be passed and the clean map will then be initialized. If someone needs to pass the same map twice, since the sprite has the same number as previous nothing happens. We can add a note that passing -1 as sprite number, reloads the previous sprite. This way we just need to serialize an int (the sprite number) instead of the full map. This skips the need for an extra object.
#2385
Whoa, that may actually work too. The Room may reuse the current Navigation instance nav, the Game would need a new instance for the an arbitrary sprite. My use case was actually an arbitrary script, since I wanted to generate my walkables using agsfastwfc. Maybe we could have too a GetLastPathLength() . A bit ugly but works.   ;-D

Ah, it would be interesting if it could in some way know that the sprite has been passed before, because then it wouldn't need to regenerate the Navigation.map nodes, which appears to be slower than actually calculating the path.
#2386
I reflected and it's missing some way to tell the grid map is not initialized yet and some way to clear it. Also need to serialize the map and load from the serialized data on game restore.
#2387
I think it picks a tile of NxN size from the input image and places somewhere on the output image, and then it picks a tile of NxN size from the input image and places it on the output image with one of the borders of the tile being the same pixels (fitting, like with jigsaw pieces), and do this step a ton of times until the image is filled. But the algorithm appears to be optimized to do this blazingly fast (I think you can even hit it on each ags FRAME!) and also I haven't yet got bad outputs (like full black screen for the house example above)
#2389
Hey guys,

I need help with people to test this and give suggestions, even for naming things.

AGS Pathfinder Plugin version 0.1.0

Get the plugin: agspathfinder.dll, libagspathfinder.solibagspathfinder.dylib 
GitHub Repo | Demo Windows | Demo Linux



This plugin has copy of the actual pathfinder used by Adventure Game Studio, and exposes an interface to interact directly with it.

It's in experimental state because I believe that once the API for it is figured out, it's facilities would be provided by AGS Engine itself and then this Plugin would not make sense anymore.

AGS Pathfinder usage

Pathfinding is provided in three steps.

1. Set the map, Pathfinder will generate the nodes. Don't do this every frame.

2. Get the path as a vector by passing an origin and a destination.
   If your node map is not too gigantic, this should be very fast.
   If start and end of the vector doesn't match your origin and destination, no
   path was found. Ideally the vector returned should be empty.

3. Consume the returned vector and do something with it.

Code: ags

// 1 Pass sprite 1 to be used as map
AgsPathfinder.SetGridFromSprite(1);

// 2 Calculates the path and returns a vector containing all the nodes
PathNodeArray* pathNodeArr = AgsPathfinder.GetPathFromTo(origin_X, origin_Y, destination_X, destination_Y);

// 3 Consume your path node by node
while(!pathNodeArr.Empty()){
  PathNode* pathNode = pathNodeArr.Pop();
  // do something with pathNode.X and pathNode.Y
}


AGS Pathfinder Script API


void AgsPathfinder.SetGridFromSprite(int sprite)

Pass a sprite to be used as the walkable map. Real black (000000) identifies walls.

PathNodeArray* GetPathFromTo(int origin_x, int origin_y, int destination_x, int destination_y)

Get a PathNodeArray containing each Node of the path for the provided origin and destination.
#2390
Erh, Khris, can you explain how this would be solvable by implementing a new pathfinding? I can't understand how this is related (I may be doing just that...).
#2391
AGS Editor compiles to an intermediary "AGS Bytecode" (I don't know the actual name) and you can think on the AGS Engine as a "virtual machine" (like Java Virtual Machine or a videogame emulator) that reads the bytecode and makes it work in the machine it's being ran. You only need the Engine running in other hardware and system, once you get that, you can run the "AGS Bytecode" (again, don't know the actual name for it).
#2392
Thank you guys for trying it out!

I need to figure out how to pass tilesets, thinking on creating a managed struct to describe each tile and pass an array of tiles but I don't know yet how to read this on the plugin side.

Below a gif of it working from the algorithm original GitHub page. But the implementation used here is not the original.

#2393
I recently built a very experimental plugin to test some ideas, the AGS Fast Wave Function Collapse Plugin.

First some images to help explain the possibilities.





The plugin right now has only a simple interface like this:

Code: ags
bool AgsFastWFC.Overlapping(
                  int destination, int sprite,
                  int seed,
                  bool periodic_input, bool periodic_output,
                  int N=3, int ground=0)



  • int destination The Graphic property of a Dynamic Sprite you have created to draw the result.
  • int sprite The source sprite you want to feed FastWFC Overlapping algorithm.
  • int seed An integer number, will provide the randomness of the output.
  • bool periodic_input Should be true if the input is periodic.
  • bool periodic_output Should be true if the desired output is periodic.
  • int N A NxN pattern of pixels in the output should occur at least once in the input. Default is 3x3 pixels.
  • int ground Default is 0.

The algorithm can in some cases fail, depending on the configurations, this is why it returns either a true, for success, or false, for failure.

A GitHub Repository is up to share the code and I added more information there too. You can also download the code as a zip. If you want to try the demo game, you can also download it for windows or linux (64-bit only).

I did only the ags parts and picked the interesting algorithm from a very interesting implementation I found online, which is better explained in the GitHub repo. It's reasonably fast as you can notice when interacting with the demo.
#2394
What was the step that fixed?
#2395
You can use System.OperatingSystem'

https://adventuregamestudio.github.io/ags-manual/System.html#operatingsystem

Code: ags

if (System.OperatingSystem == eOSAndroid || System.OperatingSystem == eOSiOS) {
  Display("Running on mobile!");
}
else {
  Display("probably desktop!");
}


I find it easier for testing doing this check only once on game_start and setting a boolean global variable. This allow you being able to change this variable to other value to test something for mobile platform from your computer.

Mouse cursor can then be hidden using mouse.Visible.

https://adventuregamestudio.github.io/ags-manual/Mouse.html?highlight=Mouse#visible
#2396
Critics' Lounge / Re: Space colony buildings
Thu 15/08/2019 14:34:24
Can we have the dish antenna spinning?  :-D
#2397
Have you hit the 2k mark now Eric? Impressive work you have made!
#2398
Cat, I have no idea if this is useful or not, but since AGS 3.5.0, CW added the Game.PlayVoiceClip(Character*, int cue, bool as_speech ). Alternatively, if the String is constant from a possible alternatives, maybe refactoring for having if-else/switch cases with the different say functions for the sound be searchable by speech auto-numbering?
#2399
Hey, does someone still has this problem using latest ags? Can be tested using acwin.exe on the same folder as the game that has the problem.
#2400
I noticed there is no way to invoke a ListBox.OnSelectionChanged event. Also it appears changing selection of a list box by code doesn't invoke ListBox.OnSelectionChanged.

I also noticed it's not possible to figure out if a Slider is vertical or horizontal. Apparently If Slider.Height < Slider.Width, it's horizontal. Sliders are also missing a way to check if sliderChanged
SMF spam blocked by CleanTalk