Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-12-2002, 03:35 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Local NPC locations

Let's say I have an NPC that follows a simple movement pattern. It just moves towards the player in a straight line at a fixed speed, like this:

NPC Code:

if(playerenters){showcharacter; setcharani walk,; timeout=0.05;}
if(timeout){
timeout=0.05;
dx=playerx-x; dy=playery-y;
mag=(dx^2+dy^2)^0.5;
x+=dx/mag; y+=dy/mag;
}



Simple stuff. However, I can't use the move command for this since the bad guy's movement changes whenever you move, and if I just let it work on updates from the server then it'll be really horrible-looking (which is why move was created in the first place). So, here's what I propose: A set of variables that define where the NPC is drawn on the clientside (call them drawx and drawy for the sake of argument). These can be changed all the time and stuff by clientside scripts, but whenever the client recieves x/y data from the server, they jump to that x/y. So I could do something like this:

NPC Code:

//#SERVERSIDE
if(created){showcharacter; setcharani walk,; timeout=0.1;}
if(timeout){
timeout=0.1;
dx=players[0].x-x; dy=players[0].y-y;
mag=(dx^2+dy^2)^0.5;
x+=dx/mag; y+=dy/mag;
}
//#CLIENTSIDE
if(timeout||playerenters){
timeout=0.05;
dx=playerx-x; dy=playery-y;
mag=(dx^2+dy^2)^0.5;
drawx+=dx/mag; drawy+=dy/mag;
}



Because then, y'see, the client could make guesses at where the NPC should be at that time. Sometimes these guesses will be wrong, but with simple movement systems they'll usually get it right and it eliminates the jumpy movement stuff. And since it's all clientside, there's no risk of people abusing it in any way to cheat.
__________________
Reply With Quote
  #2  
Old 02-12-2002, 03:38 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: Local NPC locations

Quote:
Originally posted by Kaimetsu
Let's say I have an NPC that follows a simple movement pattern. It just moves towards the player in a straight line at a fixed speed, like this:

NPC Code:

if(playerenters){showcharacter; setcharani walk,; timeout=0.05;}
if(timeout){
timeout=0.05;
dx=playerx-x; dy=playery-y;
mag=(dx^2+dy^2)^0.5;
x+=dx/mag; y+=dy/mag;
}



Simple stuff. However, I can't use the move command for this since the bad guy's movement changes whenever you move, and if I just let it work on updates from the server then it'll be really horrible-looking (which is why move was created in the first place). So, here's what I propose: A set of variables that define where the NPC is drawn on the clientside (call them drawx and drawy for the sake of argument). These can be changed all the time and stuff by clientside scripts, but whenever the client recieves x/y data from the server, they jump to that x/y. So I could do something like this:

NPC Code:

//#SERVERSIDE
if(created){showcharacter; setcharani walk,; timeout=0.1;}
if(timeout){
timeout=0.1;
dx=players[0].x-x; dy=players[0].y-y;
mag=(dx^2+dy^2)^0.5;
x+=dx/mag; y+=dy/mag;
}
//#CLIENTSIDE
if(timeout||playerenters){
timeout=0.05;
dx=playerx-x; dy=playery-y;
mag=(dx^2+dy^2)^0.5;
drawx+=dx/mag; drawy+=dy/mag;
}



Because then, y'see, the client could make guesses at where the NPC should be at that time. Sometimes these guesses will be wrong, but with simple movement systems they'll usually get it right and it eliminates the jumpy movement stuff. And since it's all clientside, there's no risk of people abusing it in any way to cheat.
Ehem...the comment //#SERVERSIDE does not exist -_-
__________________
Reply With Quote
  #3  
Old 02-12-2002, 03:42 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Re: Re: Local NPC locations

Quote:
Originally posted by G_yoshi


Ehem...the comment //#SERVERSIDE does not exist -_-
Neither does the comment "//Hi I am cool" but Graal doesn't object to it. It was there to show people that it's a script with serverside and clientside parts, without them having to see the //#CLIENTSIDE further down.

Anyway, comment on the idea.
__________________
Reply With Quote
  #4  
Old 02-12-2002, 03:47 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: Re: Re: Local NPC locations

Quote:
Originally posted by Kaimetsu


Neither does the comment "//Hi I am cool" but Graal doesn't object to it. It was there to show people that it's a script with serverside and clientside parts, without them having to see the //#CLIENTSIDE further down.

Anyway, comment on the idea.
[nagging]the script is already serverside until the comment //#CLIENTSIDE is encounterd[/nagging]

I guess it would be neat...I'm not sure what else to say :/
__________________
Reply With Quote
  #5  
Old 02-12-2002, 03:50 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Re: Re: Re: Re: Local NPC locations

Quote:
Originally posted by G_yoshi


[nagging]the script is already serverside until the comment //#CLIENTSIDE is encounterd[/nagging]
Yes I know. I am a scripter, remember? You ignored my point that it was for the reader rather than the Graal scripting engine.
__________________
Reply With Quote
  #6  
Old 02-12-2002, 03:52 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Re: Re: Re: Re: Re: Local NPC locations

Quote:
Originally posted by Kaimetsu


Yes I know. I am a scripter, remember? You ignored my point that it was for the reader rather than the Graal scripting engine.
Still...I cannot begin to reiterate enough the number of times it's been said before -_-
__________________
Reply With Quote
  #7  
Old 02-12-2002, 03:56 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
No statement in comments that is not a directive can be described as "wrong" and in this case there was a good reason for its presence. Even if the point has been made with merit in the past, there is no right and wrong on the issue.

So, STEFAN! Read my suggestion!
__________________
Reply With Quote
  #8  
Old 02-12-2002, 03:58 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu
No statement in comments that is not a directive can be described as "wrong" and in this case there was a good reason for its presence. Even if the point has been made with merit in the past, there is no right and wrong on the issue.

So, STEFAN! Read my suggestion!
lol, ok ok...no reason to quibble over something like this
__________________
Reply With Quote
  #9  
Old 02-13-2002, 01:13 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
I can't believe this fundamental of any online RPG (and arguably any online game at all) is being ignored.
__________________
Reply With Quote
  #10  
Old 02-13-2002, 03:18 AM
zell12 zell12 is offline
Gone
zell12's Avatar
Join Date: Jun 2001
Location: Alberta, Canada
Posts: 8,541
zell12 will become famous soon enough
Send a message via ICQ to zell12 Send a message via AIM to zell12 Send a message via MSN to zell12
That would be A nice thing to have
__________________
Reply With Quote
  #11  
Old 02-13-2002, 03:27 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
im sure he thought of this while making it and decided to make it w/ just clientsided for a purpose
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #12  
Old 02-13-2002, 03:32 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by LiquidIce00
im sure he thought of this while making it and decided to make it w/ just clientsided for a purpose
?

I don't think you've understood what I've been saying.
__________________
Reply With Quote
  #13  
Old 02-13-2002, 04:30 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
i think its a good idea
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #14  
Old 02-13-2002, 04:44 AM
Sym2001 Sym2001 is offline
Registered User
Join Date: Nov 2001
Location: Ontario Canada
Posts: 226
Sym2001 is on a distinguished road
Send a message via AIM to Sym2001 Send a message via Yahoo to Sym2001
You know..

That is a great idea. Great for making Bosses anyways. Im sure it could be used in many other ways aswell.

they should make a move command for players aswell, instead of only NPCs.
Reply With Quote
  #15  
Old 02-25-2002, 11:16 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Hey Stefan, since you're on a forum spree...

__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.