Jump to content

modern warfare reaches 0 A.D.


Recommended Posts

@Gen: I know the idea behind the turrets :P I was just hoping I could do a quick hack by mounting a unit onto another unit. Tried a few things, and it didn't work.

Anyways, regarding turrets: I did some digging through the code, and found this in UnitAI.js (lines 893 - 917. Note the last line.

			"ATTACKING": {
"enter": function() {
var cmpAttack = Engine.QueryInterface(this.entity, IID_Attack);
this.attackTimers = cmpAttack.GetTimers(this.attackType);

// If the repeat time since the last attack hasn't elapsed,
// delay this attack to avoid attacking too fast.
var prepare = this.attackTimers.prepare;
if (this.lastAttacked)
{
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer);
var repeatLeft = this.lastAttacked + this.attackTimers.repeat - cmpTimer.GetTime();
prepare = Math.max(prepare, repeatLeft);
}

this.SelectAnimation("melee", false, 1.0, "attack");
this.SetAnimationSync(prepare, this.attackTimers.repeat);
this.StartTimer(prepare, this.attackTimers.repeat);
// TODO: we should probably only bother syncing projectile attacks, not melee

// If using a non-default prepare time, re-sync the animation when the timer runs.
this.resyncAnimation = (prepare != this.attackTimers.prepare) ? true : false;

this.FaceTowardsTarget(this.order.data.target);
},

I bet we can change that to something like:


if unit has turret
turret.FaceTowardsTarget
else
this.FaceTowardsTarget

As I said though, I'm just a tinkerer. I don't think I can do it, but this is probably where the magic should happen.

Edited by gudo
Link to post
Share on other sites
  • Replies 235
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

It's.... UPDATE TIME! this time let's have a swim. I really adore what the creators of Pyrogenesis did with water and how many options it has. It was fun just playing with all those settings available

Tanks a lot A new update, this time we deal with ingame buildings models and style:

a bit on the run at this moment, so I will be brief this time I'll reply on all post later. What important is that... I've created finally an FB page (will be bettered soon), and we made an another

Posted Images

That's interesting :) However, I believe it would require some codding into the main engine.... :((

The way I have though would be to have an EntityContainer that would "house" two different entities: The chassis and the turret.

The turret would have the attack behavior while the chassis would just stand around. And the container would be responsible to have the ingame attributes for both, like cost, build and this stuff.

Link to post
Share on other sites

That's interesting :) However, I believe it would require some codding into the main engine.... :((

The way I have though would be to have an EntityContainer that would "house" two different entities: The chassis and the turret.

The turret would have the attack behavior while the chassis would just stand around. And the container would be responsible to have the ingame attributes for both, like cost, build and this stuff.

That is essentially how the change gudo is proposing would work. Props are entities, IIRC.

Would be best to use a generic term rather than "turret" so the code can apply to things like archer units on horseback (thinking "Parthian Shot" here for cavalry archers). Or perhaps "turret" is good enough here too. Can apply to siege weapons on ships as well.

The "Partian shot" case seems a bit more tricky, in that you will want the actual mesh/skin to "twitch" rather than just rotate the whole thing.

Link to post
Share on other sites

In some cases it might be helpful if more than 1 additional "thing" could be attached to the movement determining "body" (like for mechs). Is that possible? In that case simple "attachment" would be a sufficient name.

Edited by FeXoR
Link to post
Share on other sites

Hi, guys.

Thank you for your time, I'm sure that implementing turret will benefit not only my game but future 0 A.D. moders. Either way, came back with new complaint: linked helpers to the main part (the hull), exported both (hull and helpers) as the model for the main actor. Exported turret and tracks without helpers. Surpsingly, it worked, but the attachment's positions seem to be totally independent from the prop's positions. No matter how I move the props in the hull's dae, nothing changes. What to do?

post-14981-0-06617200-1351797309_thumb.j

Link to post
Share on other sites

Hi, guys.

Thank you for your time, I'm sure that implementing turret will benefit not only my game but future 0 A.D. moders. Either way, came back with new complaint: linked helpers to the main part (the hull), exported both (hull and helpers) as the model for the main actor. Exported turret and tracks without helpers. Surpsingly, it worked, but the attachment's positions seem to be totally independent from the prop's positions. No matter how I move the props in the hull's dae, nothing changes. What to do?

I think the problem is that you have to export the props with the "center" of the object matching the origin coordinates (0,0,0) of the scene, this way the object will be spawned with it's center at the prop point.

Link to post
Share on other sites

That is essentially how the change gudo is proposing would work. Props are entities, IIRC.

Props are actors, and actors only affect graphics, not simulation. Actors currently can't take any information from simulation (that I can think of) except which animation they're playing. Entities are what define what units can do.

Link to post
Share on other sites
Props are actors, and actors only affect graphics, not simulation. Actors currently can't take any information from simulation (that I can think of) except which animation they're playing. Entities are what define what units can do.

so, can the turret be ever made? It's a matter of critical importance for this game, without the turrets we can't make this game :\

and

passed the props placing problem, it appeared that you need to center the models itself (not just their pivots) to the world origin to make props appear at the right place.

Now next question is quite self-explanatory in the pic below:

post-14981-0-44299800-1351808485_thumb.j

Edited by Ilves
Link to post
Share on other sites

Which material is specified in your actor .xml?

I think you should use this one: <material>player_trans_parallax_spec.xml</material> to get the shaders working

EDIT:

Also make sure to use this settings on your default.cfg file in 0AD\binaries\data\config\

preferglsl = true

gentangents = true

materialmgr.quality = 10.0

Edited by Enrique
Link to post
Share on other sites
Props are actors, and actors only affect graphics, not simulation. Actors currently can't take any information from simulation (that I can think of) except which animation they're playing. Entities are what define what units can do.

I see. But in that case why would one want the turret to be an entity? Props already have an established way to specify how they should be positioned relative to the main actor.

Edited by zoot
Link to post
Share on other sites
so, can the turret be ever made? It's a matter of critical importance for this game, without the turrets we can't make this game :\

I'm still convinced turrets can be implemented relatively easily. We just need to find the best way to do it.

  • Like 1
Link to post
Share on other sites

Ilves, could you zip up your actor and models and post it here (unless it is "top secret", of course :)). Then people can try and tinker with the code and see if the turret can be made to work.

I already shared a dummy tank model on the first page. You're free to try with it if you wish :)

Link to post
Share on other sites

Which material is specified in your actor .xml?

I think you should use this one: <material>player_trans_parallax_spec.xml</material> to get the shaders working

EDIT:

Also make sure to use this settings on your default.cfg file in 0AD\binaries\data\config\

preferglsl = true

gentangents = true

materialmgr.quality = 10.0

Instead, make a local.cfg file in that folder and paste those parameters. ;) Should not alter default.cfg as those are the defaults. Local.cfg will overwrite whatever settings you wish, but default.cfg will remain unchanged (as it should be). (y)

Link to post
Share on other sites

I guess it wouldn't really make much of a difference whether the turret was an entity or an actor. But if we make it a prop, then I guess we would have to mix the behavior of normal units with that of ships/towers so that they can fire while moving but the player can still control whether the unit is attacking and what it's attacking.

Link to post
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.


×
×
  • Create New...