zoot Posted April 2, 2013 Author Report Share Posted April 2, 2013 Yes, that diff does contain all my changes. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 (edited) 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.jsGuiInterface.jsplayer.xmltemplate_unit_infantry.xmlI 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 ? Edited April 2, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 2, 2013 Author Report Share Posted April 2, 2013 (edited) Others (leper, quantumstate) have succesfully applied my diffs from Github before. Are you sure you are applying the patch relative to the right directory? (Edit: Oh, I guess you've tried several.) Edited April 2, 2013 by zoot Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 (edited) 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.xmlBut 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. Edited April 2, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 2, 2013 Author Report Share Posted April 2, 2013 Yeah. I believe leper and quantumstate both use the vanilla 'patch' command. Maybe TortoiseSVN chokes on this particular format. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 Ok, I have a Cygwin install, maybe I can try to use it on the trunk directory and this patch file and see. Quote Link to comment Share on other sites More sharing options...
zoot Posted April 2, 2013 Author Report Share Posted April 2, 2013 (edited) messages.jsGuiInterface.jsplayer.xmltemplate_unit_infantry.xmlYou haven't edited these files yourself before, by any chance, have you? If you are using a Windows editor, it could cause line-endings mismatches. Edited April 2, 2013 by zoot Quote Link to comment Share on other sites More sharing options...
leper Posted April 2, 2013 Report Share Posted April 2, 2013 Use patch -p1 < file.diff (the -p1 strips the paths for the files to be patched until the first / (inclusive)) Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 (edited) 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.xmlto--- binaries/data/mods/public/simulation/templates/template_unit_infantry.xml+++ binaries/data/mods/public/simulation/templates/template_unit_infantry.xmland 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. Edited April 2, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 (edited) So the game starts fine when I patch messages.js, components\AttackDetection.js, GuiInterface.js, components\interfaces\AttackDetection.js and template_unit_infantry.xmlThey 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 )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. Edited April 2, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
madmax Posted April 2, 2013 Report Share Posted April 2, 2013 (edited) 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++ ? Edited April 2, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 2, 2013 Author Report Share Posted April 2, 2013 You need to find the very first errors printed. It should be logged in interestinglog.html. What often happens is that some minor error cascades into a huge bunch of errors with no real relation to the original cause. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) Where is the interestinglog.html file located ? I dont see anything in binaries/logs--------never mind, got it http://trac.wildfiregames.com/wiki/GameDataPaths Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) 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> Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 "ERROR: CXeromyces: Parse error: special/player:1: Did not expect element AttackDetection there"That's the culprit. Are you sure all files were patched correctly? And perhaps more importantly, that all files were created correctly. The diff contains new files that has to exist for the game to recognize the AttackDetection element. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) Yeah the new files have not been added ...should have checked that right away. I will try to just the download the files - the 2 AttackDetection.js filesOr hey wait...now I have the git repo...I ll try to switch the branch instead and see if they magically appear ! Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 Good idea Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) 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. Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 I usually test on 'Combat Demo'. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) 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-ordinates3. 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 attacked6. For a new attack, clear the old white dots and show new blinking ones at new positionsTotally 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 ? Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 The logic is in AttackDetection.js. It keeps a list of previous attacks, called suppressedList.There is no decision yet on which templates should have 'attacked' sounds. I suggest just using your own intuition, and then settle it during patch review. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 (edited) More questions added to previous post.There is no decision yet on which templates should have 'attacked' sounds. I suggest just using your own intuition, and then settle it during patch review.Right, I ll get cracking on that. Edited April 3, 2013 by madmax Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 The minimap code is here: https://github.com/0ad/0ad/blob/master/source/gui/MiniMap.cppI would probably add a C++ function called, say, 'PingMinimap' which transforms a location as you describe and renders the actual 'ping', and expose that to JS. Then it would be a matter of invoking that function from the right point in messages.js. Quote Link to comment Share on other sites More sharing options...
madmax Posted April 3, 2013 Report Share Posted April 3, 2013 ok, one other question, how do I print debug messages in the 0ad window from c++. Whats the equivalent for Javascript ? Quote Link to comment Share on other sites More sharing options...
zoot Posted April 3, 2013 Author Report Share Posted April 3, 2013 ok, one other question, how do I print debug messages in the 0ad window from c++. Whats the equivalent for Javascript ?I don't remember it offhand for C++, I believe it is DEBUG_PRINT() or DEBUG_WARN() or some such. For JS, it is warn() and error(). 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.