Jump to content

Silier

WFG Retired
  • Posts

    1.265
  • Joined

  • Days Won

    9

Posts posted by Silier

  1. This is calculation of position at time t for projectile:

    CVector3D position(float t)

    {

    float t2 = t;

    if (t2 > timeHit)

    t2 = timeHit + logf(1.f + t2 - timeHit);

    CVector3D ret(origin);

    ret.X += v.X * t2;

    ret.Z += v.Z * t2;

    ret.Y += v.Y * t2 - 0.5f * gravity * t * t;

    return ret;

    }

    Where v.y is 

    v.Y = offset.Y / timeHit + 0.5f * gravity * timeHit;

  2. @myou5e

    16 hours ago, myou5e said:

    I COULD NOT find the bow on the map, even with revealed vision and even looking at the location in the map file(and estimating its position relative to the other entities). I think probably it might be that the  equipment seems to have a very small footprint. Perhaps increase the footprint size and maybe highlight pickable items? I don't know how easy it would be to outline equipment without the cursor over it. I ended up finding it by putting a box of apples over top of the bow, which is visible.

    I was thinking about particles, but that would be no help for people playing without particles. Maybe some mark hovering above item could help. 

    16 hours ago, myou5e said:

    Another issue is that the items are half embedded in the ground.

    I know, currently I use the same actor for equiped item and item on the ground. I plan to make another one for items on the ground. I just make functionality first then art :)

    16 hours ago, myou5e said:

    Also, atlas wont start with your mod enabled.

    Fixed.

    16 hours ago, myou5e said:

    You treat the mmo player as special, instead of modifying template_unit, you create template_unit_mmo. Maybe this was intented to be a temporary thing, i'm not sure. However, for my mod I want the inventory to apply to all units. A man is not a "spearman", just a man who also happens to be holding a spear. This would be a good idea, I think, even for an MMO only game, as it would be simple to make the killed units droup their equipment for the player to pick up. Would you modifiy the SpawnEntityOnDeath code to make this work? Perhaps, in a multiplayer game, this could create too many entities and then lag, but this could be counteracted by only sometimes dropping the gear, and having a limited lifespan after it is dropped.

    I rather create custom templates when I end up overwriting everything. It is easier than to keep all svn templates in check.
    Entities with inventory drops their equipment already. I am planning to implement loot that will drop from other entities.

    16 hours ago, myou5e said:

    The main problem with integration seems to be the panels right now. This error comes up when I select a Spartan citizen. I understand "spart_house" is there because it is the first item in the list of construction options.

    I had not updated svn version. Fixed.

    • Like 1
  3.  

    16 hours ago, myou5e said:

    I downloaded your latest commit to Github, overwrote your UnitAI with the latest Github Dev UnitAI(Should be the same as SVN), and added just a few lines to UnitAI and it seems to have the same functionality. Haven't thouroughly tested though. This is good news. It actually changes a lot about how I was going to make my own mod. I was planning on creating separate entities for everything, because I didn't properly understand the variant system(:LOL:) .

    Some improvements I could suggest to make it more usable.

    • I COULD NOT find the bow on the map, even with revealed vision and even looking at the location in the map file(and estimating its position relative to the other entities). I think probably it might be that the  equipment seems to have a very small footprint. Perhaps increase the footprint size and maybe highlight pickable items? I don't know how easy it would be to outline equipment without the cursor over it. I ended up finding it by putting a box of apples over top of the bow, which is visible.
    • Another issue is that the items are half embedded in the ground.
    • For my mod, I want to integrate with the generic RTS play and I want units to be able to equip and purchase items at scale, treating them possibly as resources, and equip them at a blacksmith. I guess it should be quite easy to do this, but I'm not exactly sure the best way to go about it. I want to walk a bunch of troops near a blacksmith, and then get an option to upgrade their armor across the whole group. At that point, all the stats and variant changes are applied to them just as it does when you  "pick up" an item.
    • You treat the mmo player as special, instead of modifying template_unit, you create template_unit_mmo. Maybe this was intented to be a temporary thing, i'm not sure. However, for my mod I want the inventory to apply to all units. A man is not a "spearman", just a man who also happens to be holding a spear. This would be a good idea, I think, even for an MMO only game, as it would be simple to make the killed units droup their equipment for the player to pick up. Would you modifiy the SpawnEntityOnDeath code to make this work? Perhaps, in a multiplayer game, this could create too many entities and then lag, but this could be counteracted by only sometimes dropping the gear, and having a limited lifespan after it is dropped.
    • Also, atlas wont start with your mod enabled.
    
    ERROR: Failed to load map maps/scenarios/_default.pmp: File_OpenFailed
    terminate called after throwing an instance of 'PSERROR_Game_World_MapLoadFailed'
      what():  Failed to load map.
    Check application log for details.
    Aborted
    • The main problem with integration seems to be the panels right now. This error comes up when I select a Spartan citizen. I understand "spart_house" is there because it is the first item in the list of construction options.
    
    GAME STARTED, ALL INIT COMPLETE
    ERROR: RelaxNGValidator: Validation error: structures/spart_house:1: Expecting an element BatchTimeModifier, got nothing
    ERROR: RelaxNGValidator: Validation error: structures/spart_house:1: Invalid sequence in interleave
    ERROR: RelaxNGValidator: Validation error: structures/spart_house:1: Element ProductionQueue failed to validate content
    ERROR: RelaxNGValidator: Validation failed for '(null)'
    ERROR: Failed to validate entity template 'structures/spart_house'
    ERROR: JavaScript error: gui/session/session.js line 223
    Error: deepfreeze requires exactly one object as an argument.
      GetTemplateData@gui/session/session.js:223:1
      g_SelectionPanels.Construction.setupButton@gui/session/selection_panels.js:299:18
      setupUnitPanel@gui/session/unit_commands.js:97:8
      updateUnitCommands@gui/session/unit_commands.js:149:4
      updateSelectionDetails@gui/session/selection_details.js:499:2
      updateGUIObjects@gui/session/session.js:671:2
      onTick@gui/session/session.js:599:3
      __eventhandler54 (Tick)@session Tick:0:1
    ERROR: Errors executing script event "Tick"
    ERROR: JavaScript error: gui/session/session.js line 223
    Error: deepfreeze requires exactly one object as an argument.
      GetTemplateData@gui/session/session.js:223:1
      g_SelectionPanels.Construction.setupButton@gui/session/selection_panels.js:299:18
      setupUnitPanel@gui/session/unit_commands.js:97:8
      updateUnitCommands@gui/session/unit_commands.js:149:4
      updateSelectionDetails@gui/session/selection_details.js:499:2
      updateGUIObjects@gui/session/session.js:671:2
      onSimulationUpdate@gui/session/session.js:642:2
      __eventhandler56 (SimulationUpdate)@session SimulationUpdate:0:1

     

     

     

    • Like 1
  4.   

    On 8/27/2020 at 12:07 AM, myou5e said:

    I was trying to get the code working more smoothly without errors and up to date with the Dev code, but because there have been so many changes I thought it would be a lot easier to work out which bits I need from your code, and just copy that code into the latest Dev version(most of the code is in the separate components), as opposed to trying to fix about 2000 lines(the number that shows up when I attempt to do a diff between your UnitAI and the newest Dev UnitAI). These are the changes I made to UnitAI, it executes without errors, but when testing it seems like it does nothing at all. Do you know what I might be missing?

    
    583,589d582
    <         "Order.Pick": function(msg) {
    <                 if (this.CheckTargetRange(this.order.data.target, IID_ResourceGatherer))
    <                         this.SetNextState("INDIVIDUAL.PICK.PICKING");
    <                 else
    <                         this.SetNextState("INDIVIDUAL.PICK.APPROACHING");
    <         },
    < 
    2245,2277d2237
    <                 "PICK": {
    <                         "APPROACHING": {
    <                                 "enter": function() {
    <                                         if (!this.MoveTo(this.order.data, IID_ResourceGatherer)) {
    <                                                 this.SetNextState("INDIVIDUAL.IDLE");
    <                                                 return true;
    <                                         }
    <                                         return false;
    <                                 },
    <                                 "MovementUpdate": function(msg) {
    <                                         if (msg.likelyFailure)
    <                                                 this.SetNextState("INDIVIDUAL.IDLE");
    <                                         else if (this.CheckRange(this.order.data, IID_ResourceGatherer))
    <                                                 this.SetNextState("PICKING");
    <                                 },
    <                                 "leave": function() {
    <                                         this.StopMoving();
    <                                 }
    <                         },
    <                         "PICKING": {
    <                                 "enter": function() {
    <                                         const cmpInventory = Engine.QueryInterface(this.entity, IID_Inventory);
    <                                         if (!cmpInventory) {
    <                                                 this.FinishOrder();
    <                                                 return true;
    <                                         }
    <                                         cmpInventory.Add(this.order.data.target);
    <                                         this.FinishOrder();
    <                                         return true;
    <                                 }
    <                         }
    <                 },
    < 
    3866,3878d3825
    < UnitAI.prototype.Pick = function(target)
    < {
    < 	this.PerformPick(target);
    < }
    < 
    < UnitAI.prototype.PerformPick = function(target)
    < {
    < 	const order = {
    < 		"target": target,
    < 		"force": true,
    < 	};
    < 	this.AddOrder("Pick", order, false);
    < }

    PS. I tried out your new MMO map. Good work! Seems like most of the functionality is already there! It has so much potential.

     

     

     

  5. thnx next step dungeon map or ui don't know yet. 

    hmm. except inventory, equipment and item component + using them in relevant templates for merging with a23b/a24

    you need 

    "pick": function(player, cmd, data)

     {

      GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => {

       cmpUnitAI.Pick(cmd.target);

      });

     },

     

     "pick-use": function(player, cmd, data)

     {

      GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => {

       cmpUnitAI.PickAndUse(cmd.target);

      });

     }, in https://github.com/SlavomirSlovenkai/MMO/blob/master/simulation/helpers/Commands.js

    from https://github.com/SlavomirSlovenkai/MMO/blob/master/gui/session/unit_actions.js

    "pick": {
      "execute": function(target, action, selection, queued) {
       
      Engine.PostNetworkCommand({
      "type": "pick",
      "entities": selection,
      "target": action.target,
      "queued": queued
      });
       
      Engine.GuiInterfaceCall("PlaySound", {
      "name": "order_gather",
      "entity": selection[0]
      });
       
      return true;
      },
      "getActionInfo": function(entState, targetState) {
      if (!targetState || !targetState.equipment)
      return false;
       
      return {
      "possible": true,
      "cursor": "action-gather-treasure"
      };
      },
      "actionCheck": function(target, selection) {
      const actionInfo = getActionInfo("pick", target, selection);
       
      if (!actionInfo.possible)
      return false;
       
      return {
      "type": "pick",
      "cursor": actionInfo.cursor,
      "target": target
      };
      },
      "specificness": 1,
      },
       
      "pick-use": {
      "execute": function(target, action, selection, queued) {
      Engine.PostNetworkCommand({
      "type": "pick-use",
      "entities": selection,
      "target": action.target,
      "queued": queued
      });
       
      Engine.GuiInterfaceCall("PlaySound", {
      "name": "order_gather",
      "entity": selection[0]
      });
       
      return true;
      },
      "getActionInfo": function(entState, targetState) {
      if (!targetState || !targetState.item)
      return false;
       
      return {
      "possible": true,
      "cursor": "action-gather-treasure"
      };
      },
      "actionCheck": function(target, selection) {
      const actionInfo = getActionInfo("pick-use", target, selection);
       
      if (!actionInfo.possible)
      return false;
       
      return {
      "type": "pick-use",
      "cursor": actionInfo.cursor,
      "target": target
      };
      },
      "specificness": 1,

     

    },


    And from https://github.com/SlavomirSlovenkai/MMO/blob/master/simulation/components/GuiInterface.js

    const cmpEquipment = Engine.QueryInterface(ent, IID_Equipment);
      if (cmpEquipment)
      ret.equipment = {
      "type": cmpEquipment.GetType(),
      "specific": cmpEquipment.GetTypeSpecific()
      };
       
      const cmpItem = Engine.QueryInterface(ent, IID_Item);
      if (cmpItem)
      ret.item = {
      "type": cmpItem.GetType()
     

    }

     

    • Like 1
  6. 1st, you need to define action in https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js
    2nd, you need new command for that which will be called from ^ in https://code.wildfiregames.com/source/0ad/browse/ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
    3rd, create function in UnitAI that will be called by your new command from ^
    4th, you would need new Fsm order and state inside UnitAi, something similar to Gathering
    5th, ideally you should create custom component like inventory or something which you would call from unitAi when item should be picked

    Note: Also pickable entity should have some custom component so you can tell in unit_action that the entity can be picked or not.

    Picking itself is not so hard, just get the entity which should be picked, get cmpPosition and call moveOutOfWorld. Also you need to store id of that entity in inventory component so you can create ui for it later and player can throw it away from inventory or interact with it somehow. You can use auras and apply them on entity doing picking the item so you change entity stats if you want to.
    For throwing items away, just get cmpPosition of the item and call jumpTo (or something similar, cant recall right now).

    Hovewer you would need to edit the entity which should be pickable so it can be useful when picked up or used.

    • Like 1
  7. Hi, 

    Where did you install the game? 

    In case it was under C/Programm Files/... can you try another location? 

    Another disk for example. If you changed path already, can you try to install under default one? 

    It could be because writing/reading permissions.

     

    Just go be sure, by launching the game you mean launching application, right? 

    • Thanks 1
  8. probably some horse has new model and old animation or vice versa. 

    First you need to find which actor is causing the error, best way is in actor viewer in atlas.

     

    In case mod is using a24 horses/animations.

    If animation is older

     you need to find and replace wrong animation with correct one from a24 or redone animation with corect number of animation keys.

    If horses are older, you can replace them from a24.

    If it has custom animations, not from a24, you would need to fix them by yourself to have correct number of keys. 

    That should fix errors you get, but you should propose changes to mod itself if you manage to fix them. 

  9. Hi,
    hitpoints displayed in game are ceiled, but in simulation they are not.
    So even unit has 99,6 / 100 it is displayed like 100 / 100 but in reality unit is hurt so healers try to heal it.

    I do not know about ai, I did not notice nothing like that. Did you change something in it?

×
×
  • Create New...