1

Topic: A new kind of ball

Lately the topic of ball variety has come up in a number of threads.  For a long time my intent has been to generalize the way the ball is represented and, in so doing, allow for much greater flexibility in defining the ball model.  Whenever it comes up, we all agree "That's something for after 1.5".

But each time the topic comes up I starting thinking in the back of my mind about how I'd accomplish this.  This morning, I realized most of the work is already done.  It occurred to me that ball geometry could be defined using the exact same mechanisms and tools used to define levels and backgrounds.  These already support OBJ loading, a variety of material types, moving objects, animated sprites, and transparency effects.  On top of that, they're stored in a very generalized, powerful and compact file format that mapc is very good at optimizing.  I realized it would be easy.

So, today I sat down and implemented a new ball creation mechanism based on this idea.  I created a branch called ball-test.  To test this code, I set about recreating the original ball using the new system, as well as new example balls that exercise all of the power of new system.  Here are the results:

Here's our old friend "basic-ball".  It looks as good as ever, and is even slightly more efficient now that it's been processed by mapc.  At the core of basic-ball is a new ball OBJ which defines a simple textured sphere.  basic-ball.obj is referred to by a misc_model entity in basic-ball-solid.map.  A "-solid.map" file defines the rolling geometry of the ball.  All of the other new balls are also based upon this same OBJ; they just texture it differently and augment it with other entities.

http://snth.net/~rlk/neverball/basic-ball.jpg

Here's "saturn".  It references basic-ball.obj from within saturn-solid.map, but it also adds another OBJ for the rings, which is defined in saturn-outer.map.  This "-outer.map" file defines geometry that sits outside of the rolling geometry, but remains balanced at all times.  Of course, the rings are not physical, and the ball bounces normally, rolling around in its ring.

http://snth.net/~rlk/neverball/saturn.jpg

Now here's "reactor".  It is very animated, and the screenshot doesn't do it justice.  Reactor includes billboard entities in a file called reactor-inner.map.  An "-inner.map" file defines geometry that sits inside of the rolling geometry.  Like outer geometry, inner geometry is balanced and does not rotate with the ball.  In this case, the inner MAP includes pulsing flares and animated sparkling billboards.  These billboards pulse beyond the bounds of the ball, giving it a nice glow effect.  In addition to the balanced billboards, reactor includes several "solid" billboards and a "solid" OBJ, which rotate with the ball.  This combination of balanced and rotating entities makes for a very complex and dynamic appearance.

http://snth.net/~rlk/neverball/reactor.jpg

Finally one more: this is "snowglobe".  It's just like basic-ball, but with an inner MAP with OBJs and billboards.  Several snowflake sprites rotate smoothly, giving the impression of fluttering flakes in a holiday snowglobe.  I wanted to make the little train run around its track, but I haven't yet thought of a good way to do that.

http://snth.net/~rlk/neverball/snowglobe.jpg

The "ball" key in the neverballrc has changed completely.  If you try this branch, just delete that key and let the game create it using the default.

Yes, this works in Neverputt.  Currently, the Neverputt ball color is applied to the new models, which can do weird things.  In the future, instead of colored balls, I was thinking it might be cool to allow Neverputt players to select balls they've earned playing Neverball.  We'll see.

None of this new stuff invalidates any of the new skins that people have been making.  We'll still use them, and we'll be able to improve upon them with the full power of the SOL at our disposal.

2 (edited by parasti 2008-01-05 03:41:47)

Re: A new kind of ball

I am literally speechless.  Well, maybe not quite, but...  Wow.

By the way, seems like the shading is a bit different on the "basic ball"..?

3

Re: A new kind of ball

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Mac OS X Xcode project & package maintainer.

If you have some Neverball related files you need hosted somewhere, please send a me forum PM/email.

4

Re: A new kind of ball

I had a feeling this was what you were working towards, but I didn't think it was going to happen for 1.5.

Wow scarcely does it justice.

Cheese
==========
cheesetalks.net

5

Re: A new kind of ball

Umm.... Wow. That is absolutely beautiful. rlk, how is it that you can make such amazing changes so quickly? I am astounded!

Seriously. Wow.

6

Re: A new kind of ball

Who's gonna do a monkey? LOL.

Mac OS X Xcode project & package maintainer.

If you have some Neverball related files you need hosted somewhere, please send a me forum PM/email.

7

Re: A new kind of ball

So much for Super Empty Ball.

8

Re: A new kind of ball

W

O

W

big_smile

9

Re: A new kind of ball

Glad you guys like it.  Be sure to hold off judgement until you see it running.

To head off one comment I'm sure to receive: the glow on reactor gets cut off by the floor.  Since committing this code, I've come up with a way around that.

Dave wrote:

rlk, how is it that you can make such amazing changes so quickly?

I'm 33 years old, and I've been programming for more than 20 years, working with OpenGL for nearly 15 years.  When I come up with a neat idea, I become blind to all else.

jammnrose wrote:

Who's gonna do a monkey? LOL.

This is a good thought (and I realize it's a joke), but it's indicative of a continued limitation.  We don't have any kind of generalized skeletal animation yet.  Keep that in mind when considering what you might do with this new mechanism.  Whatever was possible in a MAP is now possible in a ball, but no more.

parasti wrote:

So much for Super Empty Ball.

My thought as well.  smile

10

Re: A new kind of ball

Super Dino Ball will have to wait then
sad

I like it. As you say, there's some sprite clipping on the ground, and it 'feels' like the rings and globe contents should be able to move a little with the camera angle/ball momentum.

But on the whole, this is an amazing addition.

Skeletal animation would open up a lot of new doors for us, I think.

Cheese
==========
cheesetalks.net

11

Re: A new kind of ball

Cheeseness wrote:

I like it. As you say, there's some sprite clipping on the ground, and it 'feels' like the rings and globe contents should be able to move a little with the camera angle/ball momentum.

Oh, yeah, that'd rule if the rings would tilt in relation to which way you were accelerating...

12

Re: A new kind of ball

Maybe not as much as the camera, but with a little bias, like the way the background angles a bit depending upon your momentum.

Cheese
==========
cheesetalks.net

13

Re: A new kind of ball

ok, thnx parasti for the installer, I just saw these in-game.
They are totally off the hook.

I agree that the new basic-ball while nice and shiny on top, appears a bit dark comparatively speaking.

And after seeing the snowglobe, I must figure out how to make a goldfish bowl with little bubbles and a plastic seaweed waving around (and a goldfish of course!)

14

Re: A new kind of ball

geek orgasm!

I will dream of the reactor ball tonight!

WOW!!!

Currently Playing:
Celeste and Electronic Super Joy

15

Re: A new kind of ball

Hah, and I was going to suggest last night (after making the new ball textures) whether we could have billboards inside the ball.
Excellent work, RLK!

16

Re: A new kind of ball

Ah yes the new basic-ball is slightly darker.  Two reasons. First a bug: I forgot to include the emissive material property in the new ball mtrl file.

Second (and I was actually waiting to see if anyone noticed this, but not yet) the ball's ghost is gone.  Previously, the diffuse material of the ball was redrawn with 10% transparency so that a faint image was always visible even if the ball was obscured by level geometry.  When not obscured, this had the effect of increasing the opacity of the ball a small amount.

Given that the image of the ball now consists of as many as 12 (!) passes of carefully-orchestrated alpha blending, it's not so easy to just slap a ghost on at the last moment.  I'll compensate with the emission.

17

Re: A new kind of ball

big_smile
Great update!

By the way, specifying a boink file for the ball would be handy.  Sometimes the noise just doesn't match up with the current ball.  I myself am no sound designer by far, but we'll probably need more ogg's, like for Reactor.

18

Re: A new kind of ball

Hmm, a fish bowl with spherical wheels sounds nice!  I may design it when I get the chance

19

Re: A new kind of ball

Boy, I can't figure this out. I downloaded parasti's latest windows installer. I opened up the neverballrc file, and changed the ball entry to what I would have thought should work (whatever obj file exists in the desired ball folder.) I only get a shadow - No ball at all! What am I doing wrong?

I have tried, for instance:
ball/saturn/saturn-rings
ball/reactor/reactor-rods
ball/snowglobe/snowglobe-scene

I also tried specifying other files (the .sol files), but all to no avail. Please help!

20

Re: A new kind of ball

Hey Dave..

It's the name of the folder twice..
Ie:

ball/saturn/saturn
ball/reactor/reactor
ball/snowglobe/snowglobe

21

Re: A new kind of ball

Silly me! I got it now - thanks tones!

22

Re: A new kind of ball

tonesfrommars wrote:

Hey Dave..

It's the name of the folder twice..

Actually, it's the SOL prefix.  For example, saturn consists of ball/saturn/saturn-outer.sol and ball/saturn/saturn-solid.sol.  The game takes the prefix that you give it and appends "-solid.sol", "-outer.sol", and "-inner.sol" when searching for ball data.

23

Re: A new kind of ball

I've committed a patch that adds a pendular motion simulation.  Basically, this simulates a pendulum attached at the center of the ball, with length equal to the radius of the ball.  It applies the motion of this pendulum to the inner and outer balanced geometry of the ball.  So as you tilt the floor the balanced geometry swings to seek the gravity vector.  If you hit a wall, the pendulum swings wildly.  The motion is dampened to prevent perpetual swinging.

It looks good with snowglobe, but it pretty much ruins saturn, as the rings spend most of the time intersecting the floor.  There's really no way to prevent that under the circumstances.  If the balanced geometry is allowed to deviate at all from the angle of the floor (even if only to track the gravity vector) then this is guaranteed to happen.  I'll probably add an option to disable this feature for specific balls.

24 (edited by Cheeseness 2008-01-05 21:31:58)

Re: A new kind of ball

Awesome! I'll co it in a minute.

Edit: Snowglobe looks fantastic, and Saturn's rings go a bid mad. With the rings, is there a way we could specify maximum tilt?

Or perhaps we could use transparency where it clips with world geometry (have a gradient alpha mask so it fades out before it makes contact with anything)?

The reactor would be sweet with a bzzt laid over its boink sound, and maybe a background hum.

I'm not sure if I'm liking the loss of transparency when the ball goes behind an object.

Cheese
==========
cheesetalks.net

25

Re: A new kind of ball

Making the pendulum effect optional was easy.  Now I'm playing around with an option that causes the balance geometry to tend toward facing the direction of the ball's motion.  Here's a little test I made up: "blinky".  It consists entirely of a pendulous outer.sol that tracks the velocity.  Might be a good reward for beating Easy Bonus IV (wakka).

http://snth.net/~rlk/neverball/blinky.jpg