nimos100's Forum Posts

  • I don't know if I get immersed to games or I would just call it interested, but for me to do either the games have to be spot on. And most games that are released just doesn't do that I think, very few of the big companies that make games, seems to lack the required gameplay elements needed to make interesting games. They have nice graphics and such, but when you feel like you are constantly stopped or prevented from doing what you want to do, I tend to quickly loose interest in the game. I personally like open ended games where you can pretty much do whatever you feel like, when you feel like doing it and not because you have now completed level 1 and ready for level 2.

    So games like The elder scrolls series, X-3 (The old ones) are games that can keep my attention because you can always change things around. But besides games like that, I pretty much only play indie games, they seem a lot more creative than the big companies, maybe because of the drive they have to make there game, rather than just throwing something together that have been seen 1000 times before and make some money from it, not sure.

  • I have some problems with the path finding, and cant see why it doesn't work as it should according to the manual if I understood it correct.

    There are 2 objects that are told to go somewhere near the X. Both have path finding and set to custom Obstacle, the tilemap doesn't have solid behaviour, not that it makes any difference.

    From the manual:

    [quote:1qs6f342]Obstacles

    If Solids, the behavior will automatically mark cells touching objects with the Solid behavior as being obstacles. If Custom, you must define which objects are obstacles by using the Add obstacle action on startup.

    So I tell Object 1 to add the tilemap as obstacle and clear all obstacles for object 2, which shouldn't be needed in the first place.

    [quote:1qs6f342]Add obstacle

    If the Obstacles property is Custom, add an object to mark as an obstacle in the pathfinding grid. If this is done during the game (after Start of layout), you must also use Regenerate obstacle map for it to take effect.

    Since this is done at start of layout Regenerating the obstacle map for Object 1 doesn't need to be there. I was just testing.

    [quote:1qs6f342]Clear obstacles

    Remove all obstacle objects added with Add obstacle. You must also use Regenerate obstacle map for this to take effect.

    So in desperation I added Regenerate obstacle map for both objects which again shouldn't be needed.

    However when I run the program, regardless of adding all the actions that shouldn't have to be there or removing them.

    The objects behave like this:

    The red object behaves as it should, however the green object insist of also seeing the tilemap as an obstacle. And I cant figure out why it does that. As it clearly state in the first quote:

    [quote:1qs6f342]If Custom, you must define which objects are obstacles by using the Add obstacle action on startup

    None of the objects are part of a family or anything they are 2 separate objects.

    Anyone know why the green object behaves like that?

  • Player is overlapping and Enemy is overlapping, these should be able to solve it for you

  • Might not be the most elegant solution, but cant you just make it so when you create an enemy you select one of the pieces, maybe torso, if there is one like that, and make that the "master". Then you copy its UID into a variable called Master_OBJ or something, that all the parts for an enemy have and whenever you have a collision you just select all family objs that share the Master_OBJ value and apply the effect to those objects.

  • To me it looks like it would be better to split it up in to 3 events. Because that way you can lock the chest to an character more easily and it makes it easier to program.

    1. An enemy that is currently not picking up a chest need to find one to pick up.

    Con:

    For each enemy

    Chest is not Chosen

    Enemy have LOS to chest

    Action:

    Chest chosen = true

    (However you need to make sure that the enemy doesn't pick up everything. So we alter it a bit.)

    Con:

    Enemy.interact_UID = 0 (So if the enemy currently doesn't have a chest targeted it will look for one)

    For each enemy

    Chest is not Chosen

    Enemy have LOS to chest

    Action:

    Chest chosen = true

    Enemy.interact_UID = Chest.UID

    2. When the enemy have found a chest to pick up it will rotate towards target. (This is a new event)

    Con:

    Enemy.interact_UID > 0

    For each enemy

    Pick Chest by UID = Enemy.interact_UID

    Action:

    Enemy rotate 10 degree towards (Chest.x,Chest.y)

    3. When reaching the chest it will pick it up (This is also a new event)

    Con:

    Enemy.interact_UID > 0

    For each enemy

    Pick Chest by UID = Enemy.interact_UID

    Distance(enemy.x, enemy.y, chest.x, chest.y) < 10

    Action:

    Chest destroy

    Enemy.interact_UID = 0 (So it can pick up a new chest)

  • [quote:1ovc1i8f]chest has NOT been picked up by player

    chest chosenTRUE (chest has been chosen by a character)

    character has LOS to chest

    • ---- action ---- character rotate angle towards chest (set the character towards that chest)

    But you need to make sure that its the correct character and chest that gets picked, in this case it can be any character that have LOS to a chest which have been chosen.

    [quote:1ovc1i8f](sub events under the above)

    stuff when the character gets within certain distances do certain things

    when character is on top of chest set the picked up boolean to TRUE

    add the chest count variable

    destroy the chest

    If the main event is not picking correctly then this will not work correctly either. So when you fix the main event then you can fix this one as well. As you should then have the correct character and chest selected.

  • I don't think this belong in the beginners section, it is not easy to answer I think.

    And you would probably need Ashley to answer it correctly. Tried doing some tests but the more I tested the less sense the results made, and didn't produce anything that could answer your questions.

    For instant it seems that if you create a image for 1 layout and destroy it straight away the memory is not freed up, which makes a bit of sense if you should need the object later. However if you switch layout some of the memory is freed but not all, even though there are no objects, but you can still make all the objects in your project, again could be because you can then make the objects, however it is still able to free up some. And what exactly are freed up I couldn't figure out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You shouldn't have to keep track of the number of chests to make it work. Your idea of using pick nearest is the way to go as you can use this to pick the nearest, second nearest, third nearest and so on. However to do it you need some way to exclude chests from being picked as the nearest. Which you can do by using a variable "Interact_UID" for the chests.

    So to make it work you could do something like this:

    Set chest as target for character

    Condition:

    for each Character (We need the for each at top, as we want to make sure that chests picked by Chest.interact_UID = 0 gets updated for each Character)

    Chest.Interact_UID = 0 (Means that no character have currently targeted the chest)

    Pick nearest Chest to character

    Action:

    Set Chest.Interact_UID = Character.UID (Now the chest have been targeted by a character. And the interact_UID is set, so no other can select it.)

    Get character to pick up chest

    Condition:

    Chest.Interact_UID > 0 (Its very unlikely that any of your characters have UID of 0 so this should work)

    For each Chest

    Pick Character UID = Chest.Interact_UID

    Action:

    Character (Move to Chest)

    When the character arrives you just need to make it so its the correct character that picks it up. To do that best, depends on what type of movement you are using, Path finding, Per tick etc.

    The best thing to do, if you need the characters to do a lot of different automatic actions is to make some kind of state machine if you don't already, otherwise you will most likely end up loosing control and have a very hard time getting characters to behave correctly.

  • You need to pass something to the function. Most likely the UID of the newly created crab.

    So in:

    Call "EnableCrabby" (Crabby.UID)

    Same goes with the call to "CrabbyGO"

    Also in the functions you need to pick the crab as well-

    So "On "EnableCrabby" you have to add

    Pick Crabby.UID = Function.Param(0)

    Same goes in "CrabbyGo"

    Otherwise the function don't know what crab it should work with and just pick all of them, and that's why they all behave the same.

  • Hello

    i have been thinking about this since i started this project.

    Can you please take a look at this? Fps looks fine but there are too many collisions.

    http://i59.tinypic.com/2vmiz4z.png

    12161 collisions in total and 248/tick. Isn't that too much or is this just normal?

    poly checks 504 in total 10/tick

    and numbers will roughly be doubled when im done with this project.

    Do i need to worry about this and look for solutions or is that ok? <img src="{SMILIES_PATH}/icon_neutral.gif" alt=":|" title="Neutral">

    Difficult to say what is normal, it depends on what content your game holds.

    1 object needing collision detection against another object, will do 60 checks per sec and ~1/tick

    So depending on how many objects and events you have that requires collision checks this number will increase.

    An example:

    1. Your player have path finding and on the screen you have 1 solid object and no events that need to check for collisions. Then you will have a collision check / sec of 0 and ~0/tick

    2. Same as above but this time you have one event that checks for overlaps with the solid object, which would give you a collision check / sec of 60 and ~1/tick

    3. Same as above but now you have 4 solid objects and 3 events that checks for collisions, which gives you 720 collision checks per sec and ~12/tick

    So whether you have to many or not is hard to say, it depend on you having events that are not needed or to many objects on the screen that wouldn't need to be there. however as you can see from the last example, which doesn't really have a lot of collision objects or events the count is already at 720 checks per second. So 12000 checks is not a lot and in above example it can be achieved by increasing the number of solid objects to 20 and the event count to 5 as that would give you 12000 checks as well.

    So if you have some enemies, a player some bullets etc that need collision detection the count will go up rather fast.

  • I don't think there are any different really. 50 images are 50 images. You could probably argue that making 50 individually images would have a bigger impact since it would have to take the objects into account, but I think that would be such a little impact that it would be a lot more efficient to just reduce the image size by 1 pixel.

    Anyway not 100% sure, its just what I think

    [quote:2o9onqn3]Then when overlap occures i compare the animation frames of the one on the background and the one dragged over. Is that the way to go?

    Yeah that should work fine.

  • [quote:21iwyttg]1. How do I do ... a simple pathfinding?

    For example: I have a "Game Over" screen where I want the "Game Over" sprite simply to move from one position (y coordinate) to the other (from below the screen to the middle). Some easing would also be nice.

    At the moment I am either using the bullet behaviour on the object and set speed to zero if it reaches a certain point/coordinate, or to do a "simulate up" on that object.

    However both methods seem fairly unsophisticated to me.

    I don't think there are anything wrong in the way you do it, using path finding for this would be a bit "overkill" as it would be required to calculate a path there. But since you already know exactly where it is going and is going there each time, starting to calculate a path just doesn't make much sense.

    It might be unsophisticated, but its a simple and effective way of doing it, there are no reason to make things more complicated than they need to be in my opinion, the simpler you can make something that works the better, as there are less chance of bugs and it will make you develop faster. And ain't that what is most important.

    [quote:21iwyttg]2. How do I ... work with Layers correctly?

    Same example as above: The game ends and I want to bring a "Game Over" Screen. I know I could make a Game Over - "Layout" for it however it feels better to me using "Layers" because first of all I don't want the music to stop and want the background to keep moving. It simply feels good I think, if a few things stay but just the layer changes.

    That's why I make certain Layers (Game Elements, Player, Score etc.) invisible and another Layer (Game Over Screen) visible. But: Even though a layer is invisible you can still click on items in that layer. (for example you can still click the "invisible" Layer's Game elements). For a workaround I am now using global variables (game_element_layers = false, game_over_layer = true etc.).

    But still that way doesn't seem so intelligent to me.

    Making UIs are on the very top of things I don't like making, it takes a long time and is really boring And one of the reasons are as you mention, they require a lot of uninteresting coding.

    I normally do somewhat like you, when creating layers, probably not as specific as you seem to do, but a normal structure for me is something like this:

    Optional:

    Depending on the game im making:

    Collision (Will hold any collision elements that are invisible. And not part of an object in one of the other layers.)

    Markers (If I want to make a more sophisticated building system where markers would be needed, then ill put them here)

    4. UI (Will hold all UI elements that requires a parallax of 0)

    3. Game high (Flying units, clouds, tree tops, and pretty much all objects that should give the impression of being above the player)

    2. Game (All characters go here. Player and enemies a like, exception might be flying units and structures that the player can walk around in)

    1. Game Low (All objects that needs to be on ground level, such as rocks, objects that can be collected, but in general objects that can be interacted with and ofc aint suppose to be above the player.)

    0. Background (All background stuff, that normally cant be manipulated, exception might be Tilemaps, depending on the game)

    But as you said you need some way of detecting whether something should be clickable or not. In your case you don't need a global variable you could just check whether the layer was visible or not. But in the end its pretty much the same, you need to check vs. something no matter what.

  • Please when you get the time could you take a look at my new setup, it does seem far more stable and easier to manage am I going in the right direction and any tips on a priority system?

    https://www.dropbox.com/s/2g71o91svb1g6ld/ai-test.png?dl=0

    Its quite hard to see if you are going in the right direction as I don't know your program, but if it works then I assume its fine. One thing that you might consider, unless you do it somewhere else, is in the function "Find area" to lock the area that a worker is moving to, I would imagine not doing that would at some point give you some conflicts with several workers trying to go to the same area.

    So when a worker is found set "sm_need_worker = false" for the area.

    Also in your for each events at the top, I would personally reorganize it a bit, here is an example:

    I would also advise you to start commenting your things, at some point if you don't, you will loose control. And it makes it a lot easier for yourself to later go in an make changes down the line.

  • To further complicate things, C2 doesn't let you pick a newly created object until the next top level event, so that's getting in your way too. One trick is to put a "Wait 0" before your function call. This will suspend the call until the end of the event sheet and call it then, allowing the pick.

    There shouldn't be any problems in this case, as its within the same scoop so passing the Casino object and picking the family object with it will work fine here.

  • Without the full code its hard to judge as I don't know exactly what your objects are, so its ofc a bit of a guessing

    However it seems that you don't need "Rooms Roomtype>= 3" as you don't use it for anything, unless something requires it to be more or equal to 3?

    There are some things you need to check:

    1. You have to make sure that you don't have several ConstructionFloors that are equal to 3, otherwise you cant be sure what you pass to the function.

    2. Is ConstructionFloor also part of Rooms family? if not then you cant use Param(0) to select it? In that case if Casino is part of the family, you can pass its UID as Param(1) and then select the Rooms using that instead.