Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-19-2011, 07:38 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Smooth Camera

I have seen this done before on other servers. Basically, it's when a character moves or your mouse moves to a different x and the camera kinda lags behind you and when you stop, the camera springs into position. Classic uses something like this when you activate their mouse search were you can search across levels.

A more recent example is Esteria's camera behaviour when a player moves. Can anybody help me out?
__________________
Reply With Quote
  #2  
Old 11-19-2011, 07:55 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
Try using:

PHP Code:
setfocus(floatfloat); 
__________________

Intelligence without ambition is like a bird without wings.

Reply With Quote
  #3  
Old 11-19-2011, 07:56 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by iBeatz View Post
Try using:

PHP Code:
setfocus(floatfloat); 
I know you have to use setfocus ;P
But it quickly snaps to the player. I want it to glide to the player smoothly. I have seen it done on Esteria.
__________________
Reply With Quote
  #4  
Old 11-19-2011, 08:00 PM
iBeatz iBeatz is offline
Kavan
iBeatz's Avatar
Join Date: Dec 2010
Location: Northern Ireland, UK
Posts: 154
iBeatz will become famous soon enough
Send a message via Yahoo to iBeatz
Quote:
Originally Posted by Emera View Post
I know you have to use setfocus ;P
But it quickly snaps to the player. I want it to glide to the player smoothly. I have seen it done on Esteria.
Just set the focus on a timeout, and just move the camera along the delta between the player and focus point divided by how much you want it to glide for before it reaches the player.
I haven't done it before but I assume that's how you would do it.
__________________

Intelligence without ambition is like a bird without wings.


Last edited by iBeatz; 11-19-2011 at 08:04 PM.. Reason: typo
Reply With Quote
  #5  
Old 11-19-2011, 10:19 PM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
What you could do is store an array of the players past x and y values. Then you just call them up and plonk them into setfocus. I would write you up a piece of code but it's relatively simple and a good exercise for you to nut out.
Reply With Quote
  #6  
Old 11-19-2011, 10:30 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
onTimeout();
}

function 
onTimeout() {
  
temp.speed 0.1;
  
temp.cx += ((player.x) - cx) * speed;
  
temp.cy += ((player.y) - cy) * speed;
  
setfocus(cxcy);
  
setTimer(0.05);

Would this work?
__________________
Reply With Quote
  #7  
Old 11-19-2011, 10:46 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
The camera lagging behind the player is a horrible gameplay mechanic, btw.
Reply With Quote
  #8  
Old 11-19-2011, 10:49 PM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
When I saw it on classic I thought it was a bug lol
Reply With Quote
  #9  
Old 11-19-2011, 10:51 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Am I doing this right?
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}

function 
onTimeout() {
  
this.cx += ((player.x) - this.cx) * .1;
  
this.cy += ((player.y) - this.cy) * .1;
  
setFocus(this.cxthis.cy);
  
setTimer(0.05);

__________________
Reply With Quote
  #10  
Old 11-20-2011, 12:11 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
That's not the method I'd use Emera. So yer I can't tell wether you're on the right track or not due to me not being able to make sense of your logic
Reply With Quote
  #11  
Old 11-20-2011, 12:20 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Emera View Post
Am I doing this right?
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setTimer(0.05);
}

function 
onTimeout() {
  
this.cx += ((player.x) - this.cx) * .1;
  
this.cy += ((player.y) - this.cy) * .1;
  
setFocus(this.cxthis.cy);
  
setTimer(0.05);

Did you test it..?
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #12  
Old 11-20-2011, 12:22 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Fulg0reSama View Post
Did you test it..?
Yeah just did. It works a treat. Thanks Trix.
It works as I would expect it to work, but if there's a better way to do it, then I'm all ears.
__________________
Reply With Quote
  #13  
Old 11-20-2011, 04:12 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
The camera does not lag behind you on Classic anymore as it did pre-wipe, it is simply a portable focus where you press C (or whatever key of your choosing), can move the mouse around and click to freeze the focus on a spot.
Reply With Quote
  #14  
Old 11-20-2011, 11:17 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by ffcmike View Post
The camera does not lag behind you on Classic anymore as it did pre-wipe, it is simply a portable focus where you press C (or whatever key of your choosing), can move the mouse around and click to freeze the focus on a spot.
That's what I was trying to say, but it has a smooth camera motion to it.
__________________
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 09:25 AM.


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