Jump to content

madmax

Community Members
  • Posts

    165
  • Joined

  • Last visited

Posts posted by madmax

  1. Ok thanks.

    More questions.

    Why does everything go through an interface. I mean, I like the idea, in OOPs there should be standard interfaces between classes. What I mean is what are they exactly in this case ? Are there different interfaces defined for different game entities. Is a entity the same as a component ?

    When you say :

    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);

    You are querying the Engine's Player interface for a particular player component ? The cmp stands for component I guess ?

    Whats are the things like <AttackDetection/> or BattleDetection or FormationManager ? They are various parts of the system right ? So these are also components ?

  2. ok, so there is indeed a loud horn blaring out in Combat Demo. There does not seem to be multiple alarms either. Just one for the entire attack. Wonder where the logic for that is.

    So now, we need to add the sound to all the other relevant unit templates. These I can see in simulation/templates. Has any decision been made as to which templates/units should have which sound. I guess unit specific sounds are not yet present and there is just 1 attacked alarm sound. So I can start adding it to the required xml files under the <SoundGroups> tag.

    A question regarding the co-ordinate system used to place objects in 0ad. So I guess any point on the terrain surface can be located with (x,z) and elevation is through 'y' ?

    1. I guess for the minimap, what needs to be done then is that I get all the units which are being attacked for the current player.

    2. Get their co-ordinates (x,z) , so a list of co-ordinates

    3. Transform these co-ordinates to minimap-space say (x', z')

    4. Show a blinking dot on the minimap at the list of (x', z') positions for a specific amount of time.

    5. Stop the blinking and keep a white dot to show the player where he was last attacked

    6. For a new attack, clear the old white dots and show new blinking ones at new positions

    Totally wild guess from someone who hasn't seen the code yet !

    Where is the minimap cpp files. Are there functions exposed to Javascript so this entire thing could be done in it ?

  3. Phew !! It finally worked ! Thanks so much for patiently replying to all my questions.

    Now to work.

    So I guess to test the alarm I do not need to use one of the custom maps where the enemies will be really far away and I will have search around with my unit in the fog of war.

    I should be able to quickly make a custom scenario in Atlas with 2 players against each other and quite close by.

  4. interestinglog.htmlmainlog.htmlSo strangely in interestinglog.html it says there is an error in parsing player.xml :

    <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Pyrogenesis Log</title>
    <style>body { background: #eee; color: black; font-family: sans-serif; } p { background: white; margin: 3px 0 3px 0; } .error { color: red; } .warning { color: blue; }</style>
    <h2>0 A.D. Main log (warnings and errors only)</h2>
    <p class="error">ERROR: CXeromyces: Parse error: special/player:1: Did not expect element AttackDetection there</p>
    <p class="error">ERROR: RelaxNGValidator: Validation failed</p>
    <p class="error">ERROR: Failed to validate entity template 'special/player'</p>
    <p class="error">ERROR: JavaScript error: uncaught exception: Player.js: Error creating player entity 0</p>
    <p class="warning">WARNING: GetPlayerByID: no player defined for id '0'
    (0)@simulation/components/PlayerManager.js:28</p>
    <p class="error">ERROR: Failed to load entity template 'actor|props/flora/grass_tropic_field_tall.xml'</p>
    <p class="warning">WARNING: GetPlayerByID: no player defined for id '0'
    (0)@simulation/components/PlayerManager.js:28</p>
    <p class="error">ERROR: Failed to load entity template 'actor|props/flora/grass_tropic_field_tall.xml'</p>
    <p class="warning">WARNING: GetPlayerByID: no player defined for id '0'
    (0)@simulation/components/PlayerManager.js:28</p>

    My player.xml is:


    <?xml version="1.0" encoding="utf-8"?>
    <Entity>
    <EntityLimits>
    <LimitMultiplier>1.0</LimitMultiplier>
    <Limits>
    <CivilCentre/>
    <DefenseTower>25</DefenseTower>
    <Fortress>10</Fortress>
    <Hero>1</Hero>
    </Limits>
    </EntityLimits>
    <Player/>
    <StatisticsTracker/>
    <TechnologyManager/>
    <AttackDetection/>
    <BattleDetection>
    <TimerInterval>200</TimerInterval>
    <RecordLength>12</RecordLength>
    <DamageRateThreshold>0.04</DamageRateThreshold>
    <AlertnessBattleThreshold>4</AlertnessBattleThreshold>
    <AlertnessPeaceThreshold>0</AlertnessPeaceThreshold>
    <AlertnessMax>8</AlertnessMax>
    </BattleDetection>
    </Entity>

  5. Changing checkPlayerState() in session.js to catch the invalid playerState var stops the crash :


    function checkPlayerState()
    {
    var simState = Engine.GuiInterfaceCall("GetSimulationState");
    var playerState = simState.players[Engine.GetPlayerID()];
    if (!playerState)
    {
    return;
    }
    ...
    .......

    Wonder why it becomes invalid though. Maybe because the game is starting up ? But then why wasn't it happening before. Is there someway to print out debugging lines like cout in c++ ?

  6. So the game starts fine when I patch messages.js, components\AttackDetection.js, GuiInterface.js, components\interfaces\AttackDetection.js and template_unit_infantry.xml

    They are all patched in their correct directories. But player.xml after patching crashes the game : (I eliminated the files one by one, patching each time :P )

    playererror.png

    The error dialog box shows :

    Assertion failed: "it != m_SharedLosMasks.end()"

    Location: CCmpRangeManager.cpp:1064 (CCmpRangeManager::GetSharedLosMask)

    Call stack:

    (error while dumping stack: No stack frames found)

    errno = 0 (No error reported here)

    OS error = 0 (no error code was set)

    player.xml seems to be only declaring a new component called AttackDetection. Maybe there is a bug in this component somewhere. The playerState seems to be invalid in session.js due to this.

  7. ok, so I manually changed the paths like these :

    --- a/binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    +++ b/binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    to

    --- binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    +++ binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    and right clicked on the trunk directory and applied the patch and it worked :)

    Not the most developer friendly way I guess, I ll try the patch command next time.

  8. Yeah I right click on the 'trunk' directory and try to apply the diff.

    Hmm its trying to find trunk\b\binaries\data\mods....

    instead of trunk\binaries\data\mods....

    wonder why its adding this b !!

    The diff does contain lines like :

    --- a/binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    +++ b/binaries/data/mods/public/simulation/templates/template_unit_infantry.xml

    But TortoiseSVN should understand that 'a' & 'b' here does not refer to the path. Maybe I ll find/replace the a & the b with blanks and try again. :P

  9. Hmm for some reason, no matter at which directory I right-click and try to apply the patch using the menu option of TortoiseSVN, the changes for the following files keep getting rejected :

    messages.js

    GuiInterface.js

    player.xml

    template_unit_infantry.xml

    I guess there is some specific way to apply the patch or perhaps the source which was used to make the patch for the above 4 existing files is different from the current state of the source for these 4 files. Anyway I am nearly 50% done on the git clone.

    Have you applied diffs from github to your SVN copy successfully before ?

  10. So now the entire 3 or 4 gb repo is being cloned by GitBash into my local drive. I am wondering if it would be faster for me to see the effect of your changes, if I make a diff of the attack-notification branch from github and apply this diff to my SVN copy(which I already have). Then compile and run the game.

    Perhaps I should save https://github.com/z...tification.diff to a diff file and try to apply it to SVN. Does this diff contain all your changes ?

    If the build fails, I can always revert to the server copy in SVN.

  11. Ok thanks ! So I just forked your repository. Now I am cloning it into my local machine using the Git Bash console. It seems to be cloning the 0ad master branch and not your branch specifically.

    Also, I can switch branches in the github web interface. I could not see 0ad / binaries / data / mods / public / simulation / components / AttackDetection.js

    So I switched the branch in the web interface to attack-notification and now I do see it in the github website.

    But I guess changing branches in the web interface won't automatically download the files specific to the attack-notification branch to my system ? I guess I need to make the active branch in my local machine as attack-notification ? Only then the files specific to this branch will be added to my local copy ?

    By default the master branch will probably be my active branch in my local copy.

×
×
  • Create New...