Jibble

Author Topic: Bunch more SUGGESTIONs  (Read 6285 times)

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #20 on: 03 Feb 2005, 10:40 »
Here's an idea: all games imported into the version that first implements lazy eval have their scripts converted so that all && and || become &&& and ||| (maybe this could be optional, with a dialog saying Yes or No to that conmversion and that the user back-up their game so that if it doesnt work with lazy eval then they can restore it). Then && and || are changed to match their C behaviour of lazy eval, but &&& and ||| exist in case someone wants or needs to have the old behaviour...

That keeps compatibility, but also allows the best behaviour going forward. Lazy eval would also improve game performance a little, I guess, too...

And CJ, you didn't respond to my const, preprocessor and forum suggestions...  :'(


Scorpiorus

  • 100101101010b
    • Scorpiorus worked on one or more games that won an AGS Award!
    •  
    • Scorpiorus worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #21 on: 03 Feb 2005, 17:48 »
Yep, an option would be nice. I'm not sure if there is a real need to introduce "new operators" (though I'd find them handy for certain tasks) since I believe their current strict behaviour can be simulated (to a certain degree) with '+' and '*' operators, which I'm going to replace '&&' with in "several" places, to ensure the assertion-handling mechanism I implemented will be working properly when a script compiled with a future version of AGS. :)

Re: Bunch more SUGGESTIONs
« Reply #22 on: 20 Feb 2005, 21:07 »
Firstly, yes this whole issue is because AGS does not do lazy evaluation on && and ||. (while it's called lazy, it's actually more complicated since the compiler would need to check the first side and generate JUMP instructions depending on the result).

And yes, it's something I would like to fix to make it behave in common with C, especially as you point out, statements like this will become more common and should be valid:

if ((ptr != null) && (ptr.ID > 0))

Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=509

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #23 on: 23 Aug 2005, 03:30 »
Sorry to dig up this old thread... (well, kind of sorry). :=

Here's an example of some code that's incredibly ugly without lazy evaluation (found while writing ags3d...)

Code: [Select]
while (j > numToDrawUnsorted && ShouldSwapPrims(pzj, pzi))
{
  // blah blah
  j--;
}

The solution is:

Code: [Select]
bool swap = ShouldSwapPrims(pzj, pzi);
while (j > numToDrawUnsorted && swap)
{
  // blah blah
  j--;
  if (j > numToDrawUnsorted)
  {
    swap = ShouldSwapPrims(pzj, pzi);
  }
}

ShouldSwapPrims is a very expensive function that shouldn't be called more than is necessary...
Yuck!
Still waiting for Purity of the Surf II

Gilbert

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
Re: Bunch more SUGGESTIONs
« Reply #24 on: 23 Aug 2005, 11:24 »
Though that function is expensive, I think your solution calls that function more or less the same number of times compared to using lazy evaluation already (maybe once more sometimes I guess), and I don't find it ugly.

Maybe you can do this like below to even free if from that possibly extra call?

Code: [Select]
bool swap = true;
while (j > numToDrawUnsorted && swap)
{
    swap = ShouldSwapPrims(pzj, pzi);
    //Something to update pzj, pzi here?
    j--;
}
if (j==numToDrawUnsorted) swap = ShouldSwapPrims(pzj, pzi); //if you need to call this once more to get the correct index, otherwise not required

Edmundito

  • Mittens Serf
  • Just tween it.
    • Best Innovation Award Winner 2014, for 'Tween Module'
    • Edmundito worked on one or more games that won an AGS Award!
    •  
    • Edmundito worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #25 on: 28 Aug 2005, 17:26 »
You know I'm obsessed with UI and such, and I thought of these looks for AGS the other day:




Basically is for it to have more of an Outlook 2003 look where the lists are placed to the panel and also remove te frame that gives the name of the section and just have that section highlighted. This way there is a lot more "real state" around the working area....

Of course, I'd like to have things like general settings and the palette editor moved to actual dialog screens, but that's just a whole other suggestion.
The Tween Module now supports AGS 3.5.0!

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re: Bunch more SUGGESTIONs
« Reply #26 on: 28 Aug 2005, 17:31 »
No offense, but... ugh. Me no likey that look at all.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #27 on: 28 Aug 2005, 18:11 »
I could give or take the borders to the panels on the left. I think they look nice but they clash with the other buttons on the right.
I like the layout, but what happens when you run out of room for, err, rooms?
It's not like we're generally hurting for screen real estate anyway. I never run AGS maximised.
And what is wrong with the general settings the way they are? This way you can make a change and instantly press Ctrl-T. If you put it in a dialog you'd have to perform the additional step of accepting the changes.

Things I'd find useful:
 - the room menu always available (so that Ctrl-I and Ctrl-E work from anywhere)
 - a quicker way of starting to script interactions (perhaps an option on the right click menu to avoid the whole New Interaction/Run Script/Edit Script malarkey).
 - also, a way to get straight to the script/header of a module under development would be good. Perhaps we could have a checkbox that marks the module as under development, and then some menu items and shortcut keys to go to the code.
« Last Edit: 28 Aug 2005, 18:18 by SteveMcCrea »
Still waiting for Purity of the Surf II

That Guy

  • Narf!@
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with web design
Re: Bunch more SUGGESTIONs
« Reply #28 on: 31 Aug 2005, 00:51 »
Gents,

I would like to mention, although I'm not sure how much bearing it has on the topic at hand, that Java (and J2ME, which is what I'm currently working in) does not perform "lazy" evaluation, either.

I was reminded of it reading this because one of our junior programmers was having trouble reproducing a bug in his game and had it traced to a line that read;

Code: [Select]
while ((list != null) && (list [x] != "some value"))
   doSomething();

And when I pointed out to him that the second list-sub-x test was causing the NullPointerException error QA was reporting, he went off on a tirade about how "that sort of thing works in C, I know it does!", forcing me to tackle him to the carpet and beat him into submission with my coffee mug.  When he calmed down, I mentioned to him that whether it "works" or not is irrelevant, because it made little sense from a logical point of view; you have no business testing an item in an array if the array itself may be null.

I advised him to restructure his code as such;

Code: [Select]
if (list != null)
   if (list[x] != "some value")
      doSomething();

Which, of course, made it work.  As Java was designed to avoid some of the common pitfalls of C coding conventions, I thought it would be relevant to mention that it doesn't do "lazy" evals.

Regards,
TG
« Last Edit: 31 Aug 2005, 00:53 by That Guy »

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #29 on: 31 Aug 2005, 01:05 »
Java definitely has short circuit evaluation. I've written plenty of Java and I'd have run into problems if it didn't. See here:
http://java.sun.com/developer/JDCTechTips/2002/tt1105.html#2
As for J2ME, oh dear. That sucks.
Still waiting for Purity of the Surf II

That Guy

  • Narf!@
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with web design
Re: Bunch more SUGGESTIONs
« Reply #30 on: 31 Aug 2005, 01:41 »
yikes.  good catch.  As J2ME deviates so little from Java I'd have expected them to be identical in this case.  I know it's an issue in J2ME, 'cause it's bit us in the butts several times over the last few years.  ;D

Never mind then, carry on.

Edmundito

  • Mittens Serf
  • Just tween it.
    • Best Innovation Award Winner 2014, for 'Tween Module'
    • Edmundito worked on one or more games that won an AGS Award!
    •  
    • Edmundito worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #31 on: 15 Oct 2005, 21:58 »
This is just another random suggestion, so I didn't want to start a new topic...

Let's say I have 4 characters, and I want to change their names to Pepe. Well, currently it's a bit tricky on AGS to do that because if you go to character[5], apparently, it returns some sort of memory addres and I guess it goes up to AGS_MAX_CHARACTERS.

So my suggestion would be for a way to check for it to set anything after the last character to null, that way one can just do something like:

short count = 0;
while(character[count] != nulll) {
  character[count].Name = "Pepe";
  count++;
}

Is that too much to ask?  :-[

And while we're on the topic of array, make the arrays a little more object-esque, so you could do:

int myarray[5];
int count = 0;
while (count < myarray.length) {
  myarray[count] = 0;
  count++;
}

and so on.
« Last Edit: 15 Oct 2005, 22:01 by Edmundo »
The Tween Module now supports AGS 3.5.0!

Re: Bunch more SUGGESTIONs
« Reply #32 on: 15 Oct 2005, 23:00 »
Can't you just check for GetGameParameter(GP_NUMCHARACTERS, 0, 0, 0)?

Edmundito

  • Mittens Serf
  • Just tween it.
    • Best Innovation Award Winner 2014, for 'Tween Module'
    • Edmundito worked on one or more games that won an AGS Award!
    •  
    • Edmundito worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #33 on: 15 Oct 2005, 23:33 »
I knew I should have looked under GetGameParamenter...  :=
The Tween Module now supports AGS 3.5.0!

Elliott Hird

  • what does this do??????
Re: Bunch more SUGGESTIONs
« Reply #34 on: 16 Oct 2005, 20:32 »
You know I'm obsessed with UI and such, and I thought of these looks for AGS the other day:
I like this much more than the suggestion in another thread. I really like the "modular" look it goes for, fits the scripting language with object-orientated scripting and all that.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #35 on: 16 Oct 2005, 20:37 »
Well it's actually pretty much the same thing, only on a larger scale.

Elliott Hird

  • what does this do??????
Re: Bunch more SUGGESTIONs
« Reply #36 on: 16 Oct 2005, 20:58 »
Well it's actually pretty much the same thing, only on a larger scale.
Actually, it's VERY different. Take a look at both.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #37 on: 16 Oct 2005, 22:18 »
It's not necessary to quote the post directly above you just FYI.

I'm not saying it's exactly the same thing, but it's similar, just like I said, on a much larger scale.

Akumayo

  • Is Watching You
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with scripting
    • I can help with story design
    • I can help with voice acting
    • Akumayo worked on one or more games that won an AGS Award!
    •  
    • Akumayo worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #38 on: 18 Oct 2005, 01:15 »
OOOOO OOO OOO, I have a suggestion!

PLEASE O' PLEASE CJ, make the Random function expanded.  Having only a maximum requires "if" and "else" functions just to run the desired result, here's an example of what I mean:

Code: [Select]
SetGlobalInt(1, Random(2));
if (GetGlobalInt(1)==0) {
 AddInventory(13);
 }
if (GetGlobalInt(1)==1) {
 AddInventory(14);
 }
if (GetGlobalInt(1)==2) {
 AddInventory(15);
 }

BUT if the Random was expanded to include:
Code: [Select]
Random(int min, int max);

Then you could simply run
Code: [Select]
AddInventory(Random(13, 15));

And get the same effect!!!
"Power is not a means - it is an end."

Edmundito

  • Mittens Serf
  • Just tween it.
    • Best Innovation Award Winner 2014, for 'Tween Module'
    • Edmundito worked on one or more games that won an AGS Award!
    •  
    • Edmundito worked on one or more games that was nominated for an AGS Award!
Re: Bunch more SUGGESTIONs
« Reply #39 on: 18 Oct 2005, 01:51 »
Oh, I'll fix that for you:

function RandomEx(int min, int max) {
  return Random(max - min) + min;
}


.. I think. Someone, please, confirm my idiocy.
The Tween Module now supports AGS 3.5.0!