Ethan's Forum Posts

  • Really great! A lot of fun thanks.

  • Thanks everyone.

    I used R0j0's method shortly after he suggested it which works fine, but i'll certainly look at yours korbaach, and Magistross thanks for taking the time show how to do it with Regex as originally requested, really impressive, it might be a quick and neater alternative. The reason i wanted to use Regex was because i'm used to using tokens to search strings and could have done it that way if the replace function could specify a particular token index instead of replacing all occurrences.

  • You add the IID (not UID) after it.

    Firstobject(0).x

    Edit: sorry i probably misunderstood your first post. I don't know if the above was what you wanted.

  • The game art looks nice, but the hud is a mess in my opinion and doesn't match, even the drop shadows on some of them don't match the direction of the rest.

  • Thanks R0J0, it's good to get an outside perspective on the problem.

  • Ok i need a bit of design advice.

    I'm currently working on the ai code to my game. I've split the logic up it into various stages. I've done the tactical and capturing stages and i'm currently working on the recruiting stage.

    Basically you get money for capturing towns. Your commander unit is the only one which can recruit new units, and must be on a keep tile to do so. New units when bought are spawned on connecting castle tiles. It's a copy of the Battle for Wesnoth system which i prefer over other tbs games.

    Right now i simply have a routine to work out which units to recruit based on the enemy units on the board.

    I loop through all the enemy units, record their weakest stats in a list, loop through the ai units, for each one that can beat an enemy unit in battle i delete it from the list (as they will move and attack them in the tactical stage). What's left in the list are all the enemy units the ai needs to recruit against as it currently has no units on the board that can beat them in combat. I then prioritise their creation by finding the enemy units, that are the biggest threat, that the enemy has the most of, and recruit a unit that can beat it in combat first.

    My problem is i have a number of variables the ai needs to take into account to decide - when to move to a keep, which keep to move to, and what units to recruit.

    Heres how my system works. It's a work in progress so other variables can be added later to improve it, but for now i use the following-

    Check to see if ai has any money, if not then skip recruiting.

    Check to see if any empty keeps with empty castles are in move range, if not then skip recruiting.

    For all those keeps within move range, that are empty and have empty castles, generate the following scores.

    The distance of keep to Commander.

    The number of empty castles keep has.

    The number of enemy units in attack range of the keep and the combined damage score it could inflict on commander if it moved there.

    The units the commander needs to recruit to oppose each of those enemy units, and the combined cost.

    Whats the best method to use and combine the information i have to pick the best keep to move to and which units are a priority to recruit?

    For example, the commander obviously wants to move to the safest keep, but that might only have 1 castle connected to it, where as it might have enough money to recruit lots of units.

    I guess i'm wanting to figure out a way to somehow combine all these values into one general score or something.

    Any suggestions or advice?

  • Ok i'll try that thanks for your help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Does any one know how to delete any duplicate numbers and letter from a string using regex?

    For example if my string looks like this

    "112, 113, 112, 114, 113, 112,"

    it would be turned into this

    "112, 113, 114".

    I've been looking into regex but it's over my head.

    Thanks.

  • I'm not good at maths but heres a round about method.

    Create a sprite 1 pixel in size at the upper right point, then run a loop the distance between the upper right point and the lower left point in that direction and move it 1 pixel each loop. Stop the loop when its y coordinate matches the DTC's. Now get the distance between the sprite and the DTC.

    Also i think this is called "raycasting". Maybe do a search for that term.\</p>

  • I'm currently doing ai for my game and run into this issue a lot too. A "Trigger once per instance" would definatly be a great addition.

  • For one in my opinion the built in pathfinding is made for an RTS type game, its especially bad for grid/board based games, and the move costs just don't work for a TBS. You can probably jerry rig it to sort of work but i believe that was the point being made. Thankfully there are 3rd party alternatives as the event system doesn't lend itself well to that kind of thing, though i know a couple of good examples of it being done.

  • I share the sentiment. The preformed idea on how games should be made is C2 biggest obstacle. I find that there are work arounds to these obstacles. But then that requires building plugins from the ground up, that have to work around C2 Runtime engine and current plugins. This leads to the end result that plugins that open the doors for C2 require more work than what they would if they were done without the C2 system in place. It's daunting that some plugins I want to right and have started have to work around C2.

    Thats ironic if you believe Ashley started CC because he got fed up of writing custom plugins for MMF.

  • Very impressive, good luck with the project.

  • Have you seen this method? http://dxprog.com/files/randmaps.html

    It's how i created this.