Space game to test - can animation be improved?

Creating Games? Developing something for fun?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 26
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Space game to test - can animation be improved?

Post by SWEdeAndy » Wed Jul 03, 2019 12:06 pm

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:
http://andreasbergendal.se/SpaceNode/Downloads/

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

sphere
Posts: 864
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

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

Post by sphere » Wed Jul 03, 2019 12:58 pm

Looks great, although i don't understand what to do after docking a spaceship.
But it was smooth animation for me.
Good Job Andreas!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 26
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

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

Post by SWEdeAndy » Wed Jul 03, 2019 1:14 pm

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...

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 26
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

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

Post by SWEdeAndy » Wed Jul 03, 2019 1:19 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3357
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Wed Jul 03, 2019 4:09 pm

How did you do the animation?

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 26
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

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

Post by SWEdeAndy » Wed Jul 03, 2019 5:31 pm

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)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3357
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Wed Jul 03, 2019 6:04 pm

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.

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 26
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

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

Post by SWEdeAndy » Thu Jul 04, 2019 11:05 am

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3357
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Thu Jul 04, 2019 6:52 pm

I'm a slob, and frankly working out the magic numbers for the sprite sheets seems too much like hard work.

Post Reply

Return to “Creating Games”