Jump to content

SirPope

Community Members
  • Posts

    107
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by SirPope

  1. That would be pretty cool and be a lot easier than the deforestation prevention method.

    It'd just be a possibly unlock-able tech at the farmstead. That would then allow citizens to build trees. You could just lock the sapling "building" to phase 2 or 3 instead.

    I'm not for sure if trickle rates for resources are possible ATM but if it is, I'm sure the average modder can see how to get it done (not me, I'll make every unit turn into a tree when they die).

    If someone gets it working, please upload it to mod.io.

  2. I've got an idea on how this regrowing trees could work.

    Resource trickle rates / healing as said earlier (a very small rate). If the tree gets down to 0 (or a set amount), change it's obstruction mask to allow for foundations and update the model to a stump (or to invisible). This would allow buildings to be placed upon it. A check would be needed in foundations to remove the Stump file / class / model from the world in some way.

    Hard parts:

    Animations: They could be added later (if the idea / mod even works). Perhaps percentage based filenames or the animation speed is controlled by the resource value somehow.

    Growing: I'd say "stumps" are only allowed to trickle it's resources back if it's near fully grown trees and no other entities within a range (similar to the game of life). That part might be hard to implement efficiently. You don't want villagers, buildings, or deer to be trapped by Ents. The check would kind of be needed. A bit of randomness could be added to make them grow at different rates or whether they grow at all.

    --

    If this is turned into a mod of some sort it'd be rather neat to play. It'd add a layer of management.

    I don't really see how it could be done without modifying the engine itself though. *shrugs*

    • Like 1
  3. I could finely create my 'tree people' civ. It makes no sense. I wanted a hero ability to turn the enemy units into trees. That way I can harvest them to death. I did get harvest-able villagers working (through upgrades). They turn to trees and then you chop chop chop. A temporary ability would work better though.

    • Like 1
    • Confused 1
  4. I was a bit worried about that SM45 diff as I have an xp. It won't break the game for me. Greater than I think 52 will...

    Finding the 'best way to JavaScript' is kinda pointless. One browser (or version) might handle something better but the other not so much.

    I guess find places that would benefit having what is known to be faster and make a note of it. Attack types, maybe resources, and some other stuff comes to mind.

     

    About the byte code: Related to the typedarrays

    I think what's happening in the byte code is a bit of optimization.

    for(var i = 0; yata yate; i++) // i is an integer. I don't need to guess.

  5. Off topic but on topic(?)

    I thinking: Initializing variables with values (that they are going to hold) could speed up the code. var x = 0.0; Only using x to store decimals.

    The JS Code is converted from untyped to typed values right? var x to float x and then to assembly.

    I was looking at that link and poking around on google. I found a comment about SpiderMonkeies inner workings. (misspelled but i like the way it's pronounced: Spider Monk-Easy)

    https://wiki.mozilla.org/IonMonkey/Overview

    Quote

    For example, consider an Ion-generated method having a 32-bit addition. If the addition operation overflows, or say it relies on an object access which happens to return a double, the compiled code is no longer valid. Guards check these assumptions, and when they fail, the method's execution resumes in the interpreter (and may later be recompiled).

    Not sure what it means but interpreters are usually slow. I'm not tech savvy. I'm just good at misspelligns.

  6. Flooding happens pretty much everywhere. It's kind of hard to explain how or why exactly. A storm can pass, the next day, it will be fine... or you'll be canoeing to the local store for some ice-cream. The length of it depends on a lot for factors early civilizations probably didn't know.

    It makes sense for cultures to tell stories of them. Scare the kids so they know what to watch out for them. Parents have been telling stories for a long time. Some stick around. The flood isn't the only story that's crossed continents. The concepts of gods and different 'focuses' of them. Death for example, the underworld, whatever. Kid's need to know it's a part of life in some way. If you just think about how myths start you'll see where most of them come from: preservation, preparation, and to answer questions we don't know.

    Control is also another reason why they exist. Which makes sense. You need to need to believe some things have a consequence. Instead of getting scared of the parent, let them look to the sky instead. It's always on their shoulders so they shouldn't forget its there. That's my logic at least. Idk

    • Like 1
  7. Understood. His coding challenges (or the nature of code series) is the better ones to watch then. I mainly wanted to share the editor, you don't need anything to get started. It is always nice to brush up on the basics though. If you can figure out p5's function reference you can figure out pretty much any other one. He also teaches Java or 'processing' (a Java library).

    He's got tutorials to manage a lot of units at once and covers path-finding. I like that he leaves things up to you to do and figure out (sometimes even fix).

    In his live-streams, he programs 'on the fly' style. You get to see the thought process kinda unfold. He's also trying to make a video out of it so the retakes can get annoying. Games (and pretty much everything) starts with chaos and end up structured. I don't know a better example of that then watching his streams and seeing the result.

  8. I'm not going to answer all the question. The line about no programming experience.

    Enjoy programming. Programming is necessary for making a game. Start small and work your way up to harder projects, and you'll be fine. Your game is going to need code, graphics and sound (which also requires code to show / play them). To make it easier to learn (and so you can jump right in):

    Start high work low. JavaScript is a good example of a high level programming language. Basically, most of the stuff is done for you. It is well documented and everything. Some of what you can do in JavaScript carries over to C++ and other languages as well. Functions, classes, variables, the basics basically.

    Videos to start learning programming... The Coding Train on YouTube. He uses a JavaScript library called p5.js. It basically simplifies the browsers features. It was designed for this no experience. They have a web editor now so you don't need to set anything up to learn programming. He's kinda weird but, it'll get you the basics.

    https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

    He does coding challenges for some games and covers basic physics engines in quite a few of his other videos. He won't teach you everything but, with the coding challenges, you should have a game made and understand it. :) They are "simple" games but some are actually quite hard to do.

    Once you've got a grip on the basics, maybe someone else can give you advice. I'm pretty much a JavaScript only type of person. I hope I helped in some way.

    • Like 1
  9. This should let you play as 0 AD civ, the AI on the other hand requires some tinkering. I removed BasicSoldier from the class list of template_unit_infantry.

    The AI will not use the barracks anyways without editing config.js. It won't use it properly without a bit more edits in the other AI files.

    template_unit_support_female_citizen.xml

    template_unit_infantry.xml

    -- Let me know if it works now :)

    • Like 1
  10. 4 hours ago, stanislas69 said:

    This could also be an old C programmer habit. Some school teaches one to do it that way. The reason was at the beginning compilers couldn't use variables that were not declared at the top of the function.

     

     

    Some JavaScript interpreters 'lift' variables before the code is ran.

    Found a link. Seems like it doesn't apply here really. let and const are ignored so uh... 'hoist waiting' isn't an issue really.

    https://www.w3schools.com/js/js_hoisting.asp

    -- wasn't the old site I was talking about but apparently it is faster to do the .length outside the loop. I found that out at least.

    https://www.w3schools.com/js/js_performance.asp

  11. Yes the JS Code is what I was wondering about.

    I'm pretty sure doing the below is faster as well. The array doesn't need to ask for/look up the value, it already has a reference to the data in memory.

    function some2dArrayFunc(arr2d) {
       const numberOfRows = arr2d.length; //avoid look up each condition check
       const numberOfColumns = arr2d[0].length; //same
       let row, j, i = 0; //avoid recreation each loop(?).
       for(; i < numberOfRows; i++) {
          row = arr2d[i]; //only look up and retrieve index i once.
          for(j = 0; j < numberOfColumns; j++) {
             //doStuff with row[j];
          }
       }
    };

    Something about not having to travel the prototype chain each time (or do error/sanity checking - if there is any internally). It somehow makes it a bit faster (but that was from some site a time ago). The speed up is probably small anyways but 0.0001 can equal a quadrillion if you add it together enough times. Poor point... So this really only applies to large amounts of operations that don't need to be 'felt' by the viewer. I don't really know if 0 ad does this, so this post could be pointless. Only thing that might be noticeably improved is map generation.

    I can almost say that the arrow function creation in a loop is slow. Sure, they've been sped up but you are still forcing a lot of stuff to happen each time.

    --

    I thought minifying just lessened the load time, not necessarily the execution. If it just does that then, yeah it would technically be faster. I never looked it up or tried it.

  12. I'm mainly making this post to see if I have the right ideal. I've seen some of the stuff while browsing the source / diff.

    Here's an example of something I made up but I'm sure the developers have already seen something similar... its overly crappy fake code btw

    function idkRectangle(arrayOfRects) {
       for(let rect of arrayOfRects) {
          const x0 = someMath on rect; //All of these are recreated each loop
          const y0 = someMath on rect;
          const x1 = someMath on rect;
          const y1 = someMath on rect;
          const v = new Vector(centerPoint...).rotate(someDegree/Rad);
          const newArrowFunction = (...) => {}; //extra bit I've seen elsewhere
          
          yata yata
       }
    };
    
    //Isn't this faster and less data heavy?
    function idkRectangle(arrayOfRects) {
       let x0; //just created once
       let y0; 
       let x1;
       let y1; //These could be moved to one line to save space.
       let v = new Vector(0,0);
       const newArrowFunction = (...) => {};
       for(let rect of arrayOfRects) {
          x0 = someMath on rect;
          y0 = someMath on rect;
          x1 = someMath on rect;
          y1 = someMath on rect;
          v.set(centerPoint...).rotate(someDegree/Rad);
          newArrowFunction(...);
          
          yata yata
       }
    };

    My guess is yes but: linting... and readability.

    The last one is kinda confusing. But it is faster and less data heavy right? I've seen this in area's where "speed is key". I got confused.

    • Like 1
  13. You don't need to change the templates of 0 AD inheritance does that all ready. You've made all the changes necessary to the base templates that the units of 0 ad inherit.

    template_unit, template_unit_calvary, template_unit_infantry, so on and so forth. The only one you seemed to have missed was the female citizen file. Units still have the armour types and attack types HC has thanks to those files.

    Problems could arise with the AI being adjusted, yes, but 0 AD civ's are Hyrule & Gerudo. I've looked over the AI files and you've just added stuff for the civ's that need it (koroki, gohma). The hero functionality can check and should check if the civ in question has a hero unit that can be chosen anyways (not just for compatibility but also testing new hc civs). I've destroyed the gerudo's with war elephants and that made me happy.

    I still wouldn't implement them into the game anyways. But if someone wants to mess around I told you how. :)

    --

    You'll have to add the barracks back for each civ in config js along with their other structures special structures. The barracks code has been changed apparently.

    Adding BasicSoldier to the classes of unit_infantry allows them to train troops early on but might effect the rest of the AI hence the shouldn't implement them anyways. CitizenSoldiers are basic soldiers anyways.. I don't understand that class name change but you know what your doing I can tell you that much.

    • Like 1
  14. I gave the "0 AD Civ's in Hyrule" a shot:

    I'm using maur for the test. Enabled it in the menu by finding it's xml file in Hyrules folder and scrolling to the bottom.

    The maur tech tree loads fine (slow af but fine), everything basically costs material now (I'm fine with that). The civ center and house would give an error (posted below) and the selection panels wouldn't show. The barracks was still usable though. I didn't play for long but my test said yes, this is kinda possible. I could also build and gather the stuff the buildings say they need (except for rubees).

    --- So I tinkered and found this: Hyrule's version of template_unit_support_female_citizens.xml (which it doesn't seem to use anywhere):

    The gather rates aren't updated. change "stone.rock" -> "stone.ore" , "metal.ore" -> "metal.rubees" , and add "tree.rock". Just look at the _citizen.xml file of hylians in there unit folder.

    The SoundGroups section of female_citizens also needs the gather_rupees sound effect. Again see hylians.

    The citizen soldiers need the same thing as above. That seems to be Hyrule's template_unit_infantry.xml (they were just missing the sound file, i think). They don't play a mining animation which is weird. They will gather and return it though.

    --- So success! You seem to be able to do it after the above few changes. I don't know how to get the soldiers to play a mining animation though. :/

    This was the first error & the only one I got in the test.

    Spoiler

    ERROR: RelaxNGValidator: Validation error: units/maur_support_female_citizen:1: Element Rates has extra content: metal.ore

    ERROR: RelaxNGValidator: Validation failed for '(null)'

    ERROR: Failed to validate entity template 'units/maur_support_female_citizen'

    ERROR: JavaScript error: gui/session/session.js line 243 Error: deepfreeze requires exactly one object as an argument. GetTemplateData@gui/session/session.js:243:1 g_SelectionPanels.Training.setupButton@gui/session/selection_panels.js:935:18 setupUnitPanel@gui/session/unit_commands.js:95:8 updateUnitCommands@gui/session/unit_commands.js:147:4 updateSelectionDetails@gui/session/selection_details.js:471:2 updateGUIObjects@gui/session/session.js:1013:2 onTick@gui/session/session.js:881:3 __eventhandler255 (tick)@session tick:0:1

    ERROR: JavaScript error: gui/session/session.js line 243 Error: deepfreeze requires exactly one object as an argument. GetTemplateData@gui/session/session.js:243:1 g_SelectionPanels.Training.setupButton@gui/session/selection_panels.js:935:18 setupUnitPanel@gui/session/unit_commands.js:95:8 updateUnitCommands@gui/session/unit_commands.js:147:4 updateSelectionDetails@gui/session/selection_details.js:471:2 updateGUIObjects@gui/session/session.js:1013:2 onSimulationUpdate@gui/session/session.js:942:2 __eventhandler257 (simulationupdate)@session simulationupdate:0:1

    Now all I get is:

    WARNING: JavaScript warning: simulation/ai/petra/config.js line 254 reference to undefined property this.Military.popForBarracks2

    The above only shows up if popcap is less that 200. I'm not sure who's doing what with Hyrule's AI.

    As for getting the 0 A.D's Civ's to work with Hyrule AI... Yeah, after the templates stated above are fixed. It seems to work fine.

    Well this shows up once and goes away but the AI still... AI's.

    Spoiler

    WARNING: JavaScript warning: simulation/ai/petra/config.js line 253 reference to undefined property this.Military.popForBarracks1

    WARNING: JavaScript warning: globalscripts/ModificationTemplates.js line 32 reference to undefined property this.templates[name]

    ERROR: JavaScript error: simulation/components/TechnologyManager.js line 271 TypeError: template is undefined TechnologyManager.prototype.ResearchTechnology@simulation/components/TechnologyManager.js:271:1 g_Commands.ChooseHero@simulation/helpers/Commands.js:764:9 ProcessCommand@simulation/helpers/Commands.js:47:3

    ERROR: Failed to call ProcessCommand() global script function

    Just figured I'd give my input. The above error is obviously "no hero found for civ" related... I didn't test all this for long. It could very well break in the end. So someone else can tinker with it if they want too.

    • Like 2
  15. The error in the AI that prevented the Gerudo from training swine was fixed in 0.3.

    However... the code that fixed it was shortened and removed from basemanager.js in this release. needCorral is never updated so they are never built or maintained.

    If this section get fixed or reverted... plus possible way to keep the same effect

    Spoiler

    The template can be renamed to _corral

    Field removed from the classes and replaced with Corral

    The resource supply section removed.

    A way-point flag added

    and the build list for the worker file updated to the new name.

    Spoiler

      replacing if(count < 600) of the original basemanager -> checkResources function with:

                     let limit = this.Config.Military.PopPerField * numFarms;
                        if (limit < gameState.getPopulationLimit())
                        {

    might give the same result and keep the effect (that I don't understand) intact...

     

  16.  Might be do to the changes to phase naming: Doubt it will fix everything but it should fix the repeat.

    I'm using town as an example but it applies to city as well.

    phase_town_{civ}

    phase_town_generic is the new default.

    phase_town.json and phase_city.json is just for easy access / short hand. phase_town_generic replaces phase_town.json

    I don't think village gets this special treatment.

     

    Basically ensure the technology in the civ centers have _{civ} at the end of it and update the filenames of the phases accordingly. If athens has non-generic features: phase_town_athen. You might have to have it supersede phase_town_generic but I think that is optional.

    You do not need to have a file for every civ.The _generic will be assumed and used.

     

  17. I always knew Hyrule was in the pacific.

    To answer your questions, no, no, kinda.

    The first two seem easy. However, if you didn't want weird things to happen: Collision detection, position, and maps would be a problem. The projectiles could spawn a unit in a remote location, the raised forest rim of some maps (plateaus, water). Also cramped battles and spawning multiple units on death could cause overlap. Its just riddled with problems. Possible yes but it's confusing and problematic to implement. It would be neat to fire a boulder from a catapult/trebuchet and have the boulder roll around (and maybe break apart).

  18. 33 minutes ago, elexis said:

    One problem with automated spawning is that one have to track the number of units spawned, otherwise it can easily become too many.

    Spider Domination: The Endless Web. Good book. I don't know if it exists but it is a good one. I don't think you'd be able to do anything else with the building (train other units, research techs). If js controls the production queue updates, it might be easy to adjust that one.

    Just up and spawning them next to a building looks weird so I'm guessing they'd actually be trained. This seems a whole lot harder than I was hoping it would be. It seems better to just have a fast train time, be kinda weak, and let the player decide.

    Although, this would make for an amazing civ: "You don't run the city. We overrun the city." *power rangers theme* "Spider Domination!"

    Side thought / Random thoughts: Yes that just happened.

    Spoiler

    This was my first idea on figuring this out: Techs can't spawn units and can't be refreshed. It was a quick and fascinating conclusion. I started my first thought with nope. I found it funny.

    Random thoughts:

    Spoiler

    I'm now thinking about a civ/tech bonus to the market that allows the training of traders and researching techs at the same time. I'm not good on history but someone must of been a good trade city.

    And now I'm thinking about spawn on death, a heath degrading aura, a list of unit templates that continues the chain and a whole heap of corpses... Lovely! ... Not the building idea I was going for but... If the aura is slow enough, it could technically be counted as auto train. Although the unit will die from the aura which limits their use (and I guess balances them out a bit). I tried this with some tree sprites quite awhile ago. They died, turned into a tree. When they where finally chopped to pieces (or the aura killed them), they turned back into a sprite with no degen.

    I had a bird scout trainable from the outpost as well as bears... My market was the fruit stand prop and my houses were the ruin treasure stones from that one map. You could harvest your house! I thought it was a good idea for some reason. I don't know what fantasy world I was on but that was about as far as I got. This auto-training has made me think about something amazing: Rabbit Warriors. They never stop Fighting.

    --I've spent at least 30 minutes typing this.

     

     

  19. The invisible Cucco is a reminder that they are far superior. Even if you do succeed in killing one, it will comeback and haunt you for all eternity. I am sorry to tell you this but once you've looked upon the ghost of a Cucco; you are essentially cursed for eternity. I urge you to never lookup on approach another chicken again. They may congregate and feast upon your flesh. In other words, assume their natural state. I shall pray for you. F F F F F F

     

    Sorry couldn't help myself...

×
×
  • Create New...