Lock the RTSCam to a Unit?
by Wolfgang Kurz · in RTS Starter Kit · 11/03/2006 (11:40 pm) · 18 replies
Hi everyone,
i was wondering if it were possible to lock the RTSCamera to a certain unit by the server so that the player is allowed to orbit about a certain unit but cant go everywhere to explore.
in my little test every player was supposed to have like 5 units and you could switch between units but shouldnt be allowed to go all over with camera
if its not possible i guess i would have to add fog of war in a way so the terrain isnt revealed either
i would be glad about any insights thx a lot
i was wondering if it were possible to lock the RTSCamera to a certain unit by the server so that the player is allowed to orbit about a certain unit but cant go everywhere to explore.
in my little test every player was supposed to have like 5 units and you could switch between units but shouldnt be allowed to go all over with camera
if its not possible i guess i would have to add fog of war in a way so the terrain isnt revealed either
i would be glad about any insights thx a lot
#2
i want to only have very few units and i want the player to be able to pick a unit around which the camera then could orbit
11/04/2006 (5:15 am)
No i think you are talking about the exact same thing as i was:-)i want to only have very few units and i want the player to be able to pick a unit around which the camera then could orbit
#3
Advanced Camera resource
It has an orbit camera around a unit and a follow target method. It was developed for FPS starter kit but I suspect it can be adapted to the RTS world. At least I'm very much hoping it can.
Personally, I just need to con a coder in helping me implement it :)
11/04/2006 (7:45 am)
Then the advanced Camera resource is what we're both looking for :)Advanced Camera resource
It has an orbit camera around a unit and a follow target method. It was developed for FPS starter kit but I suspect it can be adapted to the RTS world. At least I'm very much hoping it can.
Personally, I just need to con a coder in helping me implement it :)
#4
Going to try to implement this druing this week.
If you want i can keep you updated on my progress.
11/04/2006 (8:46 am)
Thats exactly what i am looking for:-) Going to try to implement this druing this week.
If you want i can keep you updated on my progress.
#5
11/04/2006 (10:07 am)
Please do :)
#6
so i tried to use this advanced camera setup.
i did add the resource to the engine and recompiled it which is really easy since most of the codechanges are already in the 1.5 version
well then i tried to use this camera and kinda got stuck:-)
i was trying to use the orbit camera but all i get is the mission loading with a normal 1st person view cam
here is my create player function:
i will keep trying and will let you know if i manage to make it work:-)
11/05/2006 (12:16 pm)
Hey James,so i tried to use this advanced camera setup.
i did add the resource to the engine and recompiled it which is really easy since most of the codechanges are already in the 1.5 version
well then i tried to use this camera and kinda got stuck:-)
i was trying to use the orbit camera but all i get is the mission loading with a normal 1st person view cam
here is my create player function:
function GameConnection::CreatePlayer(%this, %spawnPoint)
//----------------------------------------------------------------------------
// Create the player's avatar object, set it up, and give the player control
// of it.
//----------------------------------------------------------------------------
{
if (%this.player > 0)//The player should NOT already have an avatar object.
{ // if he does, that's a Bad Thing.
Error( "Attempting to create an angus ghost!" );
}
// Create the player object
%player = new Player() {
dataBlock = MaleAvatar; // defined in player.cs
client = %this; // the avatar will have a pointer to its
}; // owner's connection
// Create a new RTS camera object.
%this.advCamera = new AdvancedCamera()
{
dataBlock = AdvCameraData;
};
MissionCleanup.add( %this.advCamera );
%this.advCamera.scopeToClient(%this);
// Player setup...
%player.setTransform(%spawnPoint); // where to put it
// Give the client control of the player
%this.player = %player;
%this.setControlObject(%player);
// Do scoping
//%this.player.scopeToClient(%this);
%this.advCamera.setPlayerObject(%player);
%this.advCamera.setOrbitMode();
%this.advCamera.setFollowTerrainMode(true);
%this.advCamera.setVerticalFreedomMode(false);
%this.setCameraObject(%this.advCamera);
}i will keep trying and will let you know if i manage to make it work:-)
#7
11/05/2006 (1:18 pm)
Thanks Wolfgang!
#8
i got the orbit camera to work now.
just had a problem cause i didnt turn off the first person mode and the function in my book was done wrong
so next thing to do would be to see if this works with units from the RTS too
you said you would need a coder but this stuff is really simple
if you need the exe with the adv cam included i could send it to you if you dont have a working compiler
btw i looked at your blog and i think your drawings are awsome
Edit:
Well one problem solved the next is right ahead:-) For this plan to work we definately need a Cursor:-) The problem is that the cursor breaks the adv camera keybindings though:-)
i guess thats what i have to figure out next:-)
11/06/2006 (9:55 am)
Hey James,i got the orbit camera to work now.
just had a problem cause i didnt turn off the first person mode and the function in my book was done wrong
so next thing to do would be to see if this works with units from the RTS too
you said you would need a coder but this stuff is really simple
if you need the exe with the adv cam included i could send it to you if you dont have a working compiler
btw i looked at your blog and i think your drawings are awsome
Edit:
Well one problem solved the next is right ahead:-) For this plan to work we definately need a Cursor:-) The problem is that the cursor breaks the adv camera keybindings though:-)
i guess thats what i have to figure out next:-)
#9
If you have Messenger, give me a shout: james@crowtrees.ca
Thanks for the compliment too :)
Cheers and talk to you soon.
11/06/2006 (1:17 pm)
Lol - almost heh?If you have Messenger, give me a shout: james@crowtrees.ca
Thanks for the compliment too :)
Cheers and talk to you soon.
#10
Ive been trying, but no luck...working on a Modded RTS cam..
What parts of Advanced Cam did u use?
12/15/2006 (4:08 pm)
Any luck with this?Ive been trying, but no luck...working on a Modded RTS cam..
What parts of Advanced Cam did u use?
#11
i got everything working as i wanted it:-)
Well fist i went for the RTS Kit and implemented the advanced cam ressource to get a orbiting cam around the unit
but since i really wanted interior support i went for the normal 1.5 tge version plus the advanced cam ressource and the click n move ressource
if you need any help implementing it just let me know
12/15/2006 (9:12 pm)
Hi Rigo,i got everything working as i wanted it:-)
Well fist i went for the RTS Kit and implemented the advanced cam ressource to get a orbiting cam around the unit
but since i really wanted interior support i went for the normal 1.5 tge version plus the advanced cam ressource and the click n move ressource
if you need any help implementing it just let me know
#12
im trying to do something similar too, I want the players camera to follow the unit but im having no luck. ive tried the advanced camera but I cant seem to get it compiled right and ive also tried some other ways in script but ive found a strange problem with moving to camera around:
when I try to change the clients rtsCams position through rtsCam.setCameraPosition or rtsCam.setTransform it doesnt appear to be moving at all. im not really sure why this happens like that, though if it would work it would probably give some big issues with the rotation and pitch of the camera.
anyways, if you could help me in some way i'd greatly apriciate that.
12/28/2006 (11:19 am)
Hi all,im trying to do something similar too, I want the players camera to follow the unit but im having no luck. ive tried the advanced camera but I cant seem to get it compiled right and ive also tried some other ways in script but ive found a strange problem with moving to camera around:
when I try to change the clients rtsCams position through rtsCam.setCameraPosition or rtsCam.setTransform it doesnt appear to be moving at all. im not really sure why this happens like that, though if it would work it would probably give some big issues with the rotation and pitch of the camera.
anyways, if you could help me in some way i'd greatly apriciate that.
#13
%obj = %this.units.getObject(0);
%pos = %obj.getPosition();
$RTSCamera.setCameraPosition(getWord(%pos, 0), getWord(%pos, 1));
comment out the first line though, this only works since all clients have got only 1 unit in my game. anyways, im not sure how to go on from here:
I want my camera to follow my unit more accurate, i can schedule a call so that my camera updates constantly, however has a really shocky effect, unless you schedule it to happen like every 1 ms, but thats not the solution since its not fast enough.
what ive done now: ive made another call to this function that focusses the camera in server/scripts/avatars/player.cs line 362 so that it focusses correctly again when your unit arrives where you just moved him to. Ive done this to prevent the camera, through some bugs, to come loose of the player. then in the morning (im a bit tired right now) im going to look after a way of moving the camera (something like $RTSCamera.setVelocity(); ) to have it move with the player smoothly.
im not sure where to call this yet, but im gonna find out ;)
thx for all your help, and ill post it when its working my way (that is without adv. camera)
12/28/2006 (1:32 pm)
Im not sure what I did wrong before, but I got it fixing on a unit now like this:%obj = %this.units.getObject(0);
%pos = %obj.getPosition();
$RTSCamera.setCameraPosition(getWord(%pos, 0), getWord(%pos, 1));
comment out the first line though, this only works since all clients have got only 1 unit in my game. anyways, im not sure how to go on from here:
I want my camera to follow my unit more accurate, i can schedule a call so that my camera updates constantly, however has a really shocky effect, unless you schedule it to happen like every 1 ms, but thats not the solution since its not fast enough.
what ive done now: ive made another call to this function that focusses the camera in server/scripts/avatars/player.cs line 362 so that it focusses correctly again when your unit arrives where you just moved him to. Ive done this to prevent the camera, through some bugs, to come loose of the player. then in the morning (im a bit tired right now) im going to look after a way of moving the camera (something like $RTSCamera.setVelocity(); ) to have it move with the player smoothly.
im not sure where to call this yet, but im gonna find out ;)
thx for all your help, and ill post it when its working my way (that is without adv. camera)
#14
I was not able to get the advanced camera working for the RTS either.
So I modified the RTScam to do what you say..though it looks decent, I still need to fix a minor bug to it.
It does rotate around the character and is always focused on him no matter where you move the camera and is smooth for the most part.
I am going to release this as part of our upcoming VKIT 0.1 Code Package - This is a mod/code change package for the RTS Starter Kit. :)
It will have some AI, Pathfinding, RPGish features, and a modified RTSCam.
I am going to release a Beta version very soon. So I am not sure if you want to wait for this.
12/28/2006 (3:47 pm)
Heyaz,I was not able to get the advanced camera working for the RTS either.
So I modified the RTScam to do what you say..though it looks decent, I still need to fix a minor bug to it.
It does rotate around the character and is always focused on him no matter where you move the camera and is smooth for the most part.
I am going to release this as part of our upcoming VKIT 0.1 Code Package - This is a mod/code change package for the RTS Starter Kit. :)
It will have some AI, Pathfinding, RPGish features, and a modified RTSCam.
I am going to release a Beta version very soon. So I am not sure if you want to wait for this.
#15
anyways if you got the setVelocity() thing working, would you be so kind to paste some of the script here so I/we don't have to wait that long for the package to come out? and please, when it comes out please let me know ;)
thanks
01/03/2007 (4:59 am)
Rigo that just sounds great, i would be spared a lot of work using a package like that, however I am not sure what I did with the RSTCam was the right thing. unless you did manage to get the setVelocity() thing working I really think this isnt fast enough. on my computer, wich is not that slow, it really doesn't come out smooth. and reading about the RTSCam i found that changes are taking place on client and serverside at the same time, not sure how this works but sending messages between these every few miliseconds would seriously slow down things i suspect.anyways if you got the setVelocity() thing working, would you be so kind to paste some of the script here so I/we don't have to wait that long for the package to come out? and please, when it comes out please let me know ;)
thanks
#16
I am working on releasing this very, very soon..as early as next week. So stay tuned, I will not only release this but several other features and benefits also as part of this pack
www.enchantedrealmsllc.com
01/03/2007 (9:20 am)
Hi Tijs,I am working on releasing this very, very soon..as early as next week. So stay tuned, I will not only release this but several other features and benefits also as part of this pack
www.enchantedrealmsllc.com
#17
i saw on your website that you charge for the 3d content and stuff, not surprising since you appear to have a real buisness right there. how much exactly are you going to charge me for that RPG kit. was hoping nothing really since you kinda grabbed my idea off this here threat... suppose thats not realistic? ;)
anyways, it looks real promissing, and looking up the price on the 3d content pack which is only 7 bucks, i could live with something like that ;). still wondering and waiting for your reply on how much bandwith this method of mine will be taking. im not that experienced in c++ and i can't really find a way to hardcode a better way for the camera, but this script-wise-method of mine probably isn't that friendly.
the RTSCam gets updated on both client and server side if im not mistaken, meaning that you want the server to update every clients camera every few milliseconds. your package says its for semi- massive only playing, im wondering if the server wouldnt be too occupied with updating camera's when you have it as a massive game with, lets say a thousand players on a server.
anyways your site says that you are very experienced in both c, c++ en torquescript so maybe you can atleast shed some light on this. thank you
edit: the cresent blade thing on your portfolio looks really neat, I might make a couple of those for my own game too. good work on that
01/07/2007 (6:47 am)
Hi rigo,i saw on your website that you charge for the 3d content and stuff, not surprising since you appear to have a real buisness right there. how much exactly are you going to charge me for that RPG kit. was hoping nothing really since you kinda grabbed my idea off this here threat... suppose thats not realistic? ;)
anyways, it looks real promissing, and looking up the price on the 3d content pack which is only 7 bucks, i could live with something like that ;). still wondering and waiting for your reply on how much bandwith this method of mine will be taking. im not that experienced in c++ and i can't really find a way to hardcode a better way for the camera, but this script-wise-method of mine probably isn't that friendly.
the RTSCam gets updated on both client and server side if im not mistaken, meaning that you want the server to update every clients camera every few milliseconds. your package says its for semi- massive only playing, im wondering if the server wouldnt be too occupied with updating camera's when you have it as a massive game with, lets say a thousand players on a server.
anyways your site says that you are very experienced in both c, c++ en torquescript so maybe you can atleast shed some light on this. thank you
edit: the cresent blade thing on your portfolio looks really neat, I might make a couple of those for my own game too. good work on that
#18
well we actually are a real business. and dont worry I didnt grab your idea off of here. I have been working on this content pack for over 8 months!! The camera was just something I was already working on to work better.
Not just sure on the price yet...Just keep checking the website as it will be posted there :)
I promise it will be worth it. Content packs save people much time and money in the long run. Hiring a programmer costs big money $$
umm as far as the bandwidth for the cam..only a few variables get updated(x,y..If I remember correctly) to the server and the rest are client only. I have modified the c++ code and the script to handle this new camera in the works.
for MMO to be truly massive then you may want the camera and more variables to not be constantly updated. to the server. Right now I am just leaving it as is(partial update). And by saying its only Semi MMO...just means I am only allowing so many players per server (depending on performance). And all servers host an Area or Zone or a few missions at a time. This feature needs to be updated later on. Though this takes months of dev and I am only the only programmer right now.
The sword and more will be available very soon also as a content pack and won't cost too much. Which will save you time and effort for a very good price! Plus several other content packs we are releasing within 2 weeks so stay tuned.. THanks for the complement!
01/07/2007 (4:44 pm)
Hehewell we actually are a real business. and dont worry I didnt grab your idea off of here. I have been working on this content pack for over 8 months!! The camera was just something I was already working on to work better.
Not just sure on the price yet...Just keep checking the website as it will be posted there :)
I promise it will be worth it. Content packs save people much time and money in the long run. Hiring a programmer costs big money $$
umm as far as the bandwidth for the cam..only a few variables get updated(x,y..If I remember correctly) to the server and the rest are client only. I have modified the c++ code and the script to handle this new camera in the works.
for MMO to be truly massive then you may want the camera and more variables to not be constantly updated. to the server. Right now I am just leaving it as is(partial update). And by saying its only Semi MMO...just means I am only allowing so many players per server (depending on performance). And all servers host an Area or Zone or a few missions at a time. This feature needs to be updated later on. Though this takes months of dev and I am only the only programmer right now.
The sword and more will be available very soon also as a content pack and won't cost too much. Which will save you time and effort for a very good price! Plus several other content packs we are releasing within 2 weeks so stay tuned.. THanks for the complement!
Torque 3D Owner James
The changes to the RTSCamera you propose on the other hand are interesting as they are excatly what I'm looking to do at some point. A proper orbit around the units or as is my case, on a specfic unit, would be very useful.
Perhaps the Advanced Camera resourse?
*edit: I have this sneaky suspicion that I've misunderstood your post...