0 Favourites

Agar.io Cell Splitting and Merging

  • Here are my attempts for recreating the essenial Agar.io functionality. None of them works as should. I have spent numerous hours trying to make this work. Here are the best results possible. I begin to doubt if it can be done at all. Perhaps a programming background is needed.

    Check out my capx and please improve on them. Let's make agar.io clone. This would be something as there is not any "playable" multiplayer tutorial made. This would be the ideal result.

    Can agar.io be recreated?

    Can you improve on my attempts. Share capx if you can!

    Ps: I might have gone little wild while making the events in some of my capx. Please don't hold it against me. I have been trying hard to push the idea into practice no matter what!

    Copy the URL from between " ". I could not post it any other way.

    !!#$!$" dropbox.com/sh/xm3yui69q09rxez/AADJMd_xnEo6AQ8vXt_OSJ7Pa?dl=0 "!!#$!$

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You are using too many 3rd party addons for me to really bother and load your capx files.

    I can say though, for certainty, that what you want to do is totally possible. It really just depends on exactly how you want it to look, and what other features you are including (does your blob have a "bendable" border on it? - does it have the same "wobble" effect?)

    Anything that is 2D is possible in C2 - anything. It's always just a case of creative thinking (for non-programmer) or knowing the proper math (for programmer).

    ~Sol

  • I admit i installed some addons for various projects. Nevertheless, "Addons free" construct 2 that i have just installed on another computer requested only "move to" and "push out solid" addons. I suppose two is not that many. While "move to" might not be relevant, Push out solid seemed to me to be crucial and is used in the events. Therefore two addons is not that many in my opinion. Even God in many religions has three forms. According to the alert i received, i have not exceeded the "holy" number.

    I have not attempted recreating the bendable effect and any other special effects.

    All i want to have is

    1) cell splitting that do not overlap with each other while they do overlap with the enemies. (i did that with bullet behaviour but the cells unexpectedly self anihilate, i did that with push out solid but when there are too many cells, they still overlap or "get trapped").

    2) cells merge with each other after a while.

    3) all that in the moving motion that is also flexible i.e some cells seem to move a bit faster at times.

    Basically the problem i encounter is an overlapping prevention for the cells, while they can still overlap with other enemy cells.

    I did a thorough research on the forum and there have been some attempts to make a "relative overlap" while moving but no one succeded as far as my research is concerned.

    It could be that some clever math has to be implemented but i am clueless where to learn how to implement it.

    I think the agar.io functionality might be problematic in a sense of not being straightforward, because there are some youtube tutorials on how to recreate growing and shrinking (even in a multiplayer fashion). However there is none on the essence i.e multiple cell splitting while following mouse movement without overlaping for the player while allowing overlaping with the enemy.

    Perhaps agar.io surcecode could be helpful but getting it seems dubious.

    Perhaps i shall post images of my events.

    I appreciate any hints or even better, the solution itself.

    It has been driving me crazy. I literally spent three months trying to figure it out.

    Thanks in advance!

  • Ok let me think about this and I will see what I can come up with

    ~Sol

  • Great! I am looking forward to that! I hope you will bring balance and calm my obsession by making it work the way it is in the game!

  • OK so working on this idea for a bit - I've figured out a few things that might help you.

    I'm still working through the logic of getting this to work how you're wanting it to and it's getting fairly complex already... but hopefully I am commenting it enough to help with that.

    I will post it up after I've got it working a bit nicer

    ~Sol

  • This is it so far HERE - because I will be going to bed shortly. I will continue on it later, but maybe so far it will help with a few features that are working.

    I still need to make the split cells spread out from each other, and make the initial split cell "shoot" forward a bit. I also need to clean up the merging after the split timer expires because currently with more than one split, they all just instantly merge to the main cell instead of gracefully "flying" into it.

    For the enemy cells it may be easier to create a totally new enemy cell object for the client reactions. Having the player cell as an instance could get messy.

    Currently what is working (but could probably do with adjustment to amounts/figures) is the speed based on mass and distance to mouse cursor, and splitting/merging cells (as long as they're at least Mass 8). You can set the instance variable to the Cell before you run it to have different mass on start, or add event to startup for desired beginning mass.

    Hope this helps so far at least. Will improve hopefully tomorrow a bit more.

    ~Sol

  • Thanks for the contribution. Unfortunately, i have not viewed it yet, because i am being cut off from my computer for the weekend. i am fidgeting to see it though. I hope you will make it as good as it can be. My goal would be to actually make a clone. There is not any tutorial on a fully playable and engaging multiplayer out there. It would be awesome to make it following agar.io. Just by reading your post, I am a bit concerned whether i can pull this off on my own since i could not even make the splitting / merging. It seems it is even more complicated than i expected. Anyway, i am already very thankful that you took interest in the idea and made effort to make it happen. I would have been stuck anyway if it had not been for you. Therefore you have already pushed it forward from the plateau!

  • What you have done is really awesome, you have BRAINZ and you know how to use it! However the biggest issue appears to remain that is cell overlap prevention... Could you or anyone fix it?

  • Sorry I haven't had much time lately to look further into this.

    I was planning on adding the BOIDS PLUGIN in order to get a "flocking" system going. I could possibly write a vector function to control this - but it would likely be less efficient than using the boids plugin.

    Hopefully I'll get some time soon to take another look at this.

    ~Sol

  • Please do have it on your agenda. I have played with the boids plugin a bit but still could not find the solution, because the cells overlap slightly in the end. Please find some time to get round to this. Without your professional help i might be stuck with this for another 3 months or even more.

    In the meantime i have done some more "googling" to find that agar.io is supposedly using a data organising concept called "quad tree". My knowledge on this is only based on a few things i have read and i cannot conceive how it is implemented. I also hope it is not a dead end road with the quad tree as not all the info out there is reliable. I treat this info with caution.

    By the way, how did you gain the experience to be able to come up with things like that? Would you be so kind to drop some hints on how to get better at inventing/developing the code the way you CAN do it. Maybe a list of books or training processes worth undergoing which are based on your experience?

    My Construct 2 programming knowledge is only based on what i manage to find / or fail to find on this forum as well as it is backed by the very few books on construct 2, which are already a bit out of date as new features are being added and other were dropped like webStorage for instance. To be honest i wish there was one as concise and comprehensive booksource on Construct 2 as it can be or a really thorough tutorial showing how some of the really beautiful games have been made. The games i can do are pretty crude in nature like old nintendo games. They do not appear as playable and flashy as some of the games a i have seen.

    Therefore what would you recommend to do in order to get closer to your level of game dev. craft?

    I also wish i could offer something in return. That might require sending some links, which i do not really want to do to keep things within the forum regulations. I do have a pretty extensive list of hobbies to tell you about if you are interested in learning about.

    i'm biding my time until you crack the overlaping prevention thing.

  • My "experience" has been basically using Construct Classic and Construct 2 since, well, Construct Classic was fresh off the shelf. It's been a few years now... and before that I was using products that "inspired" the creation of Construct - mostly Multimedia Fusion 2.

    I then began to bumble through things, and ask a bunch of super annoying questions to the people in-the-know. Essentially... I learned by screwing things up and asking for help (a bit like how you're asking for help). I also just read through topics in the help forum and took notice of the results that people posted - basically if I thought "Hey maybe one day that might be a useful thing to know about" I just read through it and even saved the example capx files for reference later on.

    So anyway, I will take a look at Quad Tree stuff as well (I know a 'little' about it, but I will see how it maybe applies to Agar.io) and check what the boids plugin can do as well. I think boids should work fine with the proper adjustments to the boundary thresholds.

    No promises on time-frame though... as again this evening I have plenty of work to complete. I haven't even worked on my own project for almost a month now, so I will take a look again as soon as time permits.

    Cheers!

    *EDIT*

    Updated capx on post 1st page. Added boids with some quick behaviour settings and they behave pretty neat now. Try to make a big one (like 400 mass) and then separate into a few "blobs". Also set the wait timer to longer (like 10 seconds maybe). They still overlap a little in certain circumstances - but it could look cool depending how you "dress" the plain circles up. They'd look awesome if they slightly overlapped if they were made to look like some bubbling gelatinous goop.

    ~Sol

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)