Jump to content

madmax

Community Members
  • Posts

    165
  • Joined

  • Last visited

Everything posted by madmax

  1. Also some interesting stuff in ICmpOwnership wonder what that interface is for.
  2. I see this in ICmpPlayerManager /** * Player manager. This maintains the list of players that exist in the game. */ class ICmpPlayerManager : public IComponent { public: virtual void AddPlayer(entity_id_t ent) = 0; virtual int32_t GetNumPlayers() = 0; virtual entity_id_t GetPlayerByID(int32_t id) = 0; DECLARE_INTERFACE_TYPE(PlayerManager) }; Will try to use it. But then what the user's player id...hmm Maybe it's always 0 or 1 ?
  3. Ok and I guess there is no way to set a global variable kind of in JS that holds the user's player id. Then this can be used to check in parts of the JS code ? What I need is something like bool doesEntityBelongToPlayer(entityid, player id) I see some of the components call back to the script like: virtual bool MoveToTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange) { return m_Script.Call<bool>("MoveToTargetRange", target, minRange, maxRange); } Maybe if such a function is there in JS that messages.js is using, I could call back there.
  4. Oh ok, I can try to implement the logic. But the call to the global PingMinimap() was sending only for the current player. I wonder how. Maybe because it was at global scope and it can detect the player.
  5. I am unable to see tickets or update my code
  6. Thanks, so I have committed the change which allows pinging to appear in the minimap via the interface and message thing. https://github.com/z...5950b98fc72e238 The minimap interface implements only dumb pinging. It has no notion of why the pinging occurs as it can be for any reason. We may want pinging to happen to indicate other things later on. Also it does not do any check on the user's player ID. The JS sim code currently sends messages for attack on any entity. I think what the JS code should do is send messages only if entities of the current user is being attacked. Right now any attacked entity, even those of the enemy is being pinged. It was working correctly with the earlier JS where you were using the global PingMinimap() Also currently the pinging will stop if the unit is no longer attacked, after a duration decided by the user's frame rate. Which is weird but I guess not an issue as it doesnt affect the sim, only notification to the user. Trying to use the number of turns adds more code to no real purpose.
  7. Yes it has only 1 component of a particular type, so just 1 Minimap component. Ok so I have done all the C++ changes, but I still get a JS error even though the game plays fine. You can pull my latest commit an check. https://github.com/laxmax/0ad/commit/b1e5e5b2cee620bbdce74afc06b4ab04ee3a3479 Seems the following is the location of the problem: var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); var event = {target: target, position: cmpPosition.GetPosition(), time: cmpTimer.GetTime()}; Engine.PostMessage(target, MT_EntityAttacked, event); position: cmpPosition.GetPosition() ...maybe it should be received in a var called pos and then split up var event = {target: target, pos.x, pos.z, time: cmpTimer.GetTime()};
  8. I realized since you are sending the message only to the target entity and the message will get registered in that entity's CmpMinimap component, you do not need to pass the entity id at all. But let it be around anyway. Its like 1 entity has multiple components.
  9. I changed the order of the args in the event to make it consistent with the remaning messages, entity id first : // Message of the form { "event": { "target": 123, "position": { "x": 123, "z": 456 }, "time": 1 }. // sent when an entity is attacked. Engine.RegisterMessageType("EntityAttacked"); // Message of the form { "player": 1, "event": { "target": 123 , "position": { "x": 123, "z": 456 }, "time": 1, }. // sent when a new attack is detected. Engine.RegisterMessageType("AttackDetected"); and line 46 in AttackDetection.js : var event = {target: target, position: cmpPosition.GetPosition(), time: cmpTimer.GetTime()}; Would any other code be affected. What about consumers of the message MT_AttackDetected. This message will not be declared or used in C++ (unless we plan to , not sure)
  10. abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) $ git remote add zootzoot https://github.com/zootzoot/0ad.git abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) $ git pull zootzoot/attack-notification fatal: 'zootzoot/attack-notification' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) Unable to pull in your changes ---------- ok got it, no slash there
  11. ok, yeah that makes sense. Then there is no need for extra code to expose yet another global function for a functionality that isnt really global but specific to an entity. 2 questions here : First, my local repo was cloned from your repo, so a git checkout attack-notification should suffice to pull in your latest JS changes ? Or rather a git pull I guess Secondly.I ll need to figure out how to access the minimap object from CCmpMinimap. Need to look at the code in other components to see if they access GUI objects using CGuiManager or something similar
  12. Right, yeah I ll work on it today. Can you tell me where in Attack.js you will be putting the PingMinimap calls so I can put them there and test after I have moved the PingMinimap function to the ICmpMinimap interface. So just to clear it in my big confused head, we are doing this : because AttackDetection.js needs to notify the minimap much more frequently than the sound needs to be played. So if an unit has died, other units in the area may still be under attack but we choose to no longer emit a sound as the user's attention has (hopefully!) already been drawn to the battle. But we choose to notify the user on the minimap about these other units as all units under attack should be pinging in the minimap. This is to ensure that the user does not think that the battle has ended and go back to tending the economy ! Also can't AttackDetection.js call the currently exposed global PingMinimap function. If I make the change will I be able to revert to the current situation of the files later using the commit hash code ?
  13. Ok, is this because you see some units are being attacked but not being pinged in the minimap ? Because the logic for playing the sound suppresses some of these notifications to prevent the sound/attack notifications being constantly played ?
  14. Ok thanks, will do. There is 1 thing I noticed with 2 Ashoka units on the map, that the blinking continues even if the unit is not under attack anymore. Thats because I have made it blink for a certain number of frames before shutting down. So if the frame rate is high it will probably stop sooner. That can be fixed by using the number of game turns instead. I wonder though, if the units should keep on blinking after the player has moved it away from peril. Then we would need a attack stopped notification from the JS sim code. Guess its not worth it.
  15. Yep it was. Added to template_unit_champion_cavalry_javelinist This is AWESOME !!!
  16. Ok and there is no <SoundGroup> in templates/units/maur_hero_ashoka.xml But I see an <Entity parent="template_unit_hero_cavalry_archer"> So I could add the sound group to the parent as well, and it would be pulled into the child I guess ?
  17. I am looking at a particular unit in atlas : units/maur_hero_ashoka How do I find which template I have to modify to add the attack sound to it ?
  18. oh oh..it was there in SVN. Hadnt rebuilt the code. Ok back to templates...
  19. abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) $ git remote add k776-master https://github.com/0ad/0ad.git abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) $ git remote -v k776-master https://github.com/0ad/0ad.git (fetch) k776-master https://github.com/0ad/0ad.git (push) origin https://github.com/laxmax/0ad.git (fetch) origin https://github.com/laxmax/0ad.git (push) abhi@ABHI-PC /f/Code/0ad/0ad (attack-notification) $ oh ok, just read your post. So ok it looks similar. Now for the pulling part. If I pull his changes in, then it will merge into my current branch(attack-notification) automatically keeping all my changes in Minimap.cpp etc ?
  20. Yeah I do Is it possible to merge my current attack-notification branch with the master branch ...all in my local repo ? That would also pull in the change I guess. git pull master should do it ?
  21. Ok, this is very strange. I created a map by clicking the generate map button in atlas and that refuses to run in the game. I think the sim starts as I can see attacks happening and the minimap blinking where I expect, but the game world is not shown. Does Atlas have any known bugs like this ?
  22. Thanks. Ok, I just opened Atlas and saved a blank map. Then started in pyrogenesis and got a bunch of JS errors : ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 68 TypeError: myKeyEntities.toEntityArray()[0] is undefined ([object Object],[object Object])@simulation/ai/qbot-wc/qbot.js:68 ([object Object],[object Object])@simulation/ai/common-api-v3/base.js:42 @:0 ERROR: JavaScript error: gui/session/session.js line 105 TypeError: Engine.GetSimRate is not a function init((void 0),(void 0))@gui/session/session.js:105 ERROR: GUI page 'page_session.xml': Failed to call init() function ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(142)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(46)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(48)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(4)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(4)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(4)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(4)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(3)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 WARNING: JavaScript warning: simulation/ai/qbot-wc/qbot.js line 287 reference to undefined property this.pathInfo ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 287 TypeError: this.pathInfo is undefined ()@simulation/ai/qbot-wc/qbot.js:287 ([object Object],[object Array])@simulation/ai/qbot-wc/qbot.js:90 ([object Object])@simulation/ai/qbot-wc/qbot.js:156 ([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66 @:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(10)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined updateMenuPosition(2)@gui/session/menu.js:69 onTick()@gui/session/session.js:287 __eventhandler0 (tick)([object Object])@sn tick:0 ERROR: JavaScript error: gui/session/menu.js line 69 TypeError: menu is undefined up Should we be catching an empty map and exiting ?
×
×
  • Create New...