Page 1 of 3

Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 12:06 pm
by SWEdeAndy
Hi guys,

I would like to share with you a game I’ve been working on for over a year. I plan to release it soon, in one way or another (probably for free).

However, smooth animation remains a bit of an issue. I’d be very happy if someone could find out why the animation sometimes tends to be ”choppy”, in spite of all my efforts to use helpers like animationEngine, and tricks of layer setting etc. In the most recent version, I’ve even tried the 9.5.0 dp1 novelty of layerMode ”container”, for the group containing the sprites (which have layerMode dynamic). Unfortunately I see no difference at all in animation performance.

So, the game is called SpaceNode, and is a 2-D retro-looking turn-based strategy game set in space.
Not everyone’s cup of tea, I suppose, but my ambition was to create a game I would enjoy playing myself, and that I have achieved. If you have nostalgic memories of old games like Starbound, Escape Velocity etc, then you might enjoy it too. :D

You can download the standalone, for Mac or Windows, here:
https://wheninspace.se/en/mesmerize/spacenode/

Give it a spin, and if you feel that you have time and interest in seeing the source code, and maybe find a way to tweak the animations (or have other improvement suggestions), then send me an email at info@wheninspace.se and I’ll send you the LC stack along with some instructions on how to penetrate the code base (it’s naturally rather massive, the main card script has 3500 lines of code).

Cheers,
Andreas
WhenInSpace
Sweden

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 12:58 pm
by sphere
Looks great, although i don't understand what to do after docking a spaceship.
But it was smooth animation for me.
Good Job Andreas!

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 1:14 pm
by SWEdeAndy
Thanks! Well, after docking ships you buy modules from them to add to your space station.

I didn't make an interactive tutorial, instead you have some text-based instructions to read through. It's always a matter of playing style, I think, if you're the kind who dives right in to a new game, or the kind (like me) who devours all the instructions first. 8) I should probably accommodate both types better... :)

The animation is normally smooth enough in the beginning, but when things start to get busy, with more spaceships moving simultaneously and bullets flying around the place, it tends to start lagging a bit. The game is still very playable to the end, but I'd like to iron out that last laggy bump...

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 1:19 pm
by SWEdeAndy
I may add that I run on a MacBook Pro 15" (2018), so the hardware capabilities should not be lacking. It makes me afraid that lagging animation may be even worse on older computers.

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 4:09 pm
by richmond62
How did you do the animation?

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 5:31 pm
by SWEdeAndy
Sprites consist of images/PNGs (spaceships) that have been imported and stored on a ”storage card”.
There is also one template graphic object for ”shots”.

The game plays out on a ”game area card”, to which sprite images/graphics are cloned from the storage card.
Sprites are moved using animationEngine command aeMoveTo, often with easing effects.

Images are also rotated by repeatedly setting their angle property. This is done by adding the img id to a list that is iterated through (”send in 10 millisecs”) until each image has reached its target angle.

An image may move and rotate simultaneously, and several (up to some 20) images can do this simultaneously, although normally around 1-8 are involved each round.
Shots graphics may be moving at the same time (up to max 10-12). Collision detection is in that case continuously going on until all shots are off the ”shot move list”. I couldn’t get animationEngine’s collision detection function to work properly, so I built my own, very similar.

Images have layerMode ”dynamic”.
bufferHiddenImages is set to true in openStack.
acceleratedRendering is set to true when there is movement.

In LC pre 9.5.0 dp1 the images are simply cloned to the card.
In LC 9.5.0 dp1 the images are placed into a predefined group. The group has its layerMode set to ”container”. Animation performance appears the same though, I get no visible difference.

When a smaller number of sprites are moving, animation appears reasonable smooth. It’s when the action heats up, with several ships and shots moving, that animation gets stuttered, and collision detections ”falls behind” and starts to fail. The message queue gets choked, it seems.

It’s still acceptable for an enjoyable playing experience on the whole, but it doesn’t look as professional, as polished, as I would like it to. But maybe I’m too much of a perfectionist… 8)

Re: Space game to test - can animation be improved?

Posted: Wed Jul 03, 2019 6:04 pm
by richmond62
Seems very complicated to me.

I tend to animate using no animation engine; merely individual frame images
or sprite sheets shown in some sort of framing object:

individual frames in a graphic, sprites sheets in an image.

Re: Space game to test - can animation be improved?

Posted: Thu Jul 04, 2019 11:05 am
by SWEdeAndy
Well, to put it more simply, the animations consist of:
- images moving from point a to point b
- images rotating
- graphics moving from point a to point b

And then collision detection for graphics on specified images.

Sprite sheets might be applicable for the rotation part, although I fear it would take quite a number of sprite versions to ensure a smooth rotation illusion. And rotation and movement must sometimes happen simultaneously, so I'm not sure it would improve animation smoothness in the end.

I'll keep this possibility in mind though, as it is at least a different approach that could be worth testing, if nothing better comes up here.

Re: Space game to test - can animation be improved?

Posted: Thu Jul 04, 2019 6:52 pm
by richmond62
I'm a slob, and frankly working out the magic numbers for the sprite sheets seems too much like hard work.

Re: Space game to test - can animation be improved?

Posted: Thu Apr 30, 2020 12:48 pm
by SWEdeAndy
Do what, exactly?

Re: Space game to test - can animation be improved?

Posted: Thu Apr 30, 2020 12:58 pm
by Klaus
SWEdeAndy wrote:
Thu Apr 30, 2020 12:48 pm
Do what, exactly?
Delete a SPAMMER, Andy! :-)

Re: Space game to test - can animation be improved?

Posted: Thu Apr 30, 2020 1:04 pm
by SWEdeAndy
Klaus wrote:
Thu Apr 30, 2020 12:58 pm
SWEdeAndy wrote:
Thu Apr 30, 2020 12:48 pm
Do what, exactly?
Delete a SPAMMER, Andy! :-)
Ah! Well, I should've figured as much. Got excited, as replies are rare enough in this thread... :(
Thanks Klaus!

Re: Space game to test - can animation be improved?

Posted: Thu Apr 30, 2020 2:23 pm
by bogs
I actually wanted to thank our spam-bot visitor, I had meant to come back to this thread but had lost track of it :D

Re: Space game to test - can animation be improved?

Posted: Fri May 01, 2020 12:36 pm
by richmond62
Why does an attempt to download from here:

https://andreasbergendal.se/SpaceNode/Downloads/

consistently crash my browser, so unable to
download?

Re: Space game to test - can animation be improved?

Posted: Fri May 01, 2020 3:08 pm
by SWEdeAndy
Sorry about that, try downloading from my website instead:
https://wheninspace.se/en/mesmerize/spacenode/

The other link works for me, doesn't crash my browser (Firefox on Mac), so I don't know what might cause the problem you experience.
But since the original posting I released the game on my site, so it's better to go the official way. (I've now changed the link in the original post too.)

I have a short movie in the making, as introduction to the game (since today's youth don't like to read my verbose instructions... :roll: ).
But I believe you can read the summary intro page and then dive into the game without problems, and then just look things up if needed during gameplay. :)