Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 2020-09-16 in all areas

  1. Yes ! Finally, working. Thanks for the feedback, and keep it coming. The File : europeanbison.rar Ok, next time it's going to be quicker. Had to tweak the tail to avoid backface culling, and the overall size of the beast was changed to feel more like a true bison. Cleaned the vertex groups and the xml. Everything is fineeeee. The template is based on the muskox. And added an icon trying to emulate the style of the other ones with the halo. I'll just for the sake of it. Also here is some eyecandy. Edit: also the blend file eurpeanBison_shared.rar
    3 points
  2. In yesterdays IRC I mentioned about using jasmine tests for AI development and the topic was considered as maybe of interest to others. So I hereby provide a trimmed-down demonstrator on how a test suite can be set up. The attached zip archive contains a copy of the API3 AI high-level interface with two test cases (one of them discovered the problem discussed here), plus the necessary infrastructure (jasmine 3.6.0 release and driver html page). To execute the test cases, just extract the zip content to some directory and load the common-api/jasmine-runner.html file into a scriptable webbrowser. Said html file is commented to show how the jasmine framework, the API3 under test and the test files interact. Items to consider: For the demo, I used the official jasmine standalone release which contains a version number in its path. In "production use" I rename the directories to get rid of the version number so no changes are needed when upgrading jasmine. It is also possible to execute the unit tests via the SpiderMonkey js shell by loading all of the scripts and running the jasmine bootstrap code. I also managed to connect the jasmine test suite to the JSCover code-coverage measurement tool, but this requires a more complicated setup, i.e. a list of all source and test case js files plus a platform-dependent batch job and a hacked-up JSCover driver js script. I can provide a demonstration if there is interest. Any comments welcome. jasmine-demo.zip
    1 point
  3. I tried playing around with the AI API3 and set up my own entity template. Thereby I noticed an interesting behavior of the API3.Template.cost() function. I extracted a demonstrator for it: If you execute the following snippet (function (){ var rawTemplate = { "Cost" : { "Resources" : { "food" : 1, //"wood" : 2, "stone" : 0, "metal" : 4 } } }; var fakeSharedAI = { "_templatesModifications" : {} }; var testee = new API3.Template( fakeSharedAI, "someTemplate", rawTemplate); warn("Costs are " + uneval(testee.cost())); })(); in the content of an AI script (e.g. inject it into petras start-up sequence), the 0AD log receives the following entry: Note the NaN in the second property. So it seems template instantiation accepts skipped resource definitions gracefully, but I do not understand the behavior on "stone":0. Am I doing something wrong? I imagined something like "{food:1, stone:0, metal:4}" to build up.
    1 point
  4. An even better example is the "survival of the fittest" map. You should indeed be listening to the onOwnershipChanged messages. First find some way to filter the 5 entities (probably give them some identity class) and onOwnershipChanged you should be able to do the required checks. Another option is to look at CaptureTheRelic.js victory condition and do the same trick there (you probably can reuse that code, just need to change a class)
    1 point
  5. Hmm.. I didn't experiment much with this but if possible I'd think this would be done on a triggers script. Check out: - https://github.com/0ad/0ad/blob/master/binaries/data/mods/public/maps/random/jebel_barkal_triggers.js - https://github.com/0ad/0ad/blob/b364a8cc7f41fe305e8b436651f1ee59afa3a1e1/binaries/data/mods/public/maps/scripts/TriggerHelper.js In particular the functions which return entities, check owner for an entity and the OnOwnerShipChange callback. Since gaia should not own structures by default (depending on map) it should be easier to just check all gaia's structures (player with id 0). There could be a better way, but you could check this every x seconds or set an array with all the conquerable entity ids or on ownershipchange hook check if all were taken by the same player. As I said, I'm not familiar with this so someone else might know more.
    1 point
  6. Hi @user1, Played a 1v1 today vs D.I.C.T.A.T.O.R I did a great job with my early sling rush and took out much of his eco. He said GG and stopped the game without resign. commands.txt
    1 point
  7. I noticed this issue in the code sometime ago, but I assumed the Cost schema's doesn't allow 0 resource costs and didn't give it much thought. Turns out I was wrong. You aren't really doing anything wrong. It's just a check being falsy when it shouldn't be. And casting undefined to a number gives a NaN. The following diff is all that's needed to change. One ought to care for edge cases, but it will fix the immediate cause. Diff generated from 0ad svn at rP24041. diff --git a/binaries/data/mods/public/simulation/ai/common-api/entity.js b/binaries/data/mods/public/simulation/ai/common-api/entity.js index 49d7636..2913650 100644 --- a/binaries/data/mods/public/simulation/ai/common-api/entity.js +++ b/binaries/data/mods/public/simulation/ai/common-api/entity.js @@ -33,7 +33,7 @@ var API3 = function(m) let args = string.split("/"); for (let arg of args) { - if (value[arg]) + if (value[arg] != undefined) value = value[arg]; else {
    1 point
  8. Buenas , estuve investigando ; EncontrĂ© el aspecto de esas saunas , ubicadas entre las culturas Lusitanas y Galaica (celta) , son unas reconstrucciones de fuentes similares a las que usted mencionĂ³ . *Disculpen las molestias.
    1 point
×
×
  • Create New...