Generate complex structures

0 favourites
  • 6 posts
From the Asset Store
a complete set of modular graphics, perfect for all kind of levelbuilding
  • Hi all,

    I'm making an asteroid mining game caled 4660 Nereus http://crudepixel.com/4660_nereus/

    I'm generating the levels in code but I'm not happy with the asteroids. I want to be able to generate asteroids made from groups of smaller physics objects, so one large asteroid could be made from 25 / 50 smaller rocks all built randomly, and joined / positioned properly together.

    I have no idea where to start with this, so was wondering if anyone had any ideas or best practices when it comes to generating 'structures' made up of smaller elements.

    Thanks for any help!

  • I think thats quite a difficult thing to do unless you dont mind having some really wierd shaped asteroids. Maybe reach out to Colludium who might share his physics object connecting secrets

  • I think thats quite a difficult thing to do unless you dont mind having some really wierd shaped asteroids. Maybe reach out to Colludium who might share his physics object connecting secrets

    Thanks for the vote of confidence!

    CrudeMik, I'll help if I can - I will ask some questions as we go... The most important question is do you really need to use physics for this? The native box2d web, asm.js and also r0j0's chipmunk physics are all very good at letting you create simple joined shapes with a few objects linked using distance joints or limited revolute joints. But, as soon as you exceed about 10 connected objects then you almost invariably end up in a land of joint fighting and exploding object groups!

    IMO, up to 50 objects might be possible using C2 in zero gravity, but there would be serious limitations to how that group could interact with other objects in the layout; the fewer the better for consistent behavior. As soon as something bumps into a large group like that then the you run the risk of everything falling apart (a problem that is exacerbated on older hardware - it's worth seriously considering allowing the behavior to appear to slow down with an fps drop rather than let it compensate - fixed time steps rather than framerate independent could be the way to go).

    All of this is probably not just a limitation of c2 and probably applies to most other 2d game physics engines. My Dynamic Sketch Book game joins objects of low mass and low restitution by using lots of distance joints - I found that limited revolute joints were too prone to fighting, and I also found that external interactions with the new group were not good (prone to cause the group to explode). Zero gravity is less stressful on a large group, so you might get away with it if you're careful.

    It's also worth considering if you could get the same effect by making all of the asteroids immovable physics objects and just have everything else in the layout move around them... Then you could have amazingly complex shapes with no interaction problems!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Colludium spongehammer

    In the game, which is zero g - I have two ships the player can control, they can both latch onto moving asteroids and use thrust to slow / speed up rotation or move them through space. This is an aspect I want to maintain

    I know it's a big ask, but without loosing this functionality, I also want the rocks to be made up of smaller elements, so players can break specific sections off and even tunnel in to / precisely split larger asteroids in half, while the asteroids are free to rotate, move and collide with each other.

    Again, I know it's asking a lot and it might require a different tech, like voxels perhaps which I can't do in C2.

  • I love the concept. My recommendation would be to join a few together and then see how it could fit in to your tow system. I suspect that offering the player the freedom to edit the shape any way they want could result in instability sometimes. It might be easier to manage it by offering the players a weak seam they can mine down so you retain control of the shape - that way you have one asteroid with a selection of removable sub-sections - pin then on with physics disabled and then only enable them when you free them.

  • Colludium thanks, that could be a good compromise, I will prototype it and see what happens. Cheers, good luck with Dynamic Sketch Book!

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