Ramladu's Forum Posts

  • Thanks. I understand what you're saying. I'll give it a whirl. Tilemap reminds me of Microsoft Excel spreadsheets but no offset() function here - well, unless I build one. :-)

  • Hi,

    As you can see below, I want my player unit to move up on my tilemap. It does it successfully. However, now I would like to figure out a way to identify which type of tile the one-up is before the player goes there.

    For example, let's say the tile up from the player is a tree, and I want the player to chop the tree each time it tries to move up and the tree is in that tile up.

    I believe I have it set correctly except for being able to check before the player moves to the tile:

    tilemap.tileat(tilemap.positiontotilex(OverlandMapPlayer.x),tilemap.positiontotiley(OverlandMapPlayer.y))

    I assume I would need to add a condition that checks for the tile up from the player and then a sub-event or otherwise that will move the player if it is an open tile OR if it is a tree tile. I can then use my tree-chopping function/mechanic.

    Can you help me identify what I need to check? I assume I need to do tileID - 1 or tileID - Column, etc..., or is there something built in?

    The other idea I have is to move the player UP, then check what tile it is ON, run a checker function to see if it's a tree tile and then knockback the player to the original tile, while also completing a chop at the tree. Then rinse and repeat assuming AP > cost and tree hp > 0.

    Thanks!

  • I think I solved this once by picking the topmost based on Z-Order. IE. If two enemies are going to be hit at the same time via a collision detection, then it will take the one at the top of the Z order on the layer. I also did this with mouse click to loot an item that happened to spawn very close to another piece of loot.

    Here is an example based on mouse click and having two loot items on the same coordinates.

  • Thanks. I bow to you.

    I didn't try the nested technique. I tried them separately and thought I kept getting close. Now I know the magic. Lesson learned.

  • Hi,

    I am back. I have searched through 5 pages of tilemap forum posts and either I am not understanding it or it's not being addressed simply.

    My objective:

    At runtime, user mouse clicks on tilemap object, return the tile # in a textbox so the user knows what it is.

    Kind of like if I click on a sprite, I can get the frame #. Let's say user clicks on a tilemap object but more specifically, the tile and there's a number associated, from there I could then have an array with elements that matches with the tile number and then tell the user that they clicked on the "Swamp" tile.

    Is there a simple way to do that?

    I know how to set a tile at X = 5, Y = 5, tile = 5 which will put in the 5th tile in the tilemap tool in the 5th column on the 5th row in my tilemap placed on the layout. But how do I get that same kind of data by using a mouse click. "You clicked on the tile in X = 5, Y = 5, and is the 5th tile in the tilemap tool"

    Thanks. I appreciate how helpful everyone has been over the last few weeks as I continue to improve my skills.

    I am thinking maybe the only way to do this is create the actual tiles at runtime, storing an array after each tile by running a for loop I <= #tiles to generate on each row, nested with a for loop for columns, and then storing what I want to store into other arrays or a single multidimensional one. But then again, how do I return the value of the tile that was clicked on.

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Thank you. I'll check it out!

  • I have a weird question but how do I return a path cost based on the user hovering over an area of the map (with mouse) that they would like to move their character? I am thinking of a game like Jagged Alliance 3 which shows AP cost to move before the user decides where to go. Once I understand how to capture the pathfinding cost, I can use some math to make a user friendly read out for the user.

    I read the pathfinding behavior documentation and I am generally familiar with pathfinding but in recent weeks, I've restarted my game after learning new techniques and now I am trying to learn more about pathfinding to better inform the user.

    I can return X,Y calculations and use the abs() with some fancy math to calculate the distance between the character's current location and the desired location but that is not the same as pathfinding cost. My way actually does work fine however not when I throw blocks in the way or costly terrain pieces.

    Side note: I understand Manhattan versus Euclidean distance if that helps. I teach ML/AI. Computer game design is just for fun.

    Thank you

  • I'm seeking advice for my game development project. I've been working on enhancing the Collision detection for items that players can pick up in my game. Right now there's 6,000+ detections per second. That seems very high, but I am not sure if it is.

    I'm torn between utilizing Collision detection for item pickup or implementing a hovering for more details and a click on (with distance from loot calculation) mechanism trigger.

    Performance is a concern, and I'm unsure if my current approach is optimal for my game's performance. I'd appreciate advice on the best approach for Collision detection and how to optimize it without negatively impacting performance.

    I put together a Youtube video to narrate my work.

    youtube.com/watch

    Update: I did test the hover over and automatically loot technique. The CPU/GPU did not go up nearly to to the level of collision detection so I think I have my answer but I am not sure. I tested it with 30 loot items on the screen.

    Thanks for any advice you have.

  • Exactly. I teach data science at the graduate and undergraduate level and it's the same way. It's easy to get carried away with the ease of developing models without understanding how to make the more efficient.

    I got the in-memory down to 200MB, quite a contrast to the 1600MB.

    That still seems like a lot. I am going to test it a bit more. I have over 300 skill icons. My original plan was 10 classes and 30 skills each. The sprites are probably more detailed than they need to be. Most of my sprites at run time are scaled to get to be used at 16s, so 16, 32, 48, 64, 96, 128, but I still have a lot of images at 128, 256 stored natively. No more 512s though anymore and that world map at 8k resolution is tweaked down.

    This experience is going to be a good analogy in class when we talk about useless independent variables in our regression models. Although I come to Construct 3 to play and get away from work. :-) Worlds colliding...

  • Thanks. I got a 40% reduction by right-sizing the enemy units in the sprite. More work to be done but the path is clear. I also had an old worldmap in 4k resolution. Oops. "Just because you can, doesn't mean you should."

  • I know the funny answer is to just not have any images in my game, but withstanding some Friday fun humor, what really causes this number to be high?

    I currently have 1633mb +- running per the debug layout and that seems way too high for what I am doing. I have a simple 896 x 512 layout with 2-d cartoon style graphics.

    Is the estimated image memory based on the original size of a sprite frame? For example, if I have a hammer that is a 512x512 pixel image but I only use it as a 64x64 image in my actual layout, is the estimate image memory based on instances live in the game or based on actual sprite object values? Does my question make sense?

    My debug also seems to have found 560 active objects too. I wonder if my layouts such as my GUI are also affecting it. For example, I have a layer for player inventory and skills, which has a lot of buttons, shapes, and icons as you may imagine. Nothing I can really do about that since I want the player to be able to access them on the battlefield.

    I think I answered my own question.

    Always learning...

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you. I will check it out. It makes sense.

    I did the x,y as a simple test the other day and it works. The objects continue along their path like a bumper car or pinball machine bounce over and over again which is fine. I could also run a find path after the collision and the x,y adjustment or a stop path finding for a "dizzy" or "stunned" effect using a wait N seconds before starting again.

    So many possibilities! Fun!

  • Hi,

    How do I have two objects bounce off each other when they collide? Is there a simple way to do this or do I need to build collision detection, if statements about the direction the objects were facing, etc.., I am using pathfinding and not bullets.

    In other words, think bumper cars at a carnival. How do I create a slight bounce into the other direction for two objects? The objects use pathfinding to find each other and move. My thought is to create a condition for collision detection then build sub events based on the direction the objects were moving in when they collided, then adjust their X and/or Y values to move them slightly to the opposite direction.

    Just wondering if there's an easier way or I am missing something. Well, both then. Haha

    Thank you much