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.

AppGameKit Classic Chat / atlas animations with subimages.txt can't get it to work

Author
Message
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 09:08
I know people seem to know how to get this working but I can't quite figure it out...

If I use the imagejoiner program on say 9 images with imagename001.png to imagename009.png

First off the image joiner does not (in my case) line them up in order:
123
456
789

it winds up something like this
123
475
689

When I load the image the subimages.txt does not seem to kick in to compensate;




Could someone tell me what I am doing wrong?
Tkx
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 23rd May 2012 09:25
Use TexturePacker

http://www.texturepacker.com
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 09:34 Edited at: 23rd May 2012 09:57
same problem.
Plus they want $38
its not picking up the .txt coordinates

gotta be something with my code?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 10:16
Take a look at the "loadSubImage" command. You are trying to load 9 100x100 "sub-images" from your image but the subimage text file is not even being used in your code. The setSpriteAnimation command does not look at that file, it just loads the number of images at the size you specify.

The help files are great for debugging tier 1 code and can be found in the "IDE/Help" folder.

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 10:25
So instead of using 1 image and 1 sprite;

I will need to use 9 images and 9 sprites
if I use the loadsubimage command
then assign each subimage which is now an image as an animation frame is this correct?

according to this;
Quote: "SetSpriteAnimation
Description

Initialises the sprite animation with frames from its assigned image, based on a frame width and frame height. The sprite will use the frame width and frame height to extract images of that size from its assigned image beginning in the top left corner and moving from left to right. When it reaches the right hand side of the image it will begin again one row down, moving from left to right again until the frame count is reached or it runs out of space on the image to look for frames. Storing an animation image on an atlas texture is supported.
"


"Storing an animation image on an atlas texture is supported", but in no way easier to use...?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 10:56 Edited at: 23rd May 2012 10:57
Quote: "So instead of using 1 image and 1 sprite;

I will need to use 9 images and 9 sprites
if I use the loadsubimage command
then assign each subimage which is now an image as an animation frame is this correct?"

Not quite. You load in 9 separate images but add them to the same sprite as animation frames using AddSpriteAnimationFrame( iSpriteIndex, iImageIndex )

EDIT: Only one sprite.

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 11:01 Edited at: 24th May 2012 09:26
ok thanks!;
I thought it wasn't probably as easy as I first thought;
like making your own text, there is only one command to hook it all together.

Is there any program to simply tile in order with exact spacing in order of named images?
so I can simply get all the images equally spaced?
123
456
789

then I could just use the setspriteanimation command.
(texture packer wont do that either)edit: yes it does
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 11:11
You could create your own spritesheets using AppGameKit and the new getImage / saveImage commands

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 11:15
Thanks Much!
Let you know how it goes

could use dark basic but I don't think it would save pngs properly.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 11:28
DBPro works for making spritesheets. I made a simple spritesheet maker for turning 3D models into sprites a while ago.

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 11:30
saved as pngs?
or just black backdrop?
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 23rd May 2012 11:34
IceGB use TexturePacker.
The basic functions (those that you need) are free.

I use it all the time.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 11:36
Quote: "saved as pngs?"

Yes.

You can do this from AppGameKit though too:
drawSprite - for each image
getImage - for full spritesheet
saveImage - as a png

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 12:27
Thanks, baxslash.

Bjadams I tried the program and I can't get it to do any better than the AppGameKit Imagepackager; not sure why its supposed to work better?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 13:56 Edited at: 23rd May 2012 13:57
Here's some off the cuff untested code:


EDIT: It should create a spritesheet from the nine images at the width and height (per image) specified in the Documents/AGK folder...

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 23rd May 2012 14:15
icergb, it's "better" cos it has the option to keep your images in sequence 123 456 789 not mixed up at random! there are options to trim, keep in sequence etc....
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 14:49
So I opened up Imagepacker again and this time I found the button to sequence the images in the proper order. and it didn't say I was using the advanced features, so it worked really well. I can definitely say this will be a big help!
Thanks bjadams!

--

I built a converter in dbpro but I am having trouble with the transparencies as I thought; the black lines around the images are just to clunky.


I'm curious as to how you managed to knock out most of the feathered black along the images from your darkbasic program when it saves the png files baxslash? as animating and capturing 3d objects in darkbasic will come in handy; I did make an animation capture a few years back...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 14:53
Quote: "I'm curious as to how you managed to knock out most of the feathered black along the images from your darkbasic program when it saves the png files baxslash?"

Don't remember ever having that issue, sorry!

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 15:23
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 15:25
Is that "Dark Basic" or DBPro? Don't think I had that issue in DBPro.

AGK packer? Is that using my code?

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd May 2012 15:29 Edited at: 23rd May 2012 15:32
no I didn't get a chance to use your code yet.

I managed to get the AddSpriteAnimationFrame version working for AppGameKit using the image packager

Im a bit squeemish to use your code because I have been doing everything in percentages so far.

oh yeah, it was DBPro
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd May 2012 16:34 Edited at: 23rd May 2012 16:34
Quote: "Im a bit squeemish to use your code because I have been doing everything in percentages so far."

Don't let that put you off try this version instead:


BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd May 2012 16:40
Quote: "DBPro works for making spritesheets. I made a simple spritesheet maker for turning 3D models into sprites a while ago."


Quote: "saved as pngs?
or just black backdrop?"


If you use

SET BITMAP FORMAT 21

with GET IMAGE, you can save to transparent PNG files.

I'm struggling with the mixed up order too. It doesn't make sense that it reorders the images when the intention is to create ordered animation.

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 24th May 2012 07:25
I believe the image joiner is exactly NOT for making sprite animations, but rather for piecing together different sized images into an image atlas. It's not all that efficient, either. I use photoshop, so I can get nice anti-aliased png's with shadows, etc.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 24th May 2012 08:54
Problem is, we only have the Image Joiner tool to create spritesheets because it's the only tool that creates the necessary .txt with co-ords

As far as I know the image joiner leave the images AS IS, hence if they are properly antialiased, they stay that way.
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 24th May 2012 09:02 Edited at: 24th May 2012 09:05
Quote: "If you use

SET BITMAP FORMAT 21"


same results, it is transparent but the black feathering is a bit bulky.

----

Well I understand what is going on now; leaves the possibility of 2 options, with coords or not...
Plus probably a good idea to use the atlas txt for any large number of non animating sprites...

----
Not sure why the bottom 3 sprites are not showing with baxslashes code???

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th May 2012 09:05 Edited at: 24th May 2012 10:48
Could be that get image works different on a percentage system. If I get time i'll take a proper look.

EDIT: Also I'll be adding the option of making spritesheets into my new "Character Workshop". So I'll make it possible to import images and turn them into a spritesheet with some in-program testing and manual adjustment.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th May 2012 11:58 Edited at: 24th May 2012 11:59
I took my spritesheet code and threw together a quick app. Put your images (as png) in the "media/input" folder and run the app (code included in download). MAKE SURE they are numbered as follows:

*myImage*01.png
*myImage*02.png
*myImage*03.png
*myImage*04.png

Replacing *myImage* with whatever you want.

It will put a spritesheet into the "Documents/AGK/sheeter" folder.

Forgot to attach! Also you can increase the size available by changing the setup.agc file.

Attachments

Login to view attachments
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th May 2012 09:57 Edited at: 25th May 2012 10:52
Hmmm,

Quote: "spritesheet to large at 256,256 Quiting..."


15 sprites at 64x64
supposed to be 4x4


not sure what this
is doing
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2012 10:55
That's odd, it only calls that line if the spritesheet is larger than the device width, also it shouldn't actually quit because I forgot to add the "end" command

Just change the size of the device (window) by editing the values in the setup.agc file to 1024x1024 or as large a window as you like.

Quote: "are you using the percentage system here?"

No I'm using setVirtualResolution()

This line "num = ceil(sqrt(n))" just quickly works out the width and height of a square spritesheet using the number of images loaded. If you put 15 images in the folder it will evaluate it to a 4x4 spritesheet. 4x64 = 256.

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 25th May 2012 11:33 Edited at: 25th May 2012 11:41
edit: thinking 256 is pretty small
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2012 11:38
What was it set to in the setup.agc file?

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 26th May 2012 00:35 Edited at: 26th May 2012 00:42
kk

My windows screen is 1024x768 so the program doesn't seem to run because the setup file is set at 1024x1024. It shows as running but it won't save the file.

I made the height and width in the setup file smaller



Now it works, and works well!

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th May 2012 23:59
Ah ok cool

Login to post a reply

Server time is: 2024-04-28 17:49:47
Your offset time is: 2024-04-28 17:49:47