Help for the mathematically challenged

Get help using Construct 2

Post » Fri Apr 19, 2013 8:17 pm

Hi All,

Okay, so I wanted to recreate a 3d tunnel effect, like the animation I use in my game "Hexzul" (see here) or (http://www.scirra.com/arcade/addicting-puzzle-games/3478/hexzul). This was mainly to optimize the game, as up until now, I've been getting the tunnel effect by using a 1024 x 670 animation (x17 frames) - see image representation below.



At first I created a single 1024 x 670 sprite to represent each box (thin green line around all four sides and transparent in the middle) and just re-spawned it using "Every x seconds". It was pretty simple to set up, and I was able to scale the boxes (again using "Every x seconds") to create a tunnel effect. Unfortunately with so many large sprites on the screen everything seemed to slow down quite substantially.

Then someone pointed out that I could just use lines rather than an entire box, and "stitch" them together. I've had a go with this approach, and I've managed to cobble together a rather shabby attempt (download capx). It kind of does what I want, but I just don't have the maths skills to get the lines to move together in the correct way.

Could any of you maths geniuses (I know there are quite a few of you out there!) try to help me out please?

Many thanks.
B
32
S
6
G
7
Posts: 489
Reputation: 8,217

Post » Fri Apr 19, 2013 10:49 pm

Not seen your game 'Hexzul', so I am not 100% what type of
tunnel effect you need....

Anyway it is possible to create a basic tunnel effect using just
3 frames-

Capx

Hope this helps.
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Fri Apr 19, 2013 10:55 pm

Capx - 124

Aw man , you forgot to think out of the box ( Understood that one :D ) , now you just have to add the lines as non-moving objects ...

P.S: Try to run the preview without changing anything and watch it for a bit , I swear you won't regret it ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Fri Apr 19, 2013 11:06 pm

@Whiteclaws damn, that gives me a headache lol
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Sat Apr 20, 2013 8:12 am

@chrisbrobs,

Thanks for the example. The tunnel in Hexzul is a little more clunky (as I wanted it to have a retro 80's feel).

But your capx proves that I could do my animation with much fewer frames than I currently have, so I'll give that a try.

Thanks again, you've been really helpful.
Blacksmith2013-04-20 08:23:03
B
32
S
6
G
7
Posts: 489
Reputation: 8,217

Post » Sat Apr 20, 2013 8:20 am

@Whiteclaws,

Thanks for the help, it really does mesmerize (I think I went in to a bit of a trance at one point)!

I did initially try the same approach, but with a much larger sprite (1024 x 670), as I wanted it to look clean on larger screens. But I found that made it run quite slow, once I had a lot of sprites on the screen.

Thanks again for the help though.
Blacksmith2013-04-20 08:25:42
B
32
S
6
G
7
Posts: 489
Reputation: 8,217

Post » Sat Apr 20, 2013 3:09 pm

@Blacksmith, I made a small modification to @Whiteclaws capx. Should be closer to what you want.

GreenBoxMod
B
31
S
6
G
4
Posts: 160
Reputation: 5,998

Post » Sat Apr 20, 2013 3:19 pm

The bigger resolution images largely steal the performance and having a lot of them on screen multiply the performance loss , I suggest adding a destroy if is out of layout behavior to the line object + a little bit of variable tweaking ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Sat Apr 20, 2013 6:57 pm

@bon4ire,

Unfortunately, even with the modifications it still runs at quite a slow frame rate (especially on mobiles).

But thanks for the effort though, your help is appreciated   
B
32
S
6
G
7
Posts: 489
Reputation: 8,217

Post » Sat Apr 20, 2013 7:05 pm

@Whiteclaws,

I did have a destroy outside of layout on my example already. But still exhibited quite a slow frame rate. Not sure if tweaking the variables would help that much really.

That's why I was originally asking about using separate lines and joining them together somehow. Unfortunately I don't currently understand the maths it would take to make that happen.

I guess I'll just have to stick with the animation for now, and hope that some tweaking will reduce its impact on the memory usage.

Thanks again, it was a very trippy example!   
B
32
S
6
G
7
Posts: 489
Reputation: 8,217

Next

Return to How do I....?

Who is online

Users browsing this forum: Muini and 29 guests