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

#1
I did some searches through github and reviewed the engine documentation, but I couldn't find an answer to this problem: I'm trying to understand how Object.GetAtRoomXY works at an algorithmic level.

Does the hit test involve a simple check whether there is a room object - defined by the object's height and width at room coordinates, regardless of the object's sprite transparency? Or does it only return an object when the point is opaque (e.g. non-transparent) in the object's transparency mask?
#2
This module is a rewrite/port of an excellent Java module for generating Simplex Noise.

Screenshot of demo, with noise generated using 64x64 grid, and 32px by 32px tile sprites


Screenshot of demo, with noise generated using 256x256 grid, and 4px by 4px tile sprites


What is Simplex Noise?
This is a kind of "organized" noise, designed by Ken Perlin. It is most often used for procedurally generating mountainous or underwater terrain in simulation games, but it has many other uses.

What can I do with it?
You can generate "noise maps" which resemble natural terrain like landscapes, oceans, clouds.

How do I use it in my game?
Refer to the demo for an example of 2D noise, drawn as a 2D map over the background using the DrawRectangle function. For games that use tilemaps, like Roguelikes, the general strategy is to produce a 2D noise heightMap, and then translate the heightmap into meaningful tiles.

e.g.
heights of 0.0 to 0.2 are ocean
0.2 to 0.3 is shoreline
0.3 to 0.5 are grasslands
0.5 to 0.7 are foothills
0.7 to 0.9 is mountainous
0.9 to 1.0 is mountain peaks


Update 0.5.2:
- Bug fix: clamp values to -1,+1 after calculation. Necessary due to float rounding inaccuracy.

version 0.5:
- First working version

Downloads:
Demo AGS project
Simplex Noise Module v0.5
#3
I'm not sure if this is a reasonable or easily implementable request, so this is more of an RFC for the time being: would it be possible to add Custom Properties for GUIs and GUI controls in the editor? I'm working on a game that is extremely GUI-heavy, and one of the pain points is being unable to assign custom properties to GUIs and controls that would allow me to customize behaviour for each control.

For example, I have the "Expandable" property which applies to window GUIs. This allows a window to be maximized, minimized, and returned to a standard size. Right now, I keep track of this via a huge struct array that I have to manually populate in script like this:

Code: ags

  Windows[gDottedWindow.ID].Vertical = new WindowExpansion;
  Windows[gDottedWindow.ID].guiID = gDottedWindow.ID;
  Windows[gDottedWindow.ID].Panel = RightPanel;
  Windows[gDottedWindow.ID].Vertical.ExpandedSize = gDottedWindow.Height;
  Windows[gDottedWindow.ID].Vertical.CollapsedSize = WINDOW_TITLEBAR_HEIGHT;
  gDottedWindow.AddToStack();


Ideally, I'd love to be able to do something like this instead:
Via the editor, create "IsExpandable" and "ExpansionState" boolean custom properties to all GUIs.

Then in code I could call it like this:

Code: ags

if (currentGUISelected.GetProperty("IsExpandable"))
{
    ExpandGUI(currentGUISelected);
    currentGUISelected.GetProperty("ExpansionState") = true;
}


I would no longer have to keep track of each GUIs properties via an array of struct, and this would make GUIs more consistent with how Rooms are designed.

Welcoming any thoughts on this idea.
#4
Context: I recently discovered that OpenAL (and via extensions?) supports Positional/3D audio. Although I spent some time browsing the ags github repo, I am not clear as to the progress made with the transition to SDL2 and OpenAL with 3.6.0. It *appears* from a glance that 3.6.0 is now using mojoAL for interfacing with OpenAL.

Question: Is it possible to write a plug-in for AGS that would enable some basic positional/3D audio functions that would allow run-time changes to audio during gameplay? I am working on a first-person adventure that would greatly benefit from this feature, and I'm willing to put in the wrench time to make it happen, if it is possible at all.
#5
As the title suggests - I'm looking for a recommended workaround that would allow me to choose the starting frame for a Button animation. The start frame option was added to Object and Character a few years ago, but Button fell by the wayside.

Because there is no function overloading allowed, what I'm asking for in the topic isn't possible in AGS. It seems that rewriting the entire Animate function, and replicating (in a new module) what Button.Animate does may be necessary. Can someone recommend a workaround that falls short of rewriting the entire Button.Animate implementation?
#6
After reading this post on mouse cursor looping I went ahead and tried to replicate the same behaviour using the latest build of AGS 3.5.1. It no longer appears to work - the mouse wait cursor continues to reset itself to the first frame when a new Wait(x) is called.

I also noticed that when the animation runs, it "hiccups" and skips between frames. It appears as if the engine is competing with itself for the View's graphic property - sometimes the (below script's) scripting code "wins" and sets the graphic property, other times the view's default animation "wins" and sets the graphic property. Is there a chance that the engine's graphics execution order (or script execution order?), or something else has changed since this code was written in 2014?

Have I missed something obvious?


Update: cause of the problem found. See my response below.

Code below. I have ensured that the correct View is being used, as well as wait delay, frames and sprite numbers.
Code: ags

(at top of script)
// mouse wait cursor
int cursorWaitView = MOUSEWAIT; //view of your cursor
int cursorWaitDelay = 5; //animation delay of your cursor
int cursorWaitFrames = 8; //number of animated frames
int cursorWaitFirstSlot = 21; //ID of the first frame
int cursorWaitCounter; // maintain a counter for the cursor

function UpdateMouseWaitCursor()
{
  if (!IsInterfaceEnabled())
  {
    cursorWaitCounter = (cursorWaitCounter + 1) % (cursorWaitDelay * cursorWaitFrames);

    ViewFrame* vf = Game.GetViewFrame(cursorWaitView, 0, 0);
    vf.Graphic = cursorWaitFirstSlot + cursorWaitCounter / cursorWaitDelay;
  }
}

function repeatedly_execute_always()
{
  UpdateMouseWaitCursor();
}
#7
I've been building a windowing system for a game I'm working on, and I've got most of the window behaviour worked out. Windows can stack, push to the front, etc.

One very specific requirement I have is that Rooms must be shown inside of windows. For that, I've been using the new Camera/Viewport system that CW designed.
Now, I understand that putting a Room "inside of" a GUI window frame is not the intended use of rooms, but I've worked around that by creating a GUI composed of a window frame with a transparent box inside. Currently, the Room viewport sits inside of the GUI frame, and works perfectly.

The problem I'm having is that, from what I can see, AGS internally renders all GUIs on top of Rooms, regardless of the z-order. There does not appear to be a "global z-order" that sets the stacking order of all rendered GUIs, Overlays, Rooms, Objects, etc. The outcome of this is that when I drag the Room window on top of a GUI, the GUI stays on top. As you can see in the attached image, the file transfer GUI is on top of the Room viewport (correct), but the modem dialer is also on top of the room window (incorrect).

tldr: Can someone think up a workaround that would allow me to push a Room viewport on top of a GUI?

#8
After recently discovering that 3.5.x has had theming for a long time, I decided to port my favourite VS/Notepad++/everything-else theme "Dracula" to the AGS Editor, in time for Halloween! :)



Dracula is meant to be gentler on the eyes than the current AGS VisualStudio Dark theme, using lower contrast highlights and softer background colours. The entire AGS editor has been recolored, including the scripting boxes - with some exceptions, see below.

Please let me know if you run into any strange coloration or visual anomalies. I have tested this with v3.5.0.x.

Version 0.2

Download here.

Installation
1. Browse to AGS Editor -> File -> Preferences -> Color Theme -> Import Color Theme.
2. Select AGS-Dracula-version.json in your downloads folder.
3. Restart AGS.

Known Issues
- Combo Boxes are missing the proper dropdown arrow colour. This bug has already been reported.
- Frames, Panels, Scrollbars, Textboxes, and certain buttons could not be recolored according to the theme, so they remain white. I am assuming these are tied to default Windows System/winforms theming that I have no control over. Please let me know if you've got a workaround.
- Hyperlinks on the Welcome page are not colourized properly for AGS 3.5.0. This problem was patched in March 2021, so recent versions (latest 3.5.1) of the Editor should look fine.
SMF spam blocked by CleanTalk