Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  2d polygonal animation library / editor: PolyAnim  (Read 6700 times)
0 Members and 1 Guest are viewing this topic.
Offline mh114

Junior Duke





« Posted 2008-07-21 13:47:51 »

Greetings, this is my first post here! Smiley

I'm making a 2d vector / polygon animation library (+ an animation editor later) in Java, called PolyAnim. It is intended for game sprites, mainly, but I guess there's nothing stopping you making "movie" clips with it.. Wink It comes with Java 2D and LWJGL renderers built-in. There's also several render modifiers that can be used to create some neat effects on the animations, such as HSL transforms.

I'm posting here to see if there's any interest in this kind of library (it's not Flash killer by any means, but still..  persecutioncomplex ), and to ask for comments & suggestions. As PolyAnim is still in rather early stages of development, this is the perfect opportunity to suggest new features, API changes, etc. I'm going to use this in my next game for game sprites, and I hope that Java developers find it useful in their own projects as well, at least when I have the editor done (won't happen soon, unfortunately).

Actually, the biggest downside at the moment is the lack of the animation editor. I'm developing it using Qt Jambi, but I've hit a bad bug that prevents me working further until the next Qt Jambi patch release is out.. I managed to hack a tool that allows creating the animations in Inkscape, though.

Here's a screenshot of the test program, displaying several copies of the very first proper animation created using this thing(tm):

The biggest dude is the original, scaled 2x. Others are rendered using different modifiers.

If you're interested in polygon based game sprites, do take a look at the PolyAnim website at http://polyanim.googlecode.com. There are Web Start demos available at http://code.google.com/p/polyanim/wiki/WebStartDemos, please drop me a note if they do not work on your system! They're my first Web Starts, after all.. Smiley

Any kind of feedback is much appreciated! Thank you.  Cool

Offline mh114

Junior Duke





« Reply #1 - Posted 2008-07-26 09:00:01 »

Quote
I'm posting here to see if there's any interest in this kind of library..
Heh, and I thought that at least a few people would be interested in this kind of stuff here, this forum being meant for Java game development.. persecutioncomplex Anyway, the lack of interest raises a couple of questions: why it is not interesting enough to warrant a comment? And in turn, how can I make it more interesting? Smiley Perhaps the fact that it's in fairly early phase of development has to do with this. Is it too early to talk about this? Huh Please, don't take these questions as bad blood, for I'm truly trying to develop a library that would be useful to Java game developers, myself included. Smiley

What would you like to have in a vector animation library, so that you'd consider using it in your own projects? I'll present the feature list (+ a road map) for PolyAnim below, is there important stuff missing? What there is not that useful? Please comment, anything helps me to define this project better. Wink

Animation features:
  • Animations:
    • Building animations using key frames, polygon groups, polygons and vertices. (done)
    • Interpolating smoothly between key frames (done)
      • Polygon groups have flexible transformations: scale, rotate (around pivot point) and offset (= translate) (done)
      • Groups are sorted (and thus drawn) by their depth-level (done)
      • Group polygons can itself be animated by moving their vertices (done)
      • Polygon color interpolation (done)
      • Blending settings per polygon: alpha, additive, none
      • Performs transformations on the renderer side (e.g. glRotatef() in OpenGL) but can optionally compute transformation matrices for renderers that don't have transformations built-in. (done)
    • Looping:
      • Variable start and end points (done)
      • Bidirectional and ping-pong playback (done)
    • Anchor point system
      • Allows implanting anchor points with specific offset, direction to the animation frames. The anchors will be animated along with the rest.
      • Game code can query for example an anchor in players hand, and render a gun sprite there.
    • Animation I/O:
      • XML read and write (done)
      • Custom binary format
      • Experimental (+ unsupported) Inkscape SVG --> PolyAnim XML animation converter (done) Tutorial here!
      • Animation collections (store several animations in one file; for example player run, walk and jump animations)

Rendering features:
  • Different renderers:
    • OpenGL (LWJGL) renderer (done) (recommended for games, but doesn't support concave polygons)
    • Java 2D renderer (done) (supports concave polygons)
    • Easy to implement new renderers, as long as drawing polygons is supported by the platform!
  • Render modifiers:
    • Can be used to modify the animation rendering. Useful for game sprites!
    • Flip (mirror) vertically and horizontally (done)
    • Scale, rotate (done)
    • HSL (Hue-Saturation-Lightness) modifier (effects such as desaturation and hue rotation) (done)
    • Color modifier: blending to color, additive blending to color, conversion to grey scale (done)
    • Alpha modifier: multiply the polygon alpha with a specified alpha factor (done)
    • ...more? (ideas are welcome!)

PolyAnim Editor:
  • Allows creation of the animations
  • Uses Qt Jambi
  • Has its own renderer using Qt (supports concave polygons)
[size=8pt](phew, typing the list structure tags took a while! Tongue)[/size]

Items marked with (done) are already in the code base. Currently PolyAnim is at (quite arbitary) version 0.6.

Btw, has anyone tried the Web Start demos? I'm interested if they work in Macs, since it's something I cannot test myself, having only Windows and Linux here.

Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #2 - Posted 2008-07-26 09:04:15 »

Is there some sort of bone support (apologies if I missed it in the list above, I did try to check Smiley).

Can a polygon be replaced with a fixed image which moves with the orientation/translation that poly would do?

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline mh114

Junior Duke





« Reply #3 - Posted 2008-07-26 09:15:16 »

Thanks for your comment, Kevin! And btw, thanks for all your work in Java gaming, Coke And Code, etc. Your tutorials have been helpful for me. Smiley

Is there some sort of bone support (apologies if I missed it in the list above, I did try to check Smiley).
Nope, and probably not going to happen either, at least not for 1.0. Unless a massive amount of people request it and/or somebody contributes.. Wink While it would make character animation easier, I'm aiming for a more general approach (== means more work for certain cases, such as, character animation.. Tongue).

Quote
Can a polygon be replaced with a fixed image which moves with the orientation/translation that poly would do?
Not directly, but the anchor points would make this quite easy. The idea is that you'd query the anchor orientation from PolyAnim and then render something there (anchors itself are not rendered except in the editor). Having a ImageAnchor built-in might be good, though, thanks for the suggestion. Smiley

Offline CommanderKeith
« Reply #4 - Posted 2008-07-26 09:20:09 »

It looks pretty cool. I can see it making pretty nice intro for a game. The webstarts work fine on my windows computer

So it uses QT Jambi? I did some quick searching and it says qt jambi doesn't use java2D, but on your website it says it uses java2d and lwjgl? Can QT Jambi integrate with existing games using java2d or lwjgl?

Nice work  Smiley

Offline mh114

Junior Duke





« Reply #5 - Posted 2008-07-26 09:30:57 »

So it uses QT Jambi? I did some quick searching and it says qt jambi doesn't use java2D, but on your website it says it uses java2d and lwjgl? Can QT Jambi integrate with existing games using java2d or lwjgl?
No no, the editor uses (or will use, it's development is at halt because of a Jambi bug) Qt Jambi, but the actual library comes with LWJGL (recommended) and Java 2D renderers. I chose not to make the Qt renderer part of the core lib to avoid Qt dependency (it's a quite heavy toolkit to bundle). Assuming one wanted to do a game entirely in Qt, then the renderer from PolyAnim editor would work fine.

Quote
Nice work  Smiley
Thanks. Smiley

Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #6 - Posted 2008-07-26 09:40:04 »

A cool thing this could be used for would be in game characters in 2D games being rigged like 3D models -  give a feeling of Another world but with real time physics - hence the bone question.

It's a definitely a cool tool tho, how tricky is it to create a renderer - I'd quite like to render it using Slick (thought the LWJGL renderer would do just fine for that in the short term Smiley).

Kev

Offline mh114

Junior Duke





« Reply #7 - Posted 2008-07-26 10:16:07 »

A cool thing this could be used for would be in game characters in 2D games being rigged like 3D models -  give a feeling of Another world but with real time physics - hence the bone question.
That would be cool, definately. I guess I'll have to think about bone support at some point, then. Wink But not quite soon, I'd like to get 1.0 (and the darn editor) out before that, as the bones would require quite a lot of changes.. Btw, Another World is an inspiration for me, it's just the kind of look I'm aiming for. Cool

Quote
It's a definitely a cool tool tho, how tricky is it to create a renderer - I'd quite like to render it using Slick (thought the LWJGL renderer would do just fine for that in the short term Smiley).
Not hard at all, assuming Slick can render (convex) polygons. And if it supports transformations (scale, rotation and translation) directly, like OpenGL and Java 2D, all the better. A transformation matrix that has everything in it can be also computed by PolyAnim. Take a look at http://code.google.com/p/polyanim/source/browse/trunk/polyanim/src/nr/co/mhgames/polyanim/renderer/?r=66. Render modifiers are optional if you don't want to use them, but implementing them shouldn't be too hard either. Smiley

Offline mh114

Junior Duke





« Reply #8 - Posted 2008-07-28 12:39:40 »

Today I remaked Kevins avatar for PolyAnim. It's now included in the Web Start demos, with Kevins permission. (thanks again!) Smiley See it in action!


Why that character? Well, I wanted to try making a character animation, but didn't want to waste time on developing a walk cycle.. That one character sprung to my mind, so here we are. Cool I must say, creating this took me lot of time, over 5 hours I think. Tongue I made a stupid mistake by using the wrong origin in Inkscape, and due to limitations of the converter I couldn't use rotate/scale on group basis, but only with individual polygons.. Had I started it correctly, it would have taken less time, I'm sure. Anyway, I didn't recreate all the details, nor the outlines, but the end result is still rather cool, in my opinion.

What do you think? Smiley

Offline CommanderKeith
« Reply #9 - Posted 2008-07-28 12:53:33 »

Looks good!  Cool

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline mh114

Junior Duke





« Reply #10 - Posted 2008-07-29 17:14:33 »

Looks good!  Cool
Thanks! Smiley

I committed PolyAnim v0.65 to SVN. Finally added backwards playing and ping-pong playback support. Cool I've updated the demo, as well. Btw, I found out that Web Start doesn't close the JVM with the application, unless I explicitly call System.exit(). Tongue Now I've added the exit-calls, and the JVM closes properly.

Offline mh114

Junior Duke





« Reply #11 - Posted 2008-08-05 12:58:47 »

Status update:
While waiting for the next Qt bugfix release, I haven't been coding PolyAnim, but instead working on the game engine for my next game. But today, I implemented two features which come handy when PolyAnim is used in game context. Lazy updates, which mean that the animations will keep their playing state etc. up to date, but skip interpolating the current key frame (the most costly step). In game, you'd enable lazy updates when an animation instance (say, an enemy sprite) goes out of view / far away from the player, and disable them when the animation comes back to sight. Smiley

To save memory, I added sharedCopy() method that creates a new copy of an Animation, with its own state but sharing the key frames with the original. Key frames take the most of the memory, so it's useful they can be shared now. For example, if you had several enemies using the same animation, you can share the key frames between all the Animation instances.

Cool

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!