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

#201
Im canadian and pronounce it "ah-bowt"...I have cousins in newfoundland though and they definitely pronounce it "a-boot"...sounds pretty silly that way actually.
#202
Man, I see! Ok I'll try both solutions and post what happens...it makes sense, very clever!
Thanks :)
#203
Hmm...well could it have something to do with the keyboard press sensitivity? The script calculates how long the key is pressed down, maybe different keyboards have different sensitivities and that's what's causing the turn-timing issuea on different computers?

Ill get a clip on youtube to show what's happening.
#204
Yeah, thats not really the problem. Everything works fine on my faster computer, but on my laptop the timing of the turning is "off". Ill try to see if I can find a different way of doing the turn. I still dont know why fps is messing with the timing script (shouldnt the turn just be donw slower on a slower maching?)
#206
AGS Games in Production / Re: Mythaumatology
Mon 28/05/2012 02:34:21
Those screens look great! I really like the map + atmostphere of the backgrounds.
#207
AGS Games in Production / Re: King's quest 4
Sun 27/05/2012 03:32:02
Wow, I really like the grass effect! If you dont mind me asking, how did you do it? Do you use 3ds max or Maya (or some other 3d package)...I always wondered how to render grass like that!
#208
Wow! Crap if only I could have used this before starting my project :P
#209
Actually having z-order for objects instead of baselines could be cool...or atleast offered along with baselines.
#210
Ok I tested the adjustment for 10 pixels...however its not working perfectly...I think Ive placed it in the wrong place, is that possible? If the car enters the boundary at the top of the lane, I found out that the adjustment should be 13 pixels, but if the car enters the boundary at the bottom of the lane, the value should be 10.

Did I make a mistake as to where to apply the adjustments "iXs" and "iYs" ?
Code: ags

bool InsideBounds_ISO(this Character*, int iX1, int iY1, int iX2, int iY2) //iMinX's vector (x,y) and iMax's vector(x,y)
{
  int iXs;
  int iYs;
  int iXp;
  int iYp;
  
  if (sCarDirection != "Null")
  {
    if (sCarDirection == "NW" || sCarDirection == "SE") //calibrate
    {
      iXs = -10;
      iYs = 10;
    }
    else if (sCarDirection == "SW")// || sCarDirection == "NE")
    {
      //Display("SW");
      iXs = -10;     //should be -13 at bottom of lane, -10 at top of  lane: investigate
      iYs = 10;
    }
    else // N,S,E,W  //calibrate
    {
      iXs = 10;
      iYs = -10;      
    }
    
    iXp = this.x + iXs; //if using 42x42 sprite car
    iYp = this.y + iYs; //if using 42x42 sprite car    
  }
  
  //String debug = String.Format("x: %d y: %d", iXp, iYp);
  //lblHotspot.Text = debug;  
  
  // d is vector from X1;Y1 to X2;Y2
  float dx = IntToFloat(iX2 - iX1), dy = IntToFloat(iY2 - iY1);
  // a is vector from X1;Y1 to top corner
  // b is vector from X1;Y1 to bottom corner  (a + b = d)
  float bx = (m*dx - dy)/(2.0*m);
  float ax = dx - bx;
  float ay = m * ax, by = -m * bx;
  // express character coords using a & b
  // p is vector from X1,Y1 to character
  float px = IntToFloat(iXp - iX1), py = IntToFloat(iYp - iY1);
  float det = ay*bx - ax*by;
  // p = k*a + l*b
  float k = (bx*py - by*px)/det;
  float l = (ay*px - ax*py)/det;
  // => if both k & l are inside [0;1], character is inside parallelogram
  return (k >= 0.0 && k <= 1.0 && l >= 0.0 && l <= 1.0);
}

#211
Not sure if this has been asked before or even possible:

1) The ability to lock an object in the room editor
2) The ability to change an object's Z depth (like buttons).
3) "Zoom To" object/character if the room is really large and you dont want to scroll around manually triyng to find it
4) Have the option to specify in "Preferences" the maximum number of objects per room (so people can plug in their own values)
#212
I think the reason I  get 98 is because I have photoshop opened...I believe  the same happens if AfterEffects or QuickTime is opened too, the fps goes up to like 98-100...I tested having various programs like that opened at the same time as AGS, and the FPS is increased majorly.

Well I could send a clip via youtube to show what Im doing if you wish (?)...let me know!

The player can "tap" the direction keys to rotate the car in 30º increments "a la police quest 1 EGA" (so to turn at an intersection you would have to tap the left or right keys multiple times depending on your direction...the faster you go though, the harder it is to tap the perfect amount to get a nice turn without hitting the borders)...to make it easier, I implemented a system that if you hold down the left or right keys for x amount of time, it will make "the perfect turn" for you, using the iTurnTimer (automatically turning the car in the right amount of degrees so the intersection is cleared perfectly)...so you can turn using both "tap" and "hold".
#213
Hi,

I have a script that seems to be dependant on the game's framerate, but not too sure if my solution to overcome this is a good idea. I placed this question in the "Advanced" section since Im guessing what you guys might suggest could be complicated, but Im not sure.

Basically what Im doing is if the user presses the left arrow key down for a certain amount of time, it calls a script that will turn the car in 30º increments. The values I use for the timer that tells when to stop the rotation has been set by me manually so that the car turns left perfectly at an intersection on an isometric map. The only thing is, I tested this script on two computers where the FPS is about 98, and everything works as it should...but on a laptop where the FPS is 35, the turning "mechanism" timers no longer seem to be "in sync" and the car rotates too much (therefore missing the intersection turn)...the various values for the timer (iTurnTimer) are no longer valid when the game runs at a lower FPS:

Code: ags

//in the driving map room.asc:
function on_key_press(int keycode)
{
     if (IsKeyPressed(375)) //LEFT TURN   
    {
      setTurnTimerValue(0);
      if (bLeftKeyHOLD == false) carDrive_LEFT(eManual, 0);
    }
}
// in my driving module:
void setTurnTimerValue(int iMode)
{
  if (iMode == 0) //Left
  {
    if (fDrive_Angle == 210.0 || fDrive_Angle == 30.0) iTurnTimer = 17; //NW or SE                 
    else if (fDrive_Angle == 330.0 || fDrive_Angle == 150.0) iTurnTimer = 20; //NE or SW                      
    else
    {
      iTurnTimer = 0;
      return;
    }  
  }                                       
}

function repeatedly_execute()
{
      if (!bAutomatic) //Manual
      {
        //TURN MANUAL
        if (IsKeyPressed(375)) processQuickTurn_Left(1);
        else 
        {
          iHoldKeyPressLeft = 0;
          if (bLeftKeyHOLD) bLeftKeyHOLD = false;
        }
}

#define KEYHOLD 15 //in the .ash 

void processQuickTurn_Left(int iMode)
{
  if (iMode == 1) //Manual
  {    
    if (iHoldKeyPressLeft >= KEYHOLD) 
    {
      if (!bLeftKeyHOLD) bLeftKeyHOLD = true;
      //value of iTurnTimer is set in the room, at "on_key_press"
      if (iHoldKeyPressLeft < iTurnTimer) 
      {
        rotateCar_TAP(-30.0);      //script that rotates the car by 30 degree increments
        iHoldKeyPressLeft++;
      }
    }
    iHoldKeyPressLeft++;
  }
}


As a solution I was thinking of using scorpiorus' script http://www.adventuregamestudio.co.uk/yabb/index.php?topic=42836.0 to detect the game's FPS, and if during the driving sequences the FPS drops to a certain amount, have the iTurnTimer values changed on the fly so that everything works as it should on slower computers.

Is that a good idea, or is there a better way?
#214
Wow looks great! The light-change animations in the background images are really cool mon!
#215
Hey Ryan,

Nah I tried commenting out the export part without any luck. Right now the only way I can hack my way to make it work is doing the drawing twice...but the thought of keeping backup copies of the map backgrounds (which are really big) until thep player decides to turn off the labels again is making me think maybe Ishould just do like I did in the beginning: making duplicates of the whole maps with labels drawn in photoshop and just switching the room's frames instead. That will double the amount maps I need to import and make the sprite file larger, but I guess its simpler and doesnt require rawdraw/keeping large maps in memory, etc...If I was a better coder or had more knowledge on all the rawdraw stuff maybe this wouldnt "worry me" but for now I think Ill put it aside...eeekk!!

So for now Ill just stick to doing this when the player wants to hide/show the labels:
SetBackgroundFrame(0); //map without labels
//or
SetBackgroundFrame(1); //map with labels
#216
@Monkey: Ok, I pm'd you :)

@Sephiroth:

Well at first thats what I thought too, but I then tested it on a smaller room (1024x768) and put it smack dab in the middle...same results. When I draw an overlay it works perfectly fine with the same coordinates...Maybe Ive got confilcting scripts somewhere, I hope not cause  that will be a nightmare debugging that!

Is there a possibility theres like a bug with the drawImage on background function itself?
#217
Ok, I tried your suggestion of not putting a "0", and it didnt change the results. :(

I then tried this in a different room (1024x768), a small png alpha sprite (54x44) :
Code: ags

//when a hotspot in the room is clicked on (to test):
  dsCurrentMap = Room.GetDrawingSurfaceForBackground();
  dsMapBackup = dsCurrentMap.CreateCopy();
  
  dsCurrentMap.DrawImage(512, 384, 3875);
  dsCurrentMap.Release();
  Wait(1); //all the above doesnt show the sprite
  //however, when I un-comment out the lines below, now the sprite appears (with the yellow line):
  /*
  DrawingSurface *surface2 = Room.GetDrawingSurfaceForBackground();
  surface2.DrawingColor = 14;
  surface2.DrawLine(0, 0, 512, 384, 5);
  surface2.Release();
*/


**EDIT**
I also tried this, and it works like I want to (but Im drawing twice so its a hack):
 
Code: ags

  dsCurrentMap = Room.GetDrawingSurfaceForBackground();
  dsCurrentMap.DrawImage(512, 384, 3648);
  dsMapBackup = dsCurrentMap.CreateCopy();
  dsCurrentMap.DrawSurface(dsMapBackup);
  dsCurrentMap.Release();
  dsMapBackup.Release();
  


**I also tested various transparency values (between 1 and 99), and it doesnt affect the sprite's transparency at all. (32bit game)
#218
Hi guys!

@Iceboty V7000a: The sprite is a 32-bit png sprite with transparency (its quite large since its all the street names of the city, think google maps when you show the labels on the map). The background is a png without transparency, although even if I try to draw a png sprite without transparency I still cant see it :P

@Khris: Hmm, ok Ill try that! Whats weird is after line 14, as a test, I inserted this code block:
Code: ags

  DrawingSurface *surface2 = Room.GetDrawingSurfaceForBackground();
  surface2.DrawingColor = 14;
  surface2.DrawLine(0, 0, 2000, 1750, 5);
  surface2.Release();

and THEN the sprite appears (along with the yellow line)! Obviously I dont want to add those lines, but why would the sprite appear only after I call those lines? Is it like a refresh problem or something cause the room is so large? Its embarassingly large (6464x3712)

Oh, and Im calling "manageStreetNamesOverlay(player.Room);"

@dbuske: Well the part Im fiddling with now is the isometric driving part of the game...and since I dont have mad programming skills the pace is quite slow, hehe! Its a police quest style game and Im trying to get all the technical stuff working as a base before actually making the final art and stuff. :)
#219
Hi,

Ive been trying to draw a sprite onto a scrollable background (larger than game resolution) without success. It seems to work when I draw lines/triangles, etc...but for some reason I cant get it to work with sprites.

What I want to do is I have a button on a gui that when pressed draws a sprite onto the room's background (but saves a copy of the original first). The room's background will stay this way with the sprite drawn onto it until the player presses the same button again...when he does, the background image reverts back to the way it as before.

Here's what I am currenty doing:

Code: ags


//global 
DrawingSurface *dsCurrentMap;
export dsCurrentMap;
DrawingSurface *dsMapBackup;
export dsMapBackup;

void drawLabelsOnCityMap(int iX, int iY, int iMapLabels)
{
  dsCurrentMap = Room.GetDrawingSurfaceForBackground();
  dsMapBackup = dsCurrentMap.CreateCopy();
  
  dsCurrentMap.DrawImage(0, 0, iMapLabels, 0);
  dsCurrentMap.Release();
}

//when button is pressed:
void manageStreetNamesOverlay(int iRoom)
{
  int iOverlayLabelSprite;
  if (iRoom == 299) iOverlayLabelSprite = 3639;
  //else if (iRoom ==) iOverlayLabelSprite =; 
  
  if (bStreetNamesOn && !bStreetActivated) //Show Labels
  {
    Display("Draw labels onto background"); //debug line
    Wait(40);

    drawLabelsOnCityMap(0, 0, iOverlayLabelSprite);

    //SetBackgroundFrame(1); //WITH DUPLICATE ROOM + LABELS PNG
    bStreetActivated = true;  
  }
  else if (!bStreetNamesOn && bStreetActivated) //Hide Labels
  {
    Display("Remove map labels..."); //debug line
    Wait(40);

    //**do "revert to original background image (dsMapBackup) script" and place it here

    //SetBackgroundFrame(0); //WITH DUPLICATE ROOM + LABELS PNG
    bStreetActivated = false;
  }
}



Right now I dont see anything being drawn onto the background. Ive also tried the solution of just using a 2nd frame for my background and showing that, but I plan on having many maps so I dont want to duplicate each room's background just for displaying the street names/locations.
#220
Ah ok, in this case I created a script that detects the direction, then depending on the direction I moved the detection point by 10 pixels (the car is usually 10 pixels away from the edge of the sprite), like so:

Code: ags

void getCarDirection()
{
    // leaving out the in-between angles for now, do later
    
    if (iCarSprite == 4452) sCarDirection = "N";       // 270º
    else if (iCarSprite == 4541) sCarDirection = "E";  // 360º
    else if (iCarSprite == 4272) sCarDirection = "S";  //  90º
    else if (iCarSprite == 4362) sCarDirection = "W";  // 180º
    else if (iCarSprite == 4500) sCarDirection = "NE"; // 330º
    else if (iCarSprite == 4402) sCarDirection = "NW"; // 210º
    else if (iCarSprite == 4222) sCarDirection = "SE"; //  30º
    else if (iCarSprite == 4320) sCarDirection = "SW"; // 150º
    else sCarDirection = "Null";
}

//at top of the bounds script
  int iXs;
  int iYs;
  int iXp;
  int iYp;
  
  if (sCarDirection != "Null")
  {
    if (sCarDirection == "S" || sCarDirection == "SE" ||sCarDirection == "SW")
    {
      iXs = -10;
      iYs = 10;
    }
    else if (sCarDirection == "N" || sCarDirection == "NE" ||sCarDirection == "NW")
    {
      iXs = 10;
      iYs = -10;
    }
    
    iXp = this.x + iXs; //if using 42x42 sprite car
    iYp = this.y + iYs; //if using 42x42 sprite car
  }
SMF spam blocked by CleanTalk