DrewMelton's Forum Posts

  • LittleStain Hmm, that's an interesting idea. I'll play with it when I get a chance.

  • PigFiend Yeah, I had one test sprite set up to hold the weapon animations, but I started running into trouble with getting the game to sort the z-order correctly. All the characters are sorted based on their Y value, and their origin point is right at their feet. The lower characters on screen are moved to the front. So if the weapon has a higher Y value, it is moved towards the back when it should be in front of the character. Of course, it also needs to be behind any characters that walk in front of this character.

    Ideally, I would have placed the weapon sprite's origin at where it would hit the hand of the character, but that won't give me the correct z-order sorting. I could make the hitbox for the weapon bigger, and place the origin below the character so it's in front. But then, doing that makes it hard to get it lined up properly and at the same time make sure the weapon appears behind anyone walking in front.

    And yeah, there will be different animations depending on if it's a dagger, bow, sword, whatever. So, I have to do this for each type.

    Remember this is an isometric game, so characters will be moving up and down the screen as well as overlapping. This is where the trouble lies.

    It just seems not worth the trouble. I could make separate animations and the sorting would be fine since I would be using the character's origin point for the sorting, and I already have it working properly, but I would not feel like coding in dozens of animations for each hero.

  • Well, I guess I'll have to do without visual upgrades to weapons. Maybe I'll either make upgrades just stat based or maybe I'll make a few worthwhile upgrades and keep the number low.

    Since I haven't heard from anyone, I'm guessing that this issue is difficult to solve. Like I said, the main problem was maintaining z-order sorting in an isometric game. Since the sorting is based off the Y value which is tied to the image point I believe, then weapons will always be a little off since they need to be placed high on the character.

  • I'm getting ready to start on my character animations. I've just been using placeholders for now while I worked on general gameplay mechanics and the HUD.

    The character is going to have 2 or 3 weapons, and I wanted there to be the ability to upgrade them visually (different color, appearance, whatever).

    This is an isometric game (like Baldur's Gate or Age of Empires II), so everything is sorted by a family with z-order sorting. This is what makes it tricky. If I just add in new animations, I don't have to worry about the z-order not working since I have already set the characters up. However, if I create a weapon as a separate sprite and then pin it or position it and have it trigger accordingly, I still need to make sure it sorts in the proper z-order.

    This picture of Golden Axe on the Genesis will give you an idea of the types of animations I have.

    There will be forwards and backwards walking animations. There will be an attack animation. And probably an idle animation of some sort.

    Now, normally when pinning a weapon sprite, it would probably be on the handle of the weapon and pinned to the character's hand. However, this would put it higher on the z-order sorting since the "lower" object is put in front. The character's origin is at his feet, and the weapon origin point would be up at his hand.

    The z-order would have to stay consistent when he is walking or when other characters get in front of him. I tried making the weapon sprite box the same size as the character, but it starts to get a bit confusing as to where to put the origin point and making sure it stays consistent with the character's animations, so I don't know if that's optimal.

    Now, I can avoid this by simply making new animations for the character with each new weapon, but this will start to add up quickly. I could also make the weapon invisible during the walk animation and have a few less animations to worry about, though it would look a bit silly it would still work.

    Anyway, I'm trying to figure out the best approach.

  • jobel Well, I think I got it sorted. I rewrote the code a bit to this:

    I used two separate conditions. Rather than pick by evaluate, I used pick random and system compare two values. I had to put the trigger once event first or it would go crazy and make tons of them. I was also able to increase the number higher than 200.

    By the way, heroes was a family with 3 people in it. Anyway, I think that wraps this up for now. I need to do more testing and see if this is what I want vs another method to spawn things.

    Honestly, I just don't understand how the logic works sometimes...

  • jobel Ground is a floor tile that is created during the map generation. The other tiles are wall tiles.

    So basically, I just want to spawn something on a ground tile at random. Like I said, it will work if I set it to less than 200, but greater than 200 will never work. There is plenty of room and plenty of tiles. I just don't understand it.

    I tried moving trigger once to after the condition, but it didn't seem to matter. I may have already tried that. I don't really remember. Since it worked like that for the less than 200 event, I thought it would work for both.

    The goal with this was just to keep stuff from spawning too close to the player.

  • See the picture below.

    The top line works every time if it compares less than or "<" 200, but the bottom event where it wants to spawn something as greater than 200 will never work. It's a large layout with plenty of tiles. I don't understand why the second one won't work. Am I not understanding the logic behind this event?

    Again, the top event works every time even if I put the door in there too. The bottom event will not spawn anything.

    I wanted to make it ">" so it would spawn enemies and doors away from where the heroes spawn rather than right on top of them. Is this condition not doing what I think it is?

    In fact, even if I make the second event say " > 1" it still won't work, so obviously it's not an issue with map size.

  • Hmm, well I can't figure anything out. I guess I'll have to do without destructible environments. Regenerating an obstacle map is just too draining and has too much impact on FPS.

  • I wanted a have a large map with blocks that could be destroyed. I set up an experiment to destroy a block on click and regenerate the obstacle map right then, and the frame rate goes down for each character that needs to regenerate the obstacle map. Just one character regenerating an obstacle map reduces frame rate by 10 or more for about 3 seconds. With multiple characters it gets to the point where the frame rate is in the teens for a few seconds, and it used to run at a smooth 60. All that for one block destroyed.

    Why can't it just take into account the one block that got destroyed? Why does it need to recalculate the ones that didn't change? I have tried to figure out a way to limit how big of an area it can recalculate, but nothing lets me combine it with regenerate obstacle map.

    My game is a tile based and turn based game. The characters can only move so much at a time. I thought I could limit the regenerating of the obstacle map to only as far as they could move, but it just wants to do the whole map. I also thought maybe using line of sight or a distance check around the character would work, but it doesn't allow these checks (or at least I couldn't figure it out).

    I also didn't have any luck with adding or removing custom obstacles. There didn't seem to be any way for it to work. I could have been doing it wrong I guess.

    I just don't seen any way of being able to destroy tiles/blocks and have pathfinding at the same time. It's just too expensive.

    Here are some things I either tried or was going to try but couldn't figure out how.

    1. each character has a line of sight set to custom so they can see through things, and then maybe limit it to 100 or 200 distance, then regenerate obstacle map within that.

    2. do a compare two values distance check around a character when doing the regeneration.

    3. checking on collision if object has been destroyed then regenerating for that area or removing that object from the custom pathfinding obstacles.

    4. when an object is destroyed that instance is removed from custom obstacles or a path is creating where the object was.

    5. when regenerating an obstacle map, it only considers objects that have changed and ignores the ones that are still the same.

    6. putting a large sprite around a character to test for collisions and see if obstacles are there anymore. I don't know.

    I just couldn't get anything to let me use it to modify the pathfinding behavior.

    It would be nice to have it so each character would only check their immediate surroundings such as a distance of 100 for changes when they regenerate the map. Alternatively, maybe just if they got hung up on an object that's not there they would recalculate it again just in a radius of 100 or so.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound Thanks, I was able to play around with those numbers and get it centered. I would have tried that before, but I thought maybe it was supposed to fill the whole thing. Now that I really think about it, it makes sense that it does not. Thanks again.

  • R0J0hound Hey, I hate to bother you again, but you seemed most likely to know the answer to this.

    I added on to the capx I just posted to include isometric tiles. The problem is that I'm only getting half a map now. Here is a screen shot. Please note that the graphics were made quickly and are a bit crude.

    You can see from the mini-map I set up in the bottom right that I'm not getting full coverage of the tiles. The blue is the background.

    Also, the green tiles seem heavily biased towards the left side most of the time.

    I tried adding some elements to the map array, but it never seemed to fill all the way, and the object count was getting too high for me.

    So yeah, it's getting really close and starting to look pretty cool. If I can work out a few more bugs, it'll be pretty sweet.

    Changes from last capx:

    Able to destroy tiles (changes animation and removes solid)

    mini-map added. Draw and refresh by right clicking. (also focuses on player afterwards)

    ground tiles changed to iso tiles. Wall tiles change to iso tile with height added.

    slight modifications in the way it creates the random map

    hero spawns on random ground tile and destroys wall tiles nearby (needs work)

    scroll with directions arrows on your keyboard

  • R0J0hound Sweet, it works! Thanks!

    I also noticed that when I clicked to redraw map, it was actually adding on rather than recreating, so I added an event under on start of layout to say for each xy of map to set curx and cury to 0 so it starts fresh each time.

    I guess the next step is to get enemy and hero placement sorted since this will have to be automated as well. And then I need to decide on what kind of tiles, slanted or straight. So, time for me to get work on that. Everything is coming along nicely though.

  • R0J0hound Yeah, I made sure to allow for that, though it was still a little off putting, so hopefully I didn't miss any.

    I have to call it a day. I'll try again tomorrow. If you get a chance to look at it, let me know. It's probably something simple that I keep glossing over.

  • R0J0hound or ahr Ech or anyone else, can someone have a look at this capx and see what is wrong.

    I found an old cap file for construct classic, and I wanted to remake into construct 2 so I could test it. However, it is not working as it should. Some of the logic and terms are different, so maybe something is throwing me off.

    Here is the tutorial with the old cap file for reference if you want it. https://dl.dropboxusercontent.com/u/581 ... al.doc.pdf

    I have attached my remake. Can someone look at it with fresh eyes and see where the error is? I was trying to follow the example as closely as I could, so maybe something needs to be written differently or maybe I just messed up and didn't realize it.

  • I have it set up so that the hero you have selected will regenerate the pathfinding map when you click to move him, so they do it one at a time on mouse clicked.

    The enemies don't move or pathfind until their turn is active. I don't see any regenerate pathfinding events for them at all, so maybe they don't need to since they don't pathfind until their turn is active, and the tiles will have already been destroyed by then. It seemed to work in my test. They walked through where the solid object used to be.