Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Spriter importer

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Dec 2012 17:10 Edited at: 10th Dec 2012 07:11
I hope posting about this isn't too premature for what I have so far, but I've been up all night working on a way to import Spriter SCML files into DBP. I looked at Baxlash's AppGameKit code but I soon realized I it wouldn't be able to help me. The xml file his loads looks very different from the one I got from Brashmonkey's website. I'm guessing he worked with an older beta format.

So I'm working from the information posted here:
http://www.brashmonkey.com/forum/viewtopic.php?f=3&t=2507

Don't get too excited, there is no animation, yet. That is actually my next step already. Up to this point, I've managed to parse the file and store the necessary data and assemble the images into a character, accounting for all pivots/offsets and rotations. The hard part will be tweening the animation among the data I have stored in multiple arrays, and accessing that data in an efficient manner.

This image shows the example loaded with Spriter on the left, and the example file loaded into DBP. If anything looks different, let me know but they should look the same now.


Update:
Fixed the angle issue and the tweening problem I accidently caused earlier.
Since a still image doesn't show much in terms of animation, here's a video.

On the left, you see the monster.scml example running from within Spriter. On the right, is the same file running in native DBP. I've even attach the code, though it is quite messy and this current example isn't exactly practical for normal use yet.





"You're not going crazy. You're going sane in a crazy world!" ~Tick

Attachments

Login to view attachments
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 2nd Dec 2012 23:16
@ Phaelax,

Looks like it's spot on to me - if you can please can you create a spriter importer for both AppGameKit and DBPro?

Definite sticky on this thread...

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Dec 2012 01:55
I haven't used AppGameKit that much since it's been out, but I can try after I get DBP finished.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 3rd Dec 2012 09:01 Edited at: 3rd Dec 2012 09:15
@ Phaelax,

Actually, I was worried you wouldn't develop it for DBPro - result!

[edit]

Will you introduce some commands for animating the spriter components in the plugin?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Dec 2012 10:56
Quote: "Will you introduce some commands for animating the spriter components in the plugin?"

Can you elaborate on what you mean? I haven't even begun work on a command structure yet, but for the moment I'm guessing I'll have the following:

id = loadSprite(scml_file)
playSprite(id, animation_name)
stopSprite(id)



I've reworked the internal structure, which should greatly increase the efficiency (especially with multiple objects) and reduce memory usage. But I may have to alter it, I'm waiting to hear back on some info from the BrashMonkey forums.

Animation is working right now, but only on the keyframes. There is no tweening yet. That's next, but it'll have to wait cause I have work in an hour.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 3rd Dec 2012 18:19
@ Phaelax,

I think you've covered it - basically you can load in the spriter sprite (with all its constituent parts) and animate it as you have designed in spriter - right?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Dec 2012 21:26
Yup but the code isnt production ready yet. Still need to wrap everything up into a neat little package. It turned out to be easier than I thought. I wouldn't say easy itself just not as hard as expected. But I already write code to parse XML which helped a lot.

Later on I'll see what I can do to make an actual C library plugin. Objects would make this infinitely easier.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Dec 2012 07:38
Just a quick update, I've sorta got tweening to work. My only issue is the rotation at the moment.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 9th Dec 2012 08:07
@ Phaelax,

Excellent new re progress.

Will the plugin carry speed(s) of animation, thinks like that?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Dec 2012 01:02 Edited at: 10th Dec 2012 05:51
Well the speed of the keyframes is written into the files.

I changed something and broke the tweening. Ugh! And I can't figure out what I did that messed it up.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Dec 2012 07:19
I've fixed the issues I was having and now have the animation full working (far as I can tell).

Still have some things to work on, but I've posted a video above and also attached my source code as well. I'll warn you, it's not very clean because I've revised it multiple times and used chunks from my first version up to the current one, so naming schemes on my functions and stuff might not make sense.

"You're not going crazy. You're going sane in a crazy world!" ~Tick

Login to post a reply

Server time is: 2024-04-19 23:39:30
Your offset time is: 2024-04-19 23:39:30