Generate complex structures

Get help using Construct 2

Post » Sun Feb 08, 2015 10:42 am

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!
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Sun Feb 08, 2015 11:06 am

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 :)
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252

Post » Sun Feb 08, 2015 2:39 pm

spongehammer wrote: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!
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,296
Reputation: 47,576

Post » Mon Feb 09, 2015 10:19 am

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 Image

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.

Image
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Mon Feb 09, 2015 1:07 pm

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.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,296
Reputation: 47,576

Post » Wed Feb 11, 2015 9:39 am

@colludium thanks, that could be a good compromise, I will prototype it and see what happens. Cheers, good luck with Dynamic Sketch Book!
B
44
S
13
G
8
Posts: 622
Reputation: 7,417


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 33 guests