AGS 3.1.0 Final - World's Heaviest Bridegroom Edition

Started by Pumaman, Sat 05/07/2008 23:21:19

Previous topic - Next topic

Shane 'ProgZmax' Stevens

Quote
The only way I seem to be able to stop it doing this is to enable full-screen anti-aliasing, but obviously that then gives an effect that a lot of people wouldn't want being applied to their pixel art.
Unfortunately this seems to scupper any possibility of running D3D games at higher resolutions, which leaves us in the rather awkward position where a 320x200 game could basically be unplayable full-screen on 99% of PCs...

Hmm, that does rather suck, though it doesn't really harm any 2d ags games to stick with ddraw.

Thanks for giving it a look, anyway.

Dualnames

Quote from: ProgZmax on Sat 06/09/2008 14:32:35
Quote
The only way I seem to be able to stop it doing this is to enable full-screen anti-aliasing, but obviously that then gives an effect that a lot of people wouldn't want being applied to their pixel art.
Unfortunately this seems to scupper any possibility of running D3D games at higher resolutions, which leaves us in the rather awkward position where a 320x200 game could basically be unplayable full-screen on 99% of PCs...

Hmm, that does rather suck, though it doesn't really harm any 2d ags games to stick with ddraw.

Thanks for giving it a look, anyway.


It's a good thing to notice, I think this should be added as a note in the manual section of d3d. So authors can put it in the readme and/or know what to do if they recieve a pm/mail.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

RickJ

Quote
Quote
1.  The manual seems to describe an earlier version of game abort.  It's a minor issue but I thought you would like to know anyway.   
What do you mean? It seems ok to me.
I was referring to the bit about the call stack and no mention of the script editor opening on the offending line.  But since the stack dump is going to be added back then I guess what's there is fine as you say.

Quote
Quote
2.  It's pretty slick how it now opens the editor on the line where AbortGame() is executed.   This is perfect when executed in a Room or Global script.  It would also be useful if AbortGame had an option to open the script where the call is made to the function containing the AbortGame statement.  A module designer could use this option to call attention to incorrect usage in the module's users room and/global scripts rather than to the module code that detected the problem.   It's perhaps something to think about though...

Well, what I do want to do is add support for the editor to display the call stack and let you browse through it, which would address that. Not sure which version that might make it into, though.
That of course would be very useful and necessary.  I don't mean to belabor the point here but would like to take the opportunity to clarify my previous comments.   Suppose the example function given in the manual was part of a module and it was called from a room script as shown below.

Module Script
Code: ags

function SomeModule::MakeWider(int newWidth) {
  if (newWidth < 10)
    AbortGame("newWidth expects a width of at least 10!");
}


Room Script
Code: ags

function SomeFunction() {
   SomeModule.MakeWider(20);
}


If the same person wrote the module and the room script then having the module script open and a stack dump isn't really a problem since the author will immediately recognize the module's code, would have an idea of what just happened, and would be able easily follow the stack dump to where the problem actually is.   If the module is adequately complex and is written by someone other than the game author then receiving the abort message and being directed to the innards of a complicated module could be more confusing than helpful (depending upon the game author's level scripting ability and experience).

My only point is that it would really be slick and cool if the module author had the ability specify that that particular AbortGame() open the script where the function is called from rather than where the function is defined.  In this example the room script is where the problem is and where one needs to go to fix it. For this particular example this will always be the case.   I think this situation is more common than not.   Perhaps when you get around to implementing the stack dump you may discover an easy way of adding this feature as well, but I'll leave that up to your good judgment as always. ;)

RickJ

Problem using optional parameters??

I can't seem to set an optional int parameter value to less than -31999 or greater than 32000.  I get the following error
Code: ags

Failed to save room room0.crm; details below
Thread.ash(152): Error (line 152): default parameter out of range


Line 152:  import function ThreadVar(short vx, int value = -32000);

Is this normal or a bug?  There is  nothing in the manual mentioned about it? 

Gilbert


Pumaman

QuoteHmm, that does rather suck, though it doesn't really harm any 2d ags games to stick with ddraw.

I've been doing some more investigation of this and as it turns out it is actually possible to get it working properly, it's to do with the pixel-texel mapping in D3D. So hopefully I should be able to put in a fix after all.

QuoteThat of course would be very useful and necessary.  I don't mean to belabor the point here but would like to take the opportunity to clarify my previous comments.   Suppose the example function given in the manual was part of a module and it was called from a room script as shown below.

Your point seems quite reasonable, I'll have a think about it when I get around to implementing the call stack.

QuoteI can't seem to set an optional int parameter value to less than -31999 or greater than 32000.  I get the following error

As Gilbot says this is by design, it's because optional parameters are an unofficial feature that were never designed to be used in custom scripts; had they been then the range would have been 32-bit.

RickJ

#126
Quote
As Gilbot says this is by design, it's because optional parameters are an unofficial feature that were never designed to be used in custom scripts; had they been then the range would have been 32-bit.
Fair enough.  I have figured a way round ;)   and I'm sorry for mucking up this trhread with such twitter.

I had the same need as Monsieur OUXX in the thread Gilbot posted, a null value for an int/short to determine if the parameter was specifed or not rather than using it to get a default value that would actually be used for something..  Thanks Gilbot, CJ...

Quote
The problem you're reporting seems to be specific to running under WINE, and the only way for me to get around it seems to be to basically ignore any errors that occur when getting a directory listing. This isn't something I want to do, because potentially important errors could end up getting ignored as a result.
I'm actually running under Windows 2000 virtual machine in VirtualBox on Kubuntu 8.04.   The current beta works splendidly in this environment as long as I keep everything on the virtual c: drive. 

VirtualBox uses a network mapped drive as a means of sharing files between Linux and Windows.   Files stored on such drives are accessible to both linux and windows applications while files on the virtual C: drive are accessible only from the windows virtual machine.   The virtual c: drive is just one massive file that exists on the linux partition.  I am not comfortable  keeping all my source files on C: because if something should ever happen to the virtual machine or to virtualbox  it could mean curtains for my bits.   If everything were accessible from the linux side then it would be a simple to have linux periodically make secure backups of everything on other machines in the house and this is why I am so interested in getting this to somehow work. 

Anyway with regard to your comments about this,  do you suppose that these problems are the result of some code or library that is common to both  VirtualBox and Wine or to some quirks, differences, or compatibility issues between windows and linux.   If it's something that could be fixed on the virtualbox end perhaps it would be worth passing on a description of the problem to the virtualbox folks and asking them to fix it or to suggest an alternative solution.   

Is there any possibility of having an experimental build that would  dump the errors and any other useful info into a file or something?  I would be glad to run any such experiments on my machine and gather the resulting data if that would that would be helpful in any way?   What do you think?

Dusk

Quote from: RickJ on Tue 09/09/2008 08:37:31
I'm actually running under Windows 2000 virtual machine in VirtualBox on Kubuntu 8.04.   The current beta works splendidly in this environment as long as I keep everything on the virtual c: drive. 

VirtualBox uses a network mapped drive as a means of sharing files between Linux and Windows.   Files stored on such drives are accessible to both linux and windows applications while files on the virtual C: drive are accessible only from the windows virtual machine.   The virtual c: drive is just one massive file that exists on the linux partition.  I am not comfortable  keeping all my source files on C: because if something should ever happen to the virtual machine or to virtualbox  it could mean curtains for my bits.   If everything were accessible from the linux side then it would be a simple to have linux periodically make secure backups of everything on other machines in the house and this is why I am so interested in getting this to somehow work. 

Have you tried sharing the game folder on C: and accessing it through samba from Linux?
This is what I've been doing with VMware from a long time ago (now I think there's some automatic feature to share stuff with the host system, but I've never tried it).
Another interesting setup I use at work to backup stuff on the network involves rsync for windows and backuppc on a linux server that automatically, periodically, gets stuff from computers on the network (VMs too) and does full/incremental backups. You might be interested. :)
I suppose that as long as you don't use particular features of VirtualBox but the Windows file sharing or rsync, all should work.

GarageGothic

Quote from: Pumaman on Sun 07/09/2008 20:23:22
QuoteI can't seem to set an optional int parameter value to less than -31999 or greater than 32000.  I get the following error

As Gilbot says this is by design, it's because optional parameters are an unofficial feature that were never designed to be used in custom scripts; had they been then the range would have been 32-bit.

Related to this, I'm curious if there is a proper procedure for setting default values for optional floats? It seems that optional parameters can't have any decimals but must be provided as ints. When I put an int default value for a float, it seems to accept it. However, when I try to display the value of the float afterwards, all I get is garbage characters. I managed to get it working for a function with nine optional float parameters, but only because it sets a default value of 31999 and the function only checks whether the parameter value is smaller than this (if not, it's ignored). Can I count on this method working consistently, or is it just a fluke that it does? Is there truly no way to set a float parameter to, for instance, 1.0 if the player doesn't input one himself?


RickJ

Thanks Dusk.  I have already tried Samba as you suggest and haven't been able to get that to work with virtualbox.   The problem with your other suggestion is that the windows VM may not be running all the time and so any backups it is scheduled to do may not happen when they are supposed to. 

Just to clarify my point a bit more:  The AGS editor, itself,  is able to navigate to the network drive and get a directory listing when doing an open operation or importing resources.  I am able to get a directory listing from the windows command prompt and using the windows file manager.   The other windows applications I have installed seem able to use the network drive without any problems.   The previously encountered and insurmountable problems encountered using WINE would appear to not exist because WINE isn't being used (unless of course if there is a common library or code base).   If AGS were able to build/run games residing on a network drive then it would be fully integrated with linux and work just like any other application in linux, windows, or virtual os hosted on my machine.   I would be willing to help conduct tests so as to collect debug information so that we may have a better understanding of what is  actually going on.  I would be willing to try an experimental build that ignored some or all the directory listing errors to determine what the practical consequences are.   I am curious as to the nature of the directory listing errors and what code was executed to generate them.  Perhaps there is another way of performing a directory lookup without getting errors.   

Sorry for being long winded but just to be clear I haven't posted in this thread to ask for help creating a cumbersome and/or complicated workaround, although Dusk, your ideas and comments are greatly appreciated.   I am posting here to provide CJ with  a clear explanation of the problems I have encountered using AGS, why I think they are important, and what advantages/disadvantages they were fixed/not fixed, so that he is able to make intelligent decisions about he wants to take AGS.  Peace everyone ;) ...

monkey0506

I seemed to recall that you could have a member function which returned a dynamic array. Now I get an error. It works fine for normal functions. Was I hallucinating about this or has this behavior changed?

Dusk

Quote from: RickJ on Tue 09/09/2008 20:41:49
Sorry for being long winded but just to be clear I haven't posted in this thread to ask for help creating a cumbersome and/or complicated workaround, although Dusk, your ideas and comments are greatly appreciated.   I am posting here to provide CJ with  a clear explanation of the problems I have encountered using AGS, why I think they are important, and what advantages/disadvantages they were fixed/not fixed, so that he is able to make intelligent decisions about he wants to take AGS.  Peace everyone ;) ...

Oh sure (peace! :D), I totally agree with you that solving the issue at the basis (the AGS directory listing code) is the best thing. But I can see that this fix might be low priority for CJ, regarding just a few users that work in particular environments, so maybe finding (not too complex) workarounds would not be that bad. I'm recently using Windows more than Linux just for AGS, and that's why I'm particularly interested in your tests (unfortunately I haven't time to actively partecipate trying something myself in these days).
About the backup scheduling thing, you might find useful to know (also not referring to this particular issue), that backuppc is designed to work in environments where machines aren't always on: for example, you can configure it to check each hour if a machine is up and backup it only after its previous backup has exceeded the one day age. By the way, if you tried to access with plain samba a shared folder on C: and it didn't work, I suppose that the same would occur with rsync (some virtual network issues of virtualbox maybe... you might want to portscan the VM to check that samba/rsync are properly listening from connections from the host machine).

Just another two cents of mine, :D
D.

Pumaman

QuoteAnyway with regard to your comments about this,  do you suppose that these problems are the result of some code or library that is common to both  VirtualBox and Wine or to some quirks, differences, or compatibility issues between windows and linux.   If it's something that could be fixed on the virtualbox end perhaps it would be worth passing on a description of the problem to the virtualbox folks and asking them to fix it or to suggest an alternative solution

The problem is that it's hard to tell where the problem lies. The error thrown is an internal .NET Framework error so the problem could be:
1. A bug in the .NET Framework when running in VirtualBox
2. A bug in Windows when running on VirtualBox that returns an invalid error code
3. A bug in the VirtualBox network/mapped drive driver, that returns an unexpected error code
4. Any/all of the above

so it's pretty hard to try and track this down.

Quote
Related to this, I'm curious if there is a proper procedure for setting default values for optional floats?

No, optional floats are not supported. Floats are 32-bit, and because the optional parameter default values are stored as 16-bit numbers this won't map properly to a float and the results will be unpredictable.

When I finally get around to rewriting the script compiler, I'll make sure that features like optional parameters are properly built in from the start and supported, but until then you can always use the workaround of creating two functions:

function MyFunction(float someValue) {
...
}

function MyFunctionDefault()
{
  MyFunction( PUT DEFAULT VALUE HERE );
}

A bit messy but it works!!

GarageGothic

Quote from: Pumaman on Wed 10/09/2008 18:50:39No, optional floats are not supported. Floats are 32-bit, and because the optional parameter default values are stored as 16-bit numbers this won't map properly to a float and the results will be unpredictable.

Ok, thanks for clarifying. For now my code seems to work since it doesn't actually use the default for anything except checking whether the player has entered a value or not.

Quotebut until then you can always use the workaround of creating two functions [...]
A bit messy but it works!!

In my case a bit too messy, I'm afraid. My function returns the maximum value out of nine optional float parameters, so MaxFloatValue(float value1, float value2, float value3,  float value4, float value5, float value6, float value7, float value8, float value9) would have to be broken into 8 different functions. If I find that the optional floats cause problems, I'll just create an initial int parameter to specify how many floats to compare.

I also have a question: Is there any way to modify a String using an extender function? Whenever I try to set "this = "blablabla", I'm told that it's a static pointer. I ask because I'm writing a linebreaking function, which I would like to return the first line of the broken String and update the original String to contain the remaining text, but it doesn't seem to be possible.

monkey0506

Quote from: GarageGothic on Wed 10/09/2008 19:08:42My function returns the maximum value out of nine optional float parameters

You could use a dynamic array to do this:

Code: ags
float fmax(float farr[], int size) {
  if ((farr == null) || (size <= 0)) return 0.0; // or whatever you use as your "null" value for floats
  int i = 1;
  float fm = farr[0];
  while (i < size) {
    if (farr[i] > fm) fm = farr[i];
    i++;
  }
  return fm;
}

float farr[] = new float[5];
farr[0] = 1.8;
farr[1] = 9.76;
farr[2] = 3.14;
farr[3] = 5.0;
farr[4] = 4.52;
fm = fmax(farr, 5);

GarageGothic

Thanks for the suggestion, monkey. The point of the functions was mainly to reduce the number of lines in the rest of the script (mostly I never call it on more than two or three values at a time anyway), and initializing the array gets messy. If your function needs to know the size of the array anyway, I might as well just add the number of floats parameter to the beginning of my function to avoid trouble.

monkey0506

Well there's currently no way to get the size of a dynamic array. Other than that it's only one line more (in the caller function) to use an array versus regular float variables. Though you have a fair point. Sorry it didn't work out. Good luck with whatever you're doing. ;)

Pumaman

Quote from: GarageGothic on Wed 10/09/2008 19:08:42
I also have a question: Is there any way to modify a String using an extender function? Whenever I try to set "this = "blablabla", I'm told that it's a static pointer. I ask because I'm writing a linebreaking function, which I would like to return the first line of the broken String and update the original String to contain the remaining text, but it doesn't seem to be possible.

You should be able to use String extender functions, but remember that you can't modify the contents of a string. That's why all the built-in functions like Replace and LowerCase return a new copy of the string with the requested changes.

GarageGothic

Quoteremember that you can't modify the contents of a string

Thanks, this is what I wanted confirmed. I'll just have the linebreak function return the index position of the linebreak instead and perform the splitting of the String in the calling function.

Pumaman

Ok, beta 8 is now up. This fixes the stretched pixels with D3D, adds graphic filters for D3D and a script call stack.

I think this is about as much as I want to add to 3.1 now, so the next release will probably be RC1.
Please give the native co-ordinate stuff a go and let me know of any outstanding problems.

SMF spam blocked by CleanTalk