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

#261
Code: AGS

char getName[1000];
engine->GetPathToFileInCompiledFolder("",getName);//Strangeland.exe
Mix_LoadMUS(getname+"ffv6.mp3");


So, this is throwing a compile error, I'm looking to use a code, that grabs the folder in which the game is being executed from (which can vary of course depending on where the user/player is installing the thing)
And from that directory (let's say it's C:/Strangeland) set a path name for an mp3.

Right now, I've been able to run my code perfectly setting specific paths of course, but I wanna set a relative path!
I have no absolute clue how 'GetPathToFileInCompiledFolder' works and what it returns. Mix_LoadMUS takes a char as an argument.


EDIT:

char* path;
_get_pgmptr(&path);
const char * getv = (const char *)path;
engine->AbortGame(getv);

This will print the absolute path + the exe
#262
What my question is mostly about is, is that 8 channel limit based on some sort of value? What I mean is it a system limit or is that like the number of simultaneous sounds a sound card can play at the very least?
#263
Well, that's not what I'm saying, I worded it poorly, what I'm saying is there are multiple instances where more than 6 sounds are playing, given that 2 channels are predominantly used by AGS for Speech (channel 0) and Music (Channel 1). And 6 sounds can be easily cluttered imho, conceptually. Given that you could have an ambient sound, that results in 5 sounds simultaneously played, and I personally run into that a lot of the times, especially cause there are some parts of the game that use 2 ambient sounds - 3 ambient sounds that can't be combined into one. What I'm saying is my biggest problem and one I've been trying and trying and trying to patch up, is the need for more than 6 simultaneous sounds played. I've given up on using 2 music channels instead of one to do some custom crossfading, cause I can't afford taking an extra channel over the sound effects. The sounds don't have to start at the same time, there can be a point in the game, where all the channels are full.

Easy example to illustrate my point.

One track of music playing.
One ambient sound of wind.
One ambient sound of a cicada whirring (this is a character that moves from room to room)
One sound of getting an item
One sound of a UI opening
One sound of a click selection
One sound of an animation related

You could be opening a MOTOR UI and solving the puzzle relatively fast as the UI opened.
Poof, there goes the channels. And this happens, I can upload a savegame where something like that is happening.
#264
The issue lies that with 8 channels almost being always used, I get either sounds cut off or not playing.
8 channels would equal
1. Speech
2. Music
3. Footsteps
4. Ambient
5. UI Click/Selection click
6. Game sound playing (example would be here a Seastar (Strangeland is a weird game) responding to a selection on a dialog UI)
7. Score Sound playing
8. Game sound playing (a pitched sound rising because of your selection (Strangeland is a weird game).

Generally if we could somehow allow the number of simultaneous sounds being played I think that would be stellar, I've been trying to devise a way around this, so I'm open to suggestions at this point. I don't know the technicalities behind the limit of 8 channels, but from a look in the code it seemed not to be something specifically set for a reason, it could be of course it, the source code is vast.
#265
Apologies for the bump, been looking at this a lot today. In my honest opinion, the only needed formats audio wise would be ogg, wav and midi, the rest is really pushing it. I can explain from an audio perspective. Midi is midi of course, wav is lossless (flac is too) and ogg is compressed. I would argue including mp3, but that's about it imho. Anyhow, personally my biggest issue, is that audiochannels are wonky, they replace each other and there's no way unless, each time I play a sound, i get a state of the channels and ensure they are as they were before + the new sound I'm playing.

I haven't checked what AGS uses internally as an audio lib, and I wonder if increasing the limit of the audio channels will fix that (from 8 to more) issue. I remember Calin coded an fmod plugin, which at the time I didn't check if it also had the issue of the 8 channels, but a lot of users in that topic said that it fixed the audio stutters. Anyhow, I don't think FMOD is the way because of its licencing.
#266
The game is paused thats why. Something that pauses the game is the top bar.
#267
So setting to /MT where Snarky explained, and getting it compiled under VS2008 solved both issues, marking this as solved. I feel really bad cause each time you suggest one thing first post, we do like 10 posts of dicking around, was the first post all along <3
#268
We got it working boys <3

edit: So what I changed was setting it to /MT (i sent the wrong file to the guy testing it) and all is well.
#269
http://primordia-game.com/Files0/Strangelando/agswavev5.rar

This is the 'proper' version of it (compiled with VS 2008) and the one we tested for the log above
#270
Adventure Game Studio v3.4 Interpreter
Copyright (c) 1999-2011 Chris Jones and 2011-2018 others
ACI version 3.4.1.15

Installing exception handler
Initializing allegro
Initializing game data
Looking for the game data file
Located game data file: d:/THEWRE~1/NEWBUI~1/14/STRANG~1.EXE
Opened game data file: game28.dta
Game data version: 49
Compiled with: 3.4.1.15
Setting up game configuration
Setting up window
Initializing TTF renderer
Initializing mouse: number of buttons reported is 8
Checking memory
Data directory: d:/THEWRE~1/NEWBUI~1/14
Initializing audio vox
Audio vox found and initialized.
Initializing keyboard
Install timer
Initialize sound drivers
Sound settings: digital driver ID: 'AXA ' (0x41584120), MIDI driver ID: 'Auto' (0xffffffff)
Installed digital driver ID: 'AXA ' (0x41584120), MIDI driver ID: 'W32M' (0x5733324d)
Install exit handler
Initialize path finder library
Load game data
Game GUI version: 118
Requested script API: v3.4.1 (5), compat level: v3.4.0 (4)
Built library path: agswaves.dll
Plugin loading failed, trying built-in plugins...
No built-in plugin found. Plugin loading failed!
No placeholder functions for the plugin 'agswaves' found. The game might fail to load.
#271
I did set it to MT and it returned the same error. I will ask, it's not on my computer, so I'm talking with the artist, and trying to figure out stuff.

Working on getting that log for you.
#272
The only reason it needed that dll was because I originally had it built it on VS 2010, I made a new project on VS 2008 and recompiled it, so it doesn't need the 2010s distributables, unfortunately the link error remains. Alright trying your other suggestion tho.

Edit: Same error.
#273
@CrimsonWizard:
The dll works fine on my windows 8 pc, with no issues whatsoever.

I set it to "Release" now. Also the Error 1 is fixed, it came up initially, but compiling it under Visual Studio 2008 fixed it. But Error 2 has been present since the start. Could it be a lack of a NET Framework?


@Snarky:
Multi-threaded DLL <- this is where it's set.
#274
So apparently 2/3rds of the Primordia squad, are using WINDOWS 7. I compiled a plugin recently, and I send the files over and they had two errors.
Error 1:
MSCVR100d.dll is missing

and
Error 2: Script link failed: Runtime error: unresolved import 'DrawScreenEffect'

(That is a custom function of the plugin).

Anyhows, so Error 1, has been fixed I recompiled the plugin with Visual Studio 08, but Error 2 remains, I thought maybe I should rebuild all files of the game, and reupload, which is what I'm in the process of doing. I don't mind sharing the plugin, and/or it's full code.

http://primordia-game.com/Files0/agswavev2.rar

In fact here it is.

Code: AGS



#ifdef WIN32
#define WINDOWS_VERSION
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma warning(disable : 4244)
#endif

#if !defined(BUILTIN_PLUGINS)
#define THIS_IS_THE_PLUGIN
#endif

#include <stdlib.h>
#include <stdio.h>
//#include <string.h>
//#include <math.h>
//#include <stdint.h>

#if defined(PSP_VERSION)
#include <pspsdk.h>
#include <pspmath.h>
#include <pspdisplay.h>
#define sin(x) vfpu_sinf(x)
#endif

#include "plugin/agsplugin.h"

#if defined(BUILTIN_PLUGINS)
namespace agswave {
#endif

#if defined(__GNUC__)
inline unsigned long _blender_alpha16_bgr(unsigned long y) __attribute__((always_inline));
inline void calc_x_n(unsigned long bla) __attribute__((always_inline));
#endif

const unsigned int Magic = 0xBABE0000;
const unsigned int Version = 1;
const unsigned int SaveMagic = Magic + Version;
const float PI = 3.14159265f;

int screen_width = 640;
int screen_height = 360;
int screen_color_depth = 32;

IAGSEngine* engine;



// Imported script functions



int dY=0;
int tDy=0;
int direction=0;

void CastWave(int delayMax, int PixelsWide)
{
  tDy++;
  if (tDy >delayMax)
  {
    tDy=0;
    if (direction==0) dY++;
	if (direction==1) dY--;
	if ( (dY>PixelsWide && direction==0) || (dY<-PixelsWide && direction==1) ) 
	{
		if (direction==0){dY=PixelsWide;direction=1;}
		else {dY=-PixelsWide;direction=0;}
	}
  }


}





void DrawEffect(int sprite_a,int sprite_b,int id)
{
  int x, y;
  
  BITMAP* src_a = engine->GetSpriteGraphic(sprite_a);
  BITMAP* src_b = engine->GetSpriteGraphic(sprite_b);

  unsigned int** pixel_a = (unsigned int**)engine->GetRawBitmapSurface(src_a);
  unsigned int** pixel_b = (unsigned int**)engine->GetRawBitmapSurface(src_b);

  for (y = 0; y < screen_height; y++)
  {
    if (id==0) CastWave(2,1);
	if (id==1) CastWave(15,1);
	
    for (x = 0; x < screen_width; x++)
    {
	  unsigned int colorfromB = pixel_b[y][x];
	  int getX=x;
	  int getY=y;

	  if (id==0)
	  {
	  	  getX=x-(rand() % 2)-2;
		  getY=y+dY;
	  }
	  if (id==1)
	  {
	  	  getX=x;
		  getY=y+dY;
	  }
	  if (getX < 0) getX=0;
	  if (getX > screen_width-1) getX = screen_width-1;
	  if (getY > screen_height-1) getY = screen_height-1;
	  if (getY < 0) getY = 0;
	  

	  pixel_a[getY][getX]=colorfromB;	  //
    }
  }
  engine->ReleaseBitmapSurface(src_a);
  engine->ReleaseBitmapSurface(src_b);

}


void RestoreGame(FILE* file)
{
  unsigned int Position = ftell(file);
  unsigned int DataSize;

  unsigned int SaveVersion = 0;
  fread(&SaveVersion, 4, 1, file);

  if (SaveVersion == SaveMagic)
  {
    fread(&DataSize, 4, 1, file);

    // Current version
   

    //fread(&g_DarknessLightLevel, 4, 1, file);
    
        
  }
  else if ((SaveVersion & 0xFFFF0000) == Magic)
  {
    // Unsupported version, skip it
    DataSize = 0;
    fread(&DataSize, 4, 1, file);

    fseek(file, Position + DataSize - 8, SEEK_SET);
  }
  else
  {
    // Unknown data, loading might fail but we cannot help it
    fseek(file, Position, SEEK_SET);
  }
}


void SaveGame(FILE* file)
{
  unsigned int StartPosition = ftell(file);

  fwrite(&SaveMagic, 4, 1, file);
  fwrite(&StartPosition, 4, 1, file); // Update later with the correct size


  //fwrite(&g_DarknessLightLevel, 4, 1, file);
  

  unsigned int EndPosition = ftell(file);
  unsigned int SaveSize = EndPosition - StartPosition;
  fseek(file, StartPosition + 4, SEEK_SET);
  fwrite(&SaveSize, 4, 1, file);

  fseek(file, EndPosition, SEEK_SET);
}


// ********************************************
// ************  AGS Interface  ***************
// ********************************************


void DrawScreenEffect(int sprite,int sprite_prev,int ide)
{	
	DrawEffect(sprite,sprite_prev,ide);
}

void AGS_EngineStartup(IAGSEngine *lpEngine)
{
  engine = lpEngine;
  
  if (engine->version < 13) 
    engine->AbortGame("Engine interface is too old, need newer version of AGS.");

 
  engine->RegisterScriptFunction("DrawScreenEffect", (void*)&DrawScreenEffect);

 
  
  engine->RequestEventHook(AGSE_PREGUIDRAW);
  engine->RequestEventHook(AGSE_PRESCREENDRAW);

#if defined(PSP_VERSION) || defined(ANDROID_VERSION) || defined(IOS_VERSION)
  engine->RequestEventHook(AGSE_SAVEGAME);
  engine->RequestEventHook(AGSE_RESTOREGAME);
#endif
}

void AGS_EngineShutdown()
{

}

int AGS_EngineOnEvent(int event, int data)
{
  if (event == AGSE_PREGUIDRAW)
  {
	 // WindEffect(g_Fx,g_Fy,g_Trans,g_RW,g_RH);
	  /*
    BITMAP* screen = engine->GetVirtualScreen();
	BITMAP* ParticleGraph = engine->GetSpriteGraphic(4322);
	//engine->BlitBitmap (100, 100, ParticleGraph, 0);
	engine->BlitSpriteTranslucent(100, 100, ParticleGraph,50);
	engine->ReleaseBitmapSurface(screen);
	//engine->MarkRegionDirty(0,0,screen_width,screen_height);
	engine->SetVirtualScreen(screen);*/
  }
  #if defined(PSP_VERSION) || defined(ANDROID_VERSION) || defined(IOS_VERSION)
  else if (event == AGSE_RESTOREGAME)
  {
    RestoreGame((FILE*)data);
  }
  else if (event == AGSE_SAVEGAME)
  {
    SaveGame((FILE*)data);
  }
#endif
  else if (event == AGSE_PRESCREENDRAW)
  {
    // Get screen size once here.
    //engine->GetScreenDimensions(&screen_width, &screen_height, &screen_color_depth);
	engine->UnrequestEventHook(AGSE_SAVEGAME);
	engine->UnrequestEventHook(AGSE_RESTOREGAME);
  }
  return 0;
}

int AGS_EngineDebugHook(const char *scriptName, int lineNum, int reserved)
{
  return 0;
}

void AGS_EngineInitGfx(const char *driverID, void *data)
{
}



#if defined(WINDOWS_VERSION) && !defined(BUILTIN_PLUGINS)

// ********************************************
// ***********  Editor Interface  *************
// ********************************************
//AGSFlashlight
const char* scriptHeader =
  "import void DrawScreenEffect(int sprite,int sprite_prev,int ide);\r\n";


IAGSEditor* editor;


LPCSTR AGS_GetPluginName(void)
{
  // Return the plugin description
  return "AGSWave";
}

int  AGS_EditorStartup(IAGSEditor* lpEditor)
{
  // User has checked the plugin to use it in their game

  // If it's an earlier version than what we need, abort.
  if (lpEditor->version < 1)
    return -1;

  editor = lpEditor;
  editor->RegisterScriptHeader(scriptHeader);

  // Return 0 to indicate success
  return 0;
}

void AGS_EditorShutdown()
{
  // User has un-checked the plugin from their game
  editor->UnregisterScriptHeader(scriptHeader);
}

void AGS_EditorProperties(HWND parent)
{
  // User has chosen to view the Properties of the plugin
  // We could load up an options dialog or something here instead
  MessageBoxA(parent, "AGSWave", "About", MB_OK | MB_ICONINFORMATION);
}

int AGS_EditorSaveGame(char* buffer, int bufsize)
{
  // We don't want to save any persistent data
  return 0;
}

void AGS_EditorLoadGame(char* buffer, int bufsize)
{
  // Nothing to load for this plugin
}

#endif


#if defined(BUILTIN_PLUGINS)
} // namespace agswave
#endif



I'm using 3.4.1 version of AGS
#275
Well, my issues with my code is i wanted to do a rectangle then i thought why not a circle, then proceeded to circle the rectangle instead of drawing a circle lol, also wow that is almost the exact same effect!
#276
It is the iterations, Steve is doing way less of those.
#277
what a bastard, that's amazing, really nice idea on solving the thing with the circle from your previous post!
#278
If anybody ever wants just someone to talk to, pm me here, okay? We all feel down sometimes, I think it's important to know there's someone out there who cares to listen, so, here, I care.
#279
Sorry for the necro, as you know I've coded a plugin yay, I'd like to share it's code - some of it is kind of hard coded (I can't seem to figure out a way not to have it so), so I'm not sure it's gonna be useful to others - to make it portable, is there a way I can ensure that on my own? Again, I don't mind sharing it at all.
#280
AGS Games in Production / Re: Strangeland
Thu 14/02/2019 16:19:42
Holy shit, we're updating this very slowly, gonna try and share stuffsies then!



Here's a video that showcases:

[1] Text Animations
[2] Custom Dialog Options
[3] Wave distortion plugin.


It's a bit wip, but I figured I'd share anyways <3
SMF spam blocked by CleanTalk