Jump to content

First Person View / Control unit mode


nocompile
 Share

Recommended Posts

Hi. Yesterday Phillip added some code that allows us to, from the console, view the world from a selected unit. This is awsome, you have to try it. Thankyou Phillip. He also showed me how to bind commands and little scripts to keys, I bound the view-from-first-person's perspective to the key T and it worked great :ok:.

Now I'm wondering if I can bind diffrent things to the W,A,S,D keys so I can control the unit directly from the first person perspective without using the mouse.

I'd like to bind "move forward" to W, "move backwards" to S, and either strafe sideways or turn left/right to A and D (probably want turn as there is no mouselook (yet?)). and some key for attack (enter?)

Is anyone else interested in this little modding project. It lets you lead from the front like the ancient generals of old did!

An additional idea is being able to change binds in game: if you press T not only does it set your view to first person, it could also change the binds of WASD, and also make it so if you move your mouse to the edge of the screen it doesn't exit first person, but if you press say H or something, then it changes the binds back to normal camara movements for the God perspective mode.

I forgot the command that changes the camera as Im not on the home computer right now, but it works great and everything looks good.

Another idea that was floated is improving the collision detection to detect walls (as a mode) rather than just the model bounding box. This would allow units to walk around in a building. Simple interiors could even be added to the buildings for fun. If you need to know how to do the various diffrent collision detection algorithims, just ask divverent or Lord_Havok on quakenet irc as xonotic/nexuiz/darkplaces has 4 or 5 diffrent types of collision detection algorithims programmed in to choose from per-model and you could ask them what the algos are.

Anyone want to work on this little feature/mod? It's awsome as is to look from the first person perspective, really gets you in the game, and you can command using the mouse, but adding keyboard controls would make it even better (say, via binds)

  • Like 1
Link to comment
Share on other sites

the problem with this is that it has been done, and when it is done, it is either crap... under developed or EXTREMEL LAGGY (rts system = bad for such things)

exampls of this are...

SharpShooters (map) On Warcraft III, extremely fun but EXTOREeMly laggy, so unless they develop it into the system, which they wont, this probably will not. >.>

Link to comment
Share on other sites

In console ( ~ ) do, when having a unit selected:

Engine.CameraFollowFPS(Engine.GetActiveGui().g_Selection.toList()[0])

If you want to bind it to the letter T

In: session.xml


<object hotkey="camera.firstperson">
<action on="Press">Engine.CameraFollowFPS(Engine.GetActiveGui().g_Selection.toList([0]</action>
</object>

and default config:


hotkey.camera.firstperson = "T" ; First-Person view from the first unit in the selection

The "lag" doesn't bother me.

We need some controls, WASD.

Link to comment
Share on other sites

Play Rise & Fall for ideas on how to implement an "FPS" mode.

About interiors: I think units sizes / building sizes will need to be reworked in order to have 'exact' proportions... Otherwise units get stuck in the ceiling of a house, or the walls are not wide enough etc...

Alltogether i'm not a big fan of this mode, but i'm sure others are.

Link to comment
Share on other sites

Here are some screenshots taken from that camera view.

All we need now is a few more camera control commands:

pan(direction,speed,panlimit) [[panlimit in degrees]if panlimit not set, then it's assumed to be unlimited] and stoppan[for when you release the key you bound pan(left,2) pan(right,2) pan(up,2,90) pan(down,2,90) to.

pyro1.png

pyro2.png

pyro3.png

pyro4.png

pyro5.png

Also I took the unused buildings and made the following by editing and adding xml files:

unit_woman can now create: school

school creates: stonemason

stonemason builds at 1.6x the rate of regular and builds (among other regular things): academy

academy builds: architect, artist

architect builds at 1.3x the rate of regular and builds: academy, stoa, royal stoa, meeting hall

meeting hall builds: diplomat

diplomat builds: mecenary tower

merc_tower builds: various foreign soliders (expensive though)

artist builds: doric column, small statue of aphrodite, large statue of aprodite, plants cyprus tree and plants lombard popolar trees for 10 more wood than they produce.

I also did some additions to the celts.

They can now build homesteads which go up in 1/3rd the time of a civic center, but cost more since the construction is not as careful (think building a causeway vs a suspention bridge: the suspention brige takes less tons of materials vs the causeway which is dumped fill, but takes longer to build as it is more exacting), and only build woman and spearman (not the other 3 men the civic center builds). This way the celts have a fighting change against the hellens, they can build towns quicker and spread out eveywhere.

The celt woman can also now build taverns, longhouses, and fences (wooden) for quick blocking of enemy. The taverns can train a really good chariot to counter the hellens mecenary units.

Ofcourse, Mythos Ruler told me before that he would never allow me to contribute to the game, and he and Philip have said that they would NEVER implement additional camera and simple direct movement commands that would allow a player to command from the FRONT (like real generals of old did), even though it would be quite simple to allow these functions to be accessed by the bind system (and that's all I'm asking for, then we could make our own binds to get first person usable and enjoyable to look around in). They say this is a RTS game only and they WILL NOT add even simple code to allow us, who mod, to do firstperson stuff.

:ok: That is a darn shame. It wouldn't be hard for people in the know, like they are, to just ALLOW us to do this.

Link to comment
Share on other sites

(Nobody's disallowed from doing anything - the technical problem is that non-rubbish first-person control is incompatible with the engine's design (it would have terrible lag, coarse collision detection, etc, as well as the poor texture quality and rendering performance) since it was designed as a top-down RTS engine, and I'm not very interested in working on inevitably-poor features when there's plenty of other things to be working on instead. Also nobody's going to be strongly motivated by someone who spends half their time on IRC demanding that people implement their pet features and the other half insulting them.)

Link to comment
Share on other sites

Sidenote on the screen: Greek Chi (χ) transliterates to "ch", not "x". So, αρχιτέκτων -> architékton. Which would be the proper form, instead of architektonas. (which is accusative plural form)

For the usefulness of the feature:

Well ... I don't think it is needed. If 0 A.D. were to go there, the graphics had to look good in both 1st and 3rd person view and it would surely causing lags, as in Rise&Fall.

Edit:

I noticed the terrible spelling of "Akhadhmia". Seriously, what source do you guys have?

Edited by SMST
Link to comment
Share on other sites

You can control the unit from the first person using the mouse, just can't pan the camera. There is no noticible "lag". You can suggest that there would be but the truth of the matter is there is none. Also about "performance issues": you can see WAY more from RTS view than you can see from firstperson, atleast 4x more from RTS view.

All I am asking for is a command to pan the camera. Not bound to any key or "official", I can bind it myself. I'd also like a command to directly move the unit rather than relying on the slow pathfinding routienes.

First person looks good to me, and it can stay a mod... but I need the TOOLS to make the mod. Just a few more commands revealed to the bind system.

If you want to attach the camera to a unit in first person, Philip gratiously created this command, open console to do it ( ~ ):


Engine.CameraFollowFPS(Engine.GetActiveGui().g_Selection.toList()[0])

I, myself, don't know of any way to pan the camera from the console. If there is a way please tell me. If there isn't I'm asking for a pan command, that's all. I've looked in the wiki and can't find anything.

Why do I insult on the IRC? Well the first day Mythos Ruler told me I wasn't allowed to contribute, ever. Period.

Secondly it seems your views are totally myopic where you won't even reveal whatever routienes are needed to pan the camera to the bind system :ok:.

Cmon, that can't be hard at all, you allready clearly have commands to spin the camera around a seleted unit, why can't I have simple turn camera command?

As for the greek: I used bable fish and then a greek to greeklish converter as I don't think you support unicode.

Link to comment
Share on other sites

Why do I insult on the IRC? Well the first day Mythos Ruler told me I wasn't allowed to contribute, ever. Period.

You were told that after you began your insults. Nothing you've said since then, including further insults against just about every individual on the dev team, has changed our minds. Do not misrepresent the situation again.

You are welcome to discuss the development of the game, to suggest features, to work on features, and to discuss ways to implement those features. You are not welcome to continue your insults against Wildfire Games members. Yes, consider yourself warned.

Link to comment
Share on other sites

i actually really like those on-the-ground pics; it reminds me alot of empire earth

i think the player should be allowed to zoom in considerably (even if that means the textures dont look as good), but actually walking around on the ground seems to be FAR too complex for the game, especially since that isnt the focus. one of the things i liked about empire earth was being able to zoom in on the units on the ground and get right in the action. again, it made the textures look rather poor, but youll more often than not be commanding from the third-person bird's eye view because you can see more. getting right down on the ground was really good for cinematics, and, for the record, AOM skirted the problem of low-quality textures and models by not only letting the player zoom in only a bit (like in AOK) but also made it so that there were special models and textures that the game only used during cinematics, so a low-quality arkantos in normal gameplay became a detailed, epic-looking atlantean admiral in cinematics

Link to comment
Share on other sites

Mythos: whatever insults I did make, don't take personally, I've found that when I ask nicely for help in opensource (say on #debian or anywhere else), I get none. When I make some noise, well that's more sucessful. This is in any opensource project I've ever used, contributed to, etc etc. This is from about 9 years of linux experiance.

It's not too complex:


if (m->FollowFirstPerson)
{
float x, z, angle;
cmpPosition->GetInterpolatedPosition2D(frameOffset, x, z, angle);
float height = 4.f;
m->ViewCamera.m_Orientation.SetIdentity();
m->ViewCamera.m_Orientation.RotateX(M_PI/24.f);
m->ViewCamera.m_Orientation.RotateY(angle);
m->ViewCamera.m_Orientation.Translate(pos.X, pos.Y + height, pos.Z);
m->ViewCamera.UpdateFrustum();
return;
}

GameView.cpp

Ok so here we see the camera being updated (each tic) to be facing whatever angle (in PI: from 0 to 3.14...) the unit is facing. Which means we just have to add a command to change the angle of the unit and we automatically change the way the camera is facing. Now, what is harder is how to get the camera to look up/down.

Ok so this means we first gotta go to input.js and selection.js (k775 gives the tip) and implement a function to change the units angle via a command, and we have to get that exported as a command for the console.

Link to comment
Share on other sites

What we need to do is add a command that does this:

(M_PI is the constant Pi (3.14159265...))




func_ChangeUnitAngle(ScalarRotationRate) {

NewAngle = M_PI + ScalarRotationRate;
if (NewAngle > M_PI) {
NewAngle = (NewAngle - M_PI);
}
Current.Selected.Entity[0].Angle(NewAngle);
}

Then we can do something like:


Bind "R" = func_ChangeUnitAngle((M_PI/360)*20); */TurnTwenty Degrees Clockwise/*
Bind "L" = func_ChangeUnitAngle(((M_PI/360)*20)*-1); */TurnTwenty DegreesCounterclockwise/*

I don't know what the actual names of, say, the current seleted entity is etc though or how to access it's angle and change it.

Then we need to add some command that tells the current selected entity to go forward abit.

Edited by trajans_adviser
Link to comment
Share on other sites

Mythos: whatever insults I did make, don't take personally, I've found that when I ask nicely for help in opensource (say on #debian or anywhere else), I get none. When I make some noise, well that's more sucessful. This is in any opensource project I've ever used, contributed to, etc etc. This is from about 9 years of linux experiance.

By your own admission, you insulted team members (I have no idea what you said but I will take your word for it).

I don't know what you consider "noise" but we don't respond well to insults.

Maybe we're special. That's how our community works, though. Please abide by the rules from now on and everything should be fine.

Link to comment
Share on other sites

Ok some new info:

11:36 < trajan34> somevalue->Engine.GetActiveGui().g_Selection.toList()[0].angle

11:37 < trajan34> to change that unit's angle?

11:37 < evans1> Philip: The 0ad collada files contain the bone data?

11:40 <@Philip`> evans1: Yes

11:40 <@Philip`> trajan34: No - the selection list simply gives the ID number of the unit, not an object

11:40 < trajan34> Philip`: how do I get an object?

11:41 < evans1> Philip: Can I start implementing Resource Dropsites or does it depend on anything else?

11:41 -!- pablo_ [webchat@190.50.200.173] has joined #0ad

11:42 < pablo_> alguien juega????????????????????????

11:42 -!- dispy [~dispy@188.46.133.230] has quit [Ping timeout]

11:43 <@Philip`> trajan34: You can't, since the engine doesn't work like that - the GUI has to use Engine.PostNetworkCommand to send a network-synchronised message in order to update the entity

So some new information

Link to comment
Share on other sites

In UnitAI.js

binaries/data/mods/public/simulation/components/UnitAI.js

I was able to disable the AI code by adding a return to this function:


UnitAI.prototype.OnCreate = function()
{ return;
if (this.IsFormationController())
UnitFsm.Init(this, "FORMATIONCONTROLLER.IDLE");
else
UnitFsm.Init(this, "INDIVIDUAL.IDLE");
};

So that's the first step (ofcourse it would be an if-then in production code, this was just to find out how to turn off the AI), So now I need to find a way to directly pass commands to the unit. How does the AI do that?

Link to comment
Share on other sites

16:03 < trajan34> 15:53 <trajan34> case "walk-forward":

16:03 < trajan34> 15:53 <trajan34> // print(cmd.message);

16:03 < trajan34> 15:53 <trajan34> print(WALKFORWARD);

16:03 < trajan34> 15:53 <trajan34> break;

16:03 < trajan34> 15:53 <trajan34>

16:04 < trajan34>

16:04 < trajan34> Philip`: then I did in console

16:04 < trajan34> Engine.PostNetworkCommand(walk-forward)

16:04 < trajan34> and

16:04 < trajan34> Engine.PostNetworkCommand("walk-forward")

16:04 < trajan34>

16:04 < trajan34> ReferenceError: walk is not defined @Console:1

16:04 < trajan34> and

Please help

PLEASE

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...