DraixPrime's Recent Forum Activity

  • You do not have permission to view this post

  • Does anyone know why this is happening?

  • To answer some questions:

    1. The loop is working

    2. The pathing does not occur in every tick. There are conditions carefully placed to ensure pathing only occurs when needed. The only exception is when a ranged unit is retreating, but the CPU usage is still heavily used when units are not near each other, and only the first half dozen lines of code run. This is because each of the 4 factions can have 120 combat units at a time, which means the loop could run 480 times 10 times per second which taxes the CPU even if every unit is sorted out within the first 6 conditions.

    3. The different families are in place because the sprites are used by both factions. Therefore, if Unit A attacks Unit B, Both would be referenced in the same family, requiring local variables to be used to ID 2 entities using the same family. Instead, I have 2 separate families so both parties can be easily identified.

    The scale of the game is pretty large. I asked about the feasibility of multi-player for a game of this size in another thread and was told it would likely be impossible to keep 800 sprites updated in real time. I eventually want to move out of Construct 3, as I want the game to be 3D eventually, and I keep getting the feeling the engine was not designed to run an RTS game.

    I will try the spirtes idea and update back.

    I posted this earlier, and it says it needs moderator approval, I'm unsure why, as nothing else in this thread did.

  • I implemented the sprites idea as pictured below. The CPU usage has fallen by half. It's not perfect, but it is likely as close as I can hope to get with the engine. Thanks for the ideas, if anyone sees a problem or inefficiency with the way I implemented it, please let me know.

  • To answer some questions:

    1. The loop is working

    2. The pathing does not occur in every tick. There are conditions carefully placed to ensure pathing only occurs when needed. The only exception is when a ranged unit is retreating, but the CPU usage is still heavily used when units are not near each other, and only the first half dozen lines of code run. This is because each of the 4 factions can have 120 combat units at a time, which means the loop could run 480 times 10 times per second which taxes the CPU even if every unit is sorted out within the first 6 conditions.

    3. The different families are in place because the sprites are used by both factions. Therefore, if Unit A attacks Unit B, Both would be referenced in the same family, requiring local variables to be used to ID 2 entities using the same family. Instead, I have 2 separate families so both parties can be easily identified.

    The scale of the game is pretty large. I asked about the feasibility of multi-player for a game of this size in another thread and was told it would likely be impossible to keep 800 sprites updated in real time. I eventually want to move out of Construct 3, as I want the game to be 3D eventually, and I keep getting the feeling the engine was not designed to run an RTS game.

    I will try the spirtes idea and update back.

  • The goal of the code is to determine whether a valid target is within range and then how to attack it. What it picks and how it responds depends on the target's distance and the Unit's attack type (range or melee) I guess I'll post the full section of code here since it of itself can't be usefully stolen. The 0.1-second condition was added purely to limit CPU usage because targets didn't really need to be checked 60 times per second.

    I like the sprite idea; however, would the engine have to render the range sprites constantly? some units have a range of 1000 pixels, would that be a concern? If it is would the invisibility of the sprites stop the engine from rendering them?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For reference, the families "UnitsandBuildings" and "Targets" are composed of the same objects, I have them this way so when they interact (combat) I can distinguish one from the other. As this is a real-time strategy game, hundreds of these instances could exist at the same time. This results in these pictured lines of code running hundreds of times every tenth of a second. Is there a way I can pick all instances of a family near any instance of another family without having a loop that runs 1000+ times a second?

  • I am currently developing an RTS game. At the "peak" of the game, each of the 4 factions (players) could have 200 "units" and 50-75 "buildings". I am interested in making the game multiplayer, but I am concerned with the feasibility of such a project. From and bandwidth and processing standpoint, is it feasible for the engine and/or web socket to accommodate such a game? Also how feasible is it for a person to develop such a project? I have used Construct for a little over a year, and have a pretty good handle on a lot of Construct's features, but would not consider myself an expert. Can I get some advice on how large of a project I am getting myself into, please?

  • Not yet, I guess I'll wait and post some more.

  • I see. Thanks for the help with the issue and for the advice about being able to hit multiple enemies.

    Also, I have no edit button available to me.

    Image:

  • Fixed it; I believe it had a quirk with families.

    I used the de-bug layout and it would select the 0th instance, destroy the bullet, apply the damage, but then select the [new] 0th instance, destroy the bullet again (fail?), apply the damage to the now 0th instance, and so on. The UID ensures that the event isn't trying to use the same bullet to damage multiple objects by checking the UID of the bullet isn't destroyed because once the bullet damages one instance it is suppose to be destroyed.

    Image:

    Btw: it would be nice to be able to edit posts here, no other forum I have used lacks this ability.

  • Image (it didn't show up earlier)

DraixPrime's avatar

DraixPrime

Member since 20 Apr, 2021

Twitter
DraixPrime has 1 followers

Trophy Case

  • 3-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

5/44
How to earn trophies