Posts by Ancalagon18

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.

    Hey all,

    I recently decided to try out some multiplayer game-making because I liked the idea of the challenge. After watching some tutorials and fumbling around with what I had, I have a rudimentary game that functions, but it needs some work. Because I've had a hard time finding information, I'm making this post to not only ask, but to provide an example file of my work to anyone else who is trying to do the same. So here are my questions:


    1) Blasting, sending and "creating bytes?" I have this part of my code from a Russian Youtube video, so I only know that it does work but don't really understand the entire part of WHY it works or how it does so. Can anyone elaborate on sending data (positions, internal values) and properly placing it to each player it belongs to?

    2) I'm guessing that it's better to have each client (peer) send/receive data to/from a server (or singular place) as to have everyone be the same and to prevent "hacking" data, but I have really no idea what that would look like. Anyone have any pointers as to getting started?


    That's all my questions so far. I know I'm still scratching the surface of multiplayer, but my hope is to make something "simple" the first time around and learn.

    I'll certainly take a look at that.

    When you talk about running things at 60, 30 or even 5 FPS how do you go about that? You mention a timer, so would you set a timer or counter to 0 at the start of the code, then each program loop add to it, only executing (activating a group) at certain values?

    Right now my largest load fastloops are player controls/physics and enemy physics. Apart from that, I use ForEach loops to control the AI, which can probably be simplified to run at 5 FPS and even smaller ForEach loops to deal with bullets, pickups and other odds and ends when necessary.

    Also, since I have enemy variants spawning based on probability (50/100 chance to spawn variant 1, 25/100 variant 2 etc) I have some questions about that if you don't mind. Basically, there is an object that acts as a spawn point and then for each of those a random number is generated internally and based on that the enemy variant is spawned. Here is where it gets icky and I have questions: I want to have variable odds for the different variants I preset each level. So I have a value-storing object I use to preset those. When spawning an enemy, it uses random(sum of all the variants probability). So each variant has a different weight value and then I add those up. So if variant 1 is 50, variant 2 is 25 and variant 3 is 25 I get a total of 100. Make sense? I hope I'm explaining myself well. But I can't just test for that value between say 0 and 50 to make variant 1 and between 50 and 75 for variant 2 each time, because those weights change each level. So right now I have very long conditions reading like:

    If value is equal/greater than 0
    also
    value is lower than "weight 1"
    then
    spawn Enemy variant 1

    If value is equal/greater than "weight 1"
    also
    value is lower than "weight 1"+"weight 2"
    then
    spawn Enemy variant 2

    and so on.

    As you can probably see, if I have 5 variants for each enemy right now, this code gets long and kinda messy and annoying to expand. Any thoughts?

    Okay thanks for the reply. If you don't mind, I want to run an example past you and ask a few questions.

    If I went with the first method, what are indexed alterable values? I'm still new and have no knowledge about those.

    As for the qualifier code, I could have each enemy qualified under an enemy tag and do stuff like gravity and horizontal control (not the actual behavior, just what to do if the associated values are non-zero such as fall, jump or move) but also give each "class" of enemy and its variations a separate tag to be more specific with the behaviors, right?

    Also, I was thinking ahead for potential optimization and since I'm using fastloops right now I know I don't want to do those loops (like gravity, horizontal control or behaviors) for every enemy all the time. So right now I have an object that follows the player that acts as an activation collision, ticking a flag in the enemy thus activating them for the loops. Does this work alright? I'm trying to figure out the best time for a fastloop that cycles through all instances vs foreach loops. I don't fully understand them or when to use which, even though I have done some reading.

    Thanks!

    Hello.

    I'm working on a platformer that will obviously have enemies. Right now I have 4 types of enemies (standard melee, ranged, status etc.). The way I am designing this game, each level enemies can have a different preset health/attack value than before, ramping up the difficulty. In addition to this, I wanted a way to make "variants" of each enemy. For example, melee enemies have standard, more damage and self-healing variants to spice up the game a little since battling the same enemies can be repetitive and boring.

    Here is where I reached my problem: what is the best way to do this? Do I need to make separate actives for each variant or should I use different animation directions to differentiate the variants? I've played around with both but I don't know if one is better than the other or if there is an even better way to go about this. I'm somewhat digging myself into a hole since I have like 5-7 variations of each enemy right now (I like drawing and get carried away), so this isn't like your Mario patrolling turtles that have maybe three variants. I've worked out causing their spawn chances to be more or less rare (I think) I just want to know what may be a good course of action to take.


    Sincerely,
    A newbie "developer" who gets carried away sometimes

    With the code I had, it behaved almost the same, but resulting in a "bouncing" effect of 1 pixel while the object tried to fall but then bounced back up above the ground or something odd like that.

    After a good night of sleep I started from scratch, used some flags and nested loops and had a "checker" object loop under each enemy and I got it to work exactly how I wanted it to. I don't know 100% what I did differently (probably just programmed it correctly this time lol) but sleeping on it works! Thanks for the reply!

    Hello!

    I am starting a platformer and was having trouble with collision detection for enemies when applying accelerating gravity. I know how to do it with a player (single-object) and fastloops but when trying to make events that would work for groups of objects (many enemies) I can't check precisely, rather only after each movement, causing objects to detect a collision once they're already inside the ground. I attached a picture of my code (it's pretty straight forward I think).

    Please let me know what you think and what I'm missing.

    Schrodinger,

    Sorry for the late response! I almost have a decent example set to go. I somewhat got it to work, but it is not very streamlined. I was using a gravity variable to determine jumping/falling and then the bottom collision detector on the player for determining a bounce (for a spring-like animation for landing). Somewhere in there due to the fact that the custom engine always is adding 0.45 to the gravity variable, I was ending up with inconsistent results for being "stopped", "bouncing" or others.

    I'm finishing up the latest touches to my example right now and should have the example set to go real soon.

    Hello!

    I am working on a custom platform engine. I've looked into examples on how to do this and taken pieces from several examples and tweaked them to what I needed. The basics are sensors around the rectangle "player" to detect wall and floor collisions. I'll be compiling an example file to attach later as the one I am currently working with is messy.

    My main problem right now is figuring out how to program in the animations with the custom platform movement I created. I cannot seem to find a way to consistently trigger the animations. If anyone has any advice in general, I'd love to hear it while I get the example up and running for you to see exactly what's going on.

    Thanks in advance!

    I will NOT need that many units. My ideal game is a zombie shooter and there won't be more than 250 zombies probably depending on how Fusion reacts to that. I think I got the vector value updating to work, so I'll now work on optimizing the distance-step part and likely come back with questions on that.

    The drawing of the vector field (displaying an animation frame) would simply be for development and seeing it work.

    I was originally thinking to calculate and then store the vector value based on the surrounding tiles so that instead of calculating for each unit on the tile, they would just reference the single value and set their direction to that. My game in mind was a zombie-style top-down shooter where the player runs around trying to stay alive, so the sheer number of zombies (as the difficulty progresses) would probably require computing once per tile rather than once per unit on a tile.

    I'm no programming expert. If I chose to calculate based on neighbor tiles, how would I do that as efficiently as possible? I'm working on trying to use an array but it isn't quite working properly yet.

    I have an example somewhat working right now that is a 640x480 screen with 20x20 tiles that runs the first half of the algorithm. Considering it is a very rough and non-optimized program, it isn't lightning fast but is still considerably speedy. I'll link that file here if you want to see that.

    I've done a lot of reading and I know that in larger maps, you should divide the map into smaller "sections" containing a certain number of tiles. Using that, you only update the values in the section the player is in every frame and only update the other sections to "pathfind" from that section to the next nearest section once if the player is not in those areas.

    So right now I'm just working on a relatively small map. Later I'll work to scale it up.

    I'll post the example. I didn't add in any notations for this one, but using "0" "1" and "2" will cycle through the different view styles so you can see the "scan", the "distance values" and invisible.

    Sorry if I'm not 100% clear. This algorithm I'm making is still new to me and my approach is probably not the most efficient. Here is exactly what is going on in the bigger picture (entire algorithm):


    - Starting from the tile that is the goal, distance values are set based on the main loop index. For example, the starting tile (which is the goal) would be ZERO. Each loop the program adds any unchecked tiles in each cardinal direction (4 directions total for this algorithm's purposes) and then sets their distance value.

    NOTE: I would use 8 directions but I don't want my units to clip over obstacles. If there is a way to get around this I am all ears and willing to learn.

    - Once all the tiles have been checked and updated, the second phase begins. Here, every tile checks its neighbors (the 4 around it) and then finds the one with the LOWEST distance value. Then the tile doing the "looking" stores another value which will "point" to that LOWEST distance value tile.


    Essentially, the program updates the distances and the vectors based on the goal, and then the units "seeking" follow the direction (vector) of the tile they are on top of. This really isn't a true pathfinding algorithm, but accomplishes the same goals. The reason I chose this method instead of true A* is that this will allow for potentially 100s of units to seek the goal at a much faster computation speed than finding paths for each unit using traditional A*.

    Here is a video example of what I'm talking about and trying to replicate in Fusion 2.5. I don't plan on using any code to make the units spread out based on density like his does, though I might consider something like it in the future.

    Please login to see this media element.

    Thanks for the fast reply and edit! I am actually not new to Fusion 2.5 as I've been around since MMF2. This is my first time coming to the forums because I've gotten WAY over my head. Essentially this program is supposed to cause each node to point to the one around it with the lowest distance value, like it does in your edit. This is part of the program I'm working on for a goal-based vector "pathfinding" algorithm.

    I have a few more questions.


    The loop will sometimes cause certain tiles to not have a direction (ie pointing to a node). I'll try to work with it but if you have a quick fix off the top of your head I'd love to hear it.

    Previously I used 4 "scanners" but your change only uses 1 and is placed on the tile rather than all around it. Why is that and how does that work so much better?

    This code is "part 2" of the algorithm. "Part 1" scans outward like A* but from the goal, writing increasing distance values as it progresses. Right now, it works but takes about 2-3 seconds to fully scan the frame. I need it to all happen before it draws the frame. In the end, both Part 1 and Part 2 will be stacked so after the distance values are set, it adjusts the vectors (each part can happen on different frames if the strain is too much). If you're willing to take a look, let me know and I'll upload that as well.

    Thanks again! I'm really interested in game design and right now I'm testing different concepts to hopefully use later.

    Hello! I am still learning a lot and I'm new to posting (I hope this is the correct spot), but I've come across a problem with my code that I can't seem to solve. Here a detailed description of the situation (MAIN ISSUE listed lower):

    I start by spreading IDs through tiles in the map and then assigning a random value to "distance"

    Always spread 0 in ID of "sensor" object.

    I then have a main loop that will cycle through all tiles in the map. When ID = loopindex, it will create 4 "sensors" N S E W of the tile. Next, I run the first nested loop. This loop runs # of "sensors" times. When ID of sensor = loopindex( nested1 ) and sensor is overlapping a tile, take the "distance" value and store it in the sensor.

    Once the loopindex ( nested1 ) = number of sensors, I start a loop "findhighest" # of sensors times. The next bit of code determines which of the four sensors has the lowest stored value (that they got from the tile they are on top of) and erases the others. Once the loopindex ( findhighest ) is equal to the number of sensors, I run 1 loop ( setdirection ). On loop, if ID (tile) = counter-stored loopindex( main loop ) , set direction to look at the one remaining "sensor" and then delete it.


    MAIN ISSUE:

    I told Fusion to run the main loop 1 time (to set up a controlled environment). The code as is causes the desired results. Once I up the main loop (called VECTOR) repetitions to anything higher than one, it skips to the very last tile and then completes the nested loops. If anyone is brave enough, I've attached the project file. I did my best to organize it for easy reading.

    Thanks ahead of time to anyone who can help me out!