Vallar's Forum Posts

  • It seems this question has already been asked!

    Really? Could you link the question and answer because my searches yielded nothing like what I want to do.

    Note I am not looking to compare between two tiles and find them equal or not. I am also not looking for how to compare between two arrays.

    My question is how to save data from tiles in a non-error prone way that I can compare with data pulled from a different source (not tiles but actually simple sprites) and do this in an easy and non-error prone way.

  • Hey everyone,

    A bit of a strange question, but let's say I have a level. This level consists of 2-3 tilemap objects. These tilemaps are layered on top of each other to create the visuals of the level. Standard stuff.

    However, the player is given a mechanic similar to Mario Maker; where you have some buttons these buttons are basically walls, floors, doors, etc... and the player has to reconstruct a simplified map similar to the original using these tools.

    A few notes:

    * The player does not need to make the map detailed. So for example let's say we have a room and in it there are 4 walls, one with a window. There is a floor with a table on it, a chest and 4 chairs. Then there is a door. The player doesn't need to replicate windows, tables or chairs. But they need to replicate the chest.

    * The player isn't using the same tileset to recreate the level, they are using a different one.

    * The player can modify any "tile" in their UI that is set to one thing if it is mistaken.

    Now based on the above, how do you reckon I should go about this? One way I thought about this is to create an Array file and then manually type in the tiles in each index and then for the player create an Array object and add the tiles based on index. However I quickly realized this is VERY error prone. Because I could easily miscalculate the tile or in a huge map (60+ tiles) it is easy to forget or get lots as to where you were looking. Specially when the editor doesn't have any kind of "numbering" on it or any such thing.

    So how would you recommend I do this in the easiest way possible while not making the process too error prone?

    Thanks.

    Tagged:

  • Hope that answers your questions

    Very much so, thank you very much. I'll try to adjust to this new mode of thinking. Also just in case, my questions regarding performance were just to get to understand C3 more. I still don't know its performance boundaries and best practices -- the questions were to learn that is all. Thanks a lot again for being thorough with your explanation and fixing my project :D

  • Hey, sorry for leaving you high and dry there I had some unexpected work come up.

    I have redone your ranged enemy event sheet to show you how to set up the events for what you wanted.

    **Please do not save over your existing work with as I've deleted some other things just to make it easier for me. You will need to create the instance variables I have created and then copy the event sheet across.

    https://1drv.ms/u/s!AkmrWgxeuxlKhIcbo9J75qqxC1NPvA?e=UcKtc2

    The majority of your problems were just incorrect picking events and the use of "for Each" in the wrong spots meaning that it would wait for one instance to complete a bunch of stuff before it would move onto the next one.

    See the notes in the project file for more info on what I have done :)

    No problem, the bump was just a general bump not trying to push you to post earlier. Sorry if it sounded that way. Thank you VERY much for fixing the issues in the project.

    If you don't mind I have a few questions, since I thought I understood how these things worked better than this.

    - Let's start with the simple one; wouldn't 3 For Each loops be an issue performance wise?

    - Same question for picking, we're doing lots of picking in this event now. Won't that be an issue performance wise since it has to pick ALL instances then filter through them? Doing that multiple times isn't an issue? Let's say I have about 100 enemies on the screen at any given one point and about 10 villagers as a worst case scenario (this of course excludes GUI, background elements, objects and VFX).

    - Is setting UID to -1 wrong? I am asking because I saw you set it to 999 and I wasn't sure if UID can be set to -1 or not.

    - Why did you do the pathfinding this way?

    https://imgur.com/NPSyqyP

    Didn't the part that says "Pick Villager" in the screenshot above already picked the villager? Why not use that then to pathfind directly instead of saving its location for later to pathfind to separately?

    I am asking because I am trying to understand the mode of thinking so I can modify my own.

    Thanks

  • Hope this is OK, but bumping as I am still not sure how to fix this. :/

  • Ok. It's too hard to troubleshoot without seeing the project file. Upload it and I'll take a look

    Here is the .c3p file:

    https://www.dropbox.com/s/4f401hx6oj3e36n/Defendor.c3p?dl=0

    Thanks.

  • Have you tried disabling the first else event just to see if it is interfering?

    Also is the basicrange.attackspeed a fixed value and is it correctly set on all of your instances?

    If with the first else you mean the one with Every 0.2 seconds as a sub event, I did that. Same issue, but a new one crops up where if the target moves away, now the enemy doesn't follow it.

    If you mean the one with the pick random villager, then I did that and the enemies don't pick a random villager and stay put after the villager they were going after stops.

    I am pretty sure they all have the proper values since I set it in the Project hierarchy and not individually. But I double checked and selected them all one by one and they have the proper values -- 300.

    That said, there is something I noticed that some of the enemies do when the game starts stand there doing nothing they are in a "moving along the path state" but not moving. At least I am guessing so because they are doing an animation that is ONLY triggered when the enemy moves along the path. I don't know what is going on there.

  • Perhaps a rounding error at the edge of the attack range? Maybe have them stop after they are slightly closer.

    I don't think so because the targets move so sometimes they get closer to the enemies anyway and still no attacking happens. I also just tried adding a wait > 0.2 seconds just before stopping (should be enough to decrease the distance) but no change.

  • Hey all,

    So I am working on AI for my enemies and I am facing a issue and I am not exactly sure of its solution. First off, here is my AI "code"

    The problem is that not every enemy of this type is actually following the AI code. I have about 5-7 enemies on the layout. They all follow the "Find path" part towards their targets. They all reach the targets and stop within the distance "attackRange". However, of the 5-7 enemies, only about 1-2 shoot their targets while the rest are just standing their doing nothing. Any idea what is wrong?

    Note: I am using Find Path every 0.2 seconds because the target is moving and don't want the enemy to pathfind to an old position.

  • That is correct...

    I just checked my sample with debug mode, and saw that the angle gets set to 0 when the speed is set to zero.

    I thought that might be a bug, but then I read up on the Bullet behaviour in the documentation, and it says that is how it is supposed to work. So, your solution of storing the angle is the best option.

    Gotcha! Really weird that this is intended behaviour... but yeah, thanks for the confirmation -- at least I am not doing something wrong :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if the bullets change direction, then you have a picking issue somewhere in your code. When you think you are setting a new bullet's angle, you are accidentally setting all of them.

    I set the angle only on creation and I think when you have an action:

    -- Create someObject

    -- change angle of someObject

    Then the second action should be picking the object that was just being created not all objects right? That is the only location I ever touch the angle of the bullet. Set angle of motion and never touch it again.

  • since the player has time to think about their moves, and the enemy does as well, you will probably have to set a limit to how far the bullets can move on each turn. Otherwise the player could just shoot, and then wait before completing their turn - not giving the other player/enemy a chance to move out of the way.

    I took a quick crack at it to see how I might approach it...

    a turn give each side a chance to do 3 "moves" - which could be moving the player or shooting.

    (use arrow keys to move, space bar to shoot). The enemy doesn't choose its own moves, so you have to play as both players.

    http://www.rieperts.com/games/forum/TurnShoot.c3p

    Thank you VERY much, that actually worked. I used your technique and it worked liked a charm. Only difference is, for some reason my bullets forget their angle of motion for some odd reason and start moving horizontally only after the turn is given back to them. I resolved it by recording the angle of motion and setting is back every turn.

    One possible reason is that the bullet is created and the turn is switched in the same tick. Instances that have just been created may not be accessible in other events. You need to add a small wait (at least "Wait 0") before switching the turn.

    That is exactly what was happening I think. The same frame the bullet was created, was the same frame the turn changed. It is good to know that wait 0 seconds would delay an action by at least a frame. This will come in handy. Thank you very much!

  • If the bullet continues to fly and you don't have any other events which can change its speed, then probably the event where you set speed to 0 never triggers. You can check this by debugging.

    I couldn't setup a breakpoint on the events or even conditions as they are classed as a sub event or so and Breakpoints don't work on them. I tried even putting the breakpoint on the function itself and it didn't work.

    Anyway after a while of trying a few different things and experimenting I found something but not sure what to make of it. The action does work and runs. However it runs way too late.

    Once the enemy fires the projectile, the turn switches to the player and this should automatically stop the projectiles but they don't stop immediately, instead it takes them a few seconds then they stop. If I am moving the player constantly (i.e. not waiting and moving the second the turn gets to the player), this can be missed and the projectile doesn't stop.

    Any idea whys is this happening?

  • Setting bullet speed to 0 should definitely stop it. I see your behavior is named "Bullet2", maybe you have two bullet behaviors on this object? Or there may be some other issue with your events.

    This is due to the bullet having a behaviour and then I added it to the family. So it got renamed. I removed the first one. So it has only the Bullet2.

    Any hints what could be the issue. I just create the bullet and that is it. I don't give it any other commands except setting speed to 0 as you saw.

  • You can set bullet speed to 0, or object time scale to 0.

    Setting the bullet's speed to 0 didn't work. Disabling the behaviour didn't work either. Here are my events:

    https://i.imgur.com/JqVIjha.png

    But if you want your bullet to move from tile to tile, I would suggest using MoveTo behavior instead, or TileMovement behavior. You'll have precise control over it, which is not possible with Bullet.

    No, I want the bullet to move a bit each turn. I actually would prefer if the movement doesn't follow grids, unless it is easier to do so.