gudo Posted October 27, 2012 Report Share Posted October 27, 2012 (edited) @Gen: I know the idea behind the turrets 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.FaceTowardsTargetelse this.FaceTowardsTargetAs 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 October 27, 2012 by gudo Quote Link to comment Share on other sites More sharing options...
Gen.Kenobi Posted October 27, 2012 Report Share Posted October 27, 2012 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. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted October 27, 2012 Report Share Posted October 27, 2012 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. Quote Link to comment Share on other sites More sharing options...
zoot Posted October 27, 2012 Report Share Posted October 27, 2012 On 27/10/2012 at 10:31 PM, Gen.Kenobi said: 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. On 27/10/2012 at 10:57 PM, Mythos_Ruler said: 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. Quote Link to comment Share on other sites More sharing options...
Gen.Kenobi Posted October 28, 2012 Report Share Posted October 28, 2012 @Mithos: I feel that turret is generic enough Well, at least this is how C&C did it. Quote Link to comment Share on other sites More sharing options...
Gen.Kenobi Posted October 29, 2012 Report Share Posted October 29, 2012 Just letting you all know that I've taken the liberty to move this topic to the modding area, where it suits more, since this awesome discussion could be lost in the Introductions and Off-Topic area Quote Link to comment Share on other sites More sharing options...
Pedro Falcão Posted October 29, 2012 Report Share Posted October 29, 2012 In Warzone 2100 you can research models of chassis and turrets (each of them with their weaknesses and strengths) and you can combine them as you wish inside a factory and then save the plan to make the new unit. Quote Link to comment Share on other sites More sharing options...
FeXoR Posted October 30, 2012 Report Share Posted October 30, 2012 (edited) 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 October 30, 2012 by FeXoR Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted October 30, 2012 Report Share Posted October 30, 2012 On 27/10/2012 at 11:34 PM, zoot said: 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.You mean "twist" right? And yeah, it might be a little different. Quote Link to comment Share on other sites More sharing options...
gudo Posted October 30, 2012 Report Share Posted October 30, 2012 I think some sort of turret system should be written up as a feature request on Trac. Let's hammer out the details, then write up the ticket. Quote Link to comment Share on other sites More sharing options...
zoot Posted October 30, 2012 Report Share Posted October 30, 2012 On 30/10/2012 at 5:05 PM, Mythos_Ruler said: You mean "twist" right? And yeah, it might be a little different.Indeed, twist. Quote Link to comment Share on other sites More sharing options...
Ilves Posted November 1, 2012 Author Report Share Posted November 1, 2012 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? Quote Link to comment Share on other sites More sharing options...
Enrique Posted November 1, 2012 Report Share Posted November 1, 2012 On 01/11/2012 at 7:16 PM, Ilves said: 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. Quote Link to comment Share on other sites More sharing options...
Zaggy1024 Posted November 1, 2012 Report Share Posted November 1, 2012 On 27/10/2012 at 11:34 PM, zoot said: 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. Quote Link to comment Share on other sites More sharing options...
Ilves Posted November 1, 2012 Author Report Share Posted November 1, 2012 (edited) Quote 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 :\andpassed 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: Edited November 1, 2012 by Ilves Quote Link to comment Share on other sites More sharing options...
Enrique Posted November 1, 2012 Report Share Posted November 1, 2012 (edited) 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 workingEDIT:Also make sure to use this settings on your default.cfg file in 0AD\binaries\data\config\preferglsl = truegentangents = truematerialmgr.quality = 10.0 Edited November 2, 2012 by Enrique Quote Link to comment Share on other sites More sharing options...
zoot Posted November 2, 2012 Report Share Posted November 2, 2012 (edited) On 01/11/2012 at 8:58 PM, Zaggy1024 said: 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 November 2, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
zoot Posted November 2, 2012 Report Share Posted November 2, 2012 On 01/11/2012 at 10:21 PM, Ilves said: 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. 1 Quote Link to comment Share on other sites More sharing options...
zoot Posted November 2, 2012 Report Share Posted November 2, 2012 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. Quote Link to comment Share on other sites More sharing options...
gudo Posted November 2, 2012 Report Share Posted November 2, 2012 On 02/11/2012 at 1:04 AM, zoot said: Props already have an established way to specify how they should be positioned relative to the main actor. Where's that code? I searched around a bit, couldn't find anything. Quote Link to comment Share on other sites More sharing options...
zoot Posted November 2, 2012 Report Share Posted November 2, 2012 On 02/11/2012 at 1:38 AM, gudo said: Where's that code? I searched around a bit, couldn't find anything.Not sure. but I would expect in CCmpVisualActor.cpp or something linked to that. Quote Link to comment Share on other sites More sharing options...
Gen.Kenobi Posted November 2, 2012 Report Share Posted November 2, 2012 On 02/11/2012 at 1:36 AM, zoot said: 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 Quote Link to comment Share on other sites More sharing options...
zoot Posted November 2, 2012 Report Share Posted November 2, 2012 (edited) On 02/11/2012 at 2:25 AM, Gen.Kenobi said: I already shared a dummy tank model on the first page. You're free to try with it if you wish I see, thanks. Edited November 2, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted November 2, 2012 Report Share Posted November 2, 2012 On 01/11/2012 at 11:10 PM, Enrique said: 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 workingEDIT:Also make sure to use this settings on your default.cfg file in 0AD\binaries\data\config\preferglsl = truegentangents = truematerialmgr.quality = 10.0Instead, 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). Quote Link to comment Share on other sites More sharing options...
Zaggy1024 Posted November 2, 2012 Report Share Posted November 2, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.