BDX alpha release: Testers wanted.

I figure this is basically the official discussion thread for BDX, so it’d be the best place to ask this.

What are we looking at in terms of light objects? I’m guessing they’ll go in after Beta release, after documentation of existing features. It seems like most bugs have been fixed at this point. Would we write wrapper classes for Light objects (like DirectionalLight), or would we skip built-in lights and just go for a shader based approach? Shaders are things we’d implement anyway (theoretically), so just making the default lighting run off of shaders instead of LibGDX’s built-in light objects might be a good idea (maybe?).

If we were to write custom BDX lights, would they extend the GameObject class? That would work (since they are indeed actual game objects that have rotations, positions, components, variables, etc). On the other hand, GameObjects have models as well by default, which, obviously, lights wouldn’t have.

What would be a good solution for this? Simply have the ability for models to be null (and, I suppose, also have a light variable that can be null except for lights)?

Or maybe have GameObjects extend a base “Entity” or something class that all objects, visible and not, can extend? This “Entity” class would have basic game object behavior and classes (ending, running components, movement, rotation, scaling, etc), and GameObjects would extend this class and add a Model variable, for example.

As for Shaders, how do you feel about having the default Blender shaders (Toon, Fresnel, Minneart, etc.) available once the add-on gets up to snuff in terms of exporting those choices? Or would it be best to leave that up to developers?

A Light can simply extend GameObject; The fact that it doesn’t have a visual representation (by default) doesn’t complicate that, because GameObject.modelInstance can be null, as is the case for all exported Empty objects.

But, before that, I need to create a video tutorial series for BDX, and spiffy up the wiki. I plan to do that by the end of this month, so I can push out the beta (0.1.0), and start reaching out to the wider community.

As for whether or not Light objects should simply wrap LibGDX lights, or if we should build a more flexible shader system to implement them:

Ultimately, I want to have a “compositor-like” shader system, where a Material would simply carry data for a RenderPipeline. A RenderPipeline can be one or more shaders, rendering in stages, through one or more offscreen buffers -> Essentially a path from data, to final image on screen, like you would see in blender’s shader node editor.

However, at the moment, it seems like LibGDX doesn’t really have the proper foundation for something like that, and so, to make that happen, I would have to create a whole new rendering API, which doesn’t rely on the LibGDX ModelBatch, and related concepts.

I think this is something I can do, but it would take a long time, because I’m not completely clear on all the details (technical, usability, flexibility, etc).

With that in mind, I think it would be best to simply wrap existing LibGDX structures, which seem to support basic animation, lighting, and shadows. This will also take some time, but likely less, since there’s no ambiguity relating to technical details. When that is done, it may be appropriate to push out a 1.0.0 release, and then entertain more advanced rendering techniques.

As for Shaders, how do you feel about having the default Blender shaders (Toon, Fresnel, Minneart, etc.) available once the add-on gets up to snuff in terms of exporting those choices?

Sure. I mean, with the right system, it would just be a matter of compiling things down into a RenderPipeline.

Although, I should mention: Graphics are fairly low on my priority list. I think it’s important to support the basics that LibGDX already provides, for 1.0.0, but beyond that, I would much rather have better documentation, better tutorials, and a simpler API.

When it comes to shaders, i like the CryEngine material editor and its build-in types.

@Goran, SolarLune
great thread. Thanks for putting the time into BDX? I haven’t tried it yet, just watched the videos, a bit on github and following the thread here.
But this looks like a great project! Keep it up. Maybe I will try it in the future!

@ndee - No problem. The engine’s pretty young, but it’s also pretty solid as well.

@Goran - Sounds good. Wrapping existing functionality should be relatively easy to do.

I wanted to ask, when I have other objects on hidden layers, they get automatically created when I start the game engine. This doesn’t appear to be intentional, right?

So animated characters with armature will be for later, just to make notes?

The future is now! :smiley:

Can you clarify what you mean by “other objects” and “automatically created”?

Objects on hidden layers should not be visible when you start game. You can add them in, but until then, you should not be able to see them.

Yes, that will be a milestone for 1.0.0.

Hm, it was a bug, I guess, but I can’t recreate it (it happened while I was working on sprites and trying out Sprycle).

As a side-note, how would you feel about a “traditional” sprite animation solution? The version that uses Sprycle is probably really nice, but I think it might be best to package components that don’t require additional tools or libraries for an easier time setting up and working with them, if possible.

I would love to see a addon for blender, that generates some sort of sprite sheets, with multiple camera angles, for use in 3d sprites,

(like the old duke nukem 3d game)

isometric sprites, etc ?

this could be used to export to bdx, bge, unity etc.

this way people can use 3d models, to bake 3d sprite sheets with multiple camera angles…

I don’t really know what a “traditional sprite animation solution” would look like, but I think that adding something like simple-mode to TexAnim would probably be worthwhile.

With that, one wouldn’t have to use Sprycle generated data, if one has a texture that adheres to specific frame positioning conventions - Those used for simple-mode are pretty good, in my opinion, but if you have better ideas, let me know.

PS:

The Sprycle data format is pretty simple: https://github.com/GoranM/sprycle/wiki/Generating-cycle-data#data-format

^ That is pretty much the idea, yeah. Just being able to pass in a normal array instead of a link to Sprycle data would be helpful. I managed to get my sprite maps running under BDX, which is my idea of a fairly solid and powerful approach to animation:



SpriteMap sm = new SpriteMap(sprite_obj, 32, 32); // New sprite map, target object, and source image size

sm.add("walkD", new int[] {0, 0, 1, 2, 0, 3, 4}, 16, true); 

// Animation name, animation list, FPS playback rate (optional), loop (optional)

sm.add("walkR", new int[] {1, 0, 1, 2, 0, 3, 4});

super.components.add(sm);

sm.play("walkD");

This is working, but currently uses transformUV(), which was annoying to get working.

And yeah, I saw that the Sprycle data format’s fairly simple. However, not everyone wants to add an additional data file for animations. An example would be relatively simple, short animations that don’t have a lot of frame data.

As another side-note, a Vertex wrapper class would be super helpful; accessing vertices and getting simple properties (UV data, for example) in LibGDX seems to be a huge pain.

PS - I submitted an issue, but I just want to be sure I post it; Sprycle doesn’t work in Blender 2.72.

What is your frame ordering convention (how must I arrange frames in the texture to work properly with your scheme)?

Is “source image size” the size of the texture, or the size of the UV frame? I don’t understand why you would need the former, and I think the latter can be derived from initial UV coordinates.

// Animation name, animation list, FPS playback rate (optional), loop (optional)

I’m not sure it’s wise to have a per-sequence FPS - It seems like it would conflict with velocity based FPS schemes, among other things.

As for looping: Is there really any need for a system that doesn’t loop, given something like onLastFrame(), which would return true whenever the last frame of a sequence is displayed?

You just need to know when you’re at the end, so you can transition to another loop (which could just be one frame, if that’s what you want) … Right?

super.components.add(sm);

You should just be able to call components.add, without super - Is there a reason you use super here?

And yeah, I saw that the Sprycle data format’s fairly simple. However, not everyone wants to add an additional data file for animations. An example would be relatively simple, short animations that don’t have a lot of frame data.

With such a simple data format, it shouldn’t be too difficult to write some java code to generate the relevant json for TexAnim - That’s what I was trying to imply.

As another side-note, a Vertex wrapper class would be super helpful; accessing vertices and getting simple properties (UV data, for example) in LibGDX seems to be a huge pain.

Yeah, after the beta is out, we should add something along those lines.

PS - I submitted an issue, but I just want to be sure I post it; Sprycle doesn’t work in Blender 2.72.

Ok, I’ll get back to you there.

The old way I’d do this with the BGE is that the first number is the column of the sheet, and each number is the frame in that column, starting from the bottom-left corner. The current version of this is slightly different, and works from whatever frame the UV sprite is set to. This would mean that the sprite should be in the top-left corner of the sprite-sheet, regardless of which sprite it is. Animations can’t span multiple columns, but that isn’t an issue (for me, at least).

It would be the size of the texture, because of the way I’m doing it with TransformUV(). I’d rather just grab and set the information via vertex access to have better control, but vertex access with LibGDX appears to be, again, lackluster. I don’t really want to look into how it works to fiddle around with it for sprites at the moment.

Each animation in my sprite map has its own set of variables, so you can just set the FPS of any animation sequence manually with a function. Also, you don’t want every animation in the game to run at the same FPS, right?

What are the other issues?

Yeah, I’d think it could be necessary. Maybe you want to start a timer on the last frame, or something, and having “blank copy” animations could stack up quickly. Especially so if you have to transition to them manually in a callback function. That’d be a lot of



if (animation == "Slide")  animation = "SlideFinish";
if (animation == "Jump")  animation = "JumpFinish";


copy-pasta, if I understand you.

Nope! I just saw and fixed that a couple of moments ago, hah.

That’s cool, but I wouldn’t go the “write more code for another tool” route when I could just solve a simpler problem, so to speak. That problem is, in a nutshell, “How to do sprite / texture animation in BDX?” I think it would be ideal not to involve multiple tools or add-ons for this, though I definitely see the advantage and use in Sprycle to visualize animations.

I might be misunderstanding you, though.

Good to hear.

EDIT: Hey, I have another question. How do I instantiate a new scene? I need a background scene (named “BG”). Doing “Bdx.scenes.add(new Scene(“BG”));” doesn’t work, though it kinda feels like I’m on the right path.


Ah, I had to move it to the init() function rather than the main() function. Is that due to scenes having to exist before the engine runs or something? I could think of use cases where people might want to add scenes to a game dynamically.

You could also simply set the component frame rate to whatever is required for a specific sequence (if it actually needs to be different), when that sequence plays.

Wouldn’t that work just as well, without requiring extra “play data” on the sequence?

Also, you don’t want every animation in the game to run at the same FPS, right?

Having a frame rate per component (per object, in other words) would not result in that - All the sequences in a given component would play back at the fps set for that component, and each component can have a different fps.

It doesn’t really seem natural to have a frame rate for each individual sequence; It seems to me that the sprite sheet itself should basically define the relative speed of any action, and then if I want to go faster, I should just generally animate faster (set the component frame rate to something higher), instead of having to twiddle with each “sequence frame rate”.

I mean, if you have a sprite sheet for a character, where the fps is required to be different for each sequence, just to have normal-looking playback, wouldn’t it be better to simply fix the sprite sheet, so that all sequences normalize to a base frame rate?

What are the other issues?

The clean seperation between what a sequence is (a collection of frames), and how it is played (fps, looping, etc) would be muddied, and that may lead to additional complexity, or general inelegance in the long term.

If having per sequence fps is really that crucial, for you as an artist - Ok, I guess we need it, but we should still take the time to really think about our assumptions before we commit to anything.

Maybe you want to start a timer on the last frame, or something, and having “blank copy” animations could stack up quickly. Especially so if you have to transition to them manually in a callback function. That’d be a lot of

if (animation == “Slide”) animation = “SlideFinish”;
if (animation == “Jump”) animation = “JumpFinish”;

copy-pasta, if I understand you.

There are no “blank copies”, and there are no callbacks. There would be a TexAnim.onLastFrame() method, which would return true whenever the last frame of the currently playing sequence is displayed:


class AnimControl extends Component{
    private TexAnim ta;

    public AnimControl(GameObject g){
        super(g);
        ta = g.texAnim;
    }

    private State onGround = new State() {
        public void main(){
            ta.sequence("Standing");
            if (Bdx.keyboard.keyHit("space"))
                ta.sequence("Jump");
                state = jumping;
        }
    }

    private State jumping = new State() {
        public void main(){
            if (ta.onLastFrame()){
                g.movement.jump();
                state = inAir;
            }
        }
    }

    private State inAir = new State() {
        public void main(){
            if (g.velocity().z > 0)
                ta.sequence("MovingUp");
            else
                ta.sequence("Falling");

            if (g.onGround())
                state = onGround;
        }
    }

}

Logically, you’re talking about two sequences, even if “MovingUp” or “Falling” were just single, or even same frame sequences, they’re still different from “Jump” (conceptually). I would say the same for slide/sliding -> Isn’t it more sensible to have a “Slide” sequence, and then to transition into a “Sliding” sequence when “Slide” completes?

Looping sequences seem to be the core fundamental, so I don’t know … Can you think of some scenarios where a “play and stop” sequence has clear benefits?

That’s cool, but I wouldn’t go the “write more code for another tool” route when I could just solve a simpler problem, so to speak. That problem is, in a nutshell, “How to do sprite / texture animation in BDX?” I think it would be ideal not to involve multiple tools or add-ons for this, though I definitely see the advantage and use in Sprycle to visualize animations.

I might be misunderstanding you, though.

Yeah, I wasn’t clear enough:

TexAnim is designed to work with data in the Sprycle format, not specifically files produced by Sprycle. So, if you can generate relevant data in the same format, directly via Java, you don’t need Sprycle.

That’s how simple-mode works for BGE playback: I just use Python to generate the data in the same format that Sprycle would typically export.

Something similar could be done with TexAnim, to provide the features you require, on top of existing code.

Ah, I had to move it to the init() function rather than the main() function. Is that due to scenes having to exist before the engine runs or something? I could think of use cases where people might want to add scenes to a game dynamically.

It should also work in main … I think. If it doesn’t, it’s a bug, so feel free to make an issue (if there are any errors, be sure to include those).

Setting the component frame rate would work well too, yeah. It’s just two different ways to go about it, I guess.

To me, having data for each sequence is kinda natural, since it represents an animation as a whole, and everything about it. Some animations loop, others don’t. One animation may run faster than others (like a run animation). I’m unsure of what you mean by “extra play data” when you said, “Wouldn’t that work just as well, without requiring extra “play data” on the sequence?”


Don’t change the engine’s design for me - I’m a weirdo, haha. If the engine fundamentally works differently from how I want to do things, I can always just design my own solution.

The “onLastFrame()” idea sounds good; I prefer function checks to callbacks anyway.

Playing and stopping doesn’t really have any clear benefits per se; it’s just a different way of approaching things. I guess examples would be situations where you’d want to display an animation once, but not change behavioral states as you have outlined above (i.e. a door or chest opening). Most times you’d want things to loop, so I guess it wouldn’t really matter. Then again, I find that given the option, I use “one-shot” animations from time to time.


OK, I think I see. So this function, when provided a list of frames, would generate a piece of data I could pass into TexAnim to create the animation sequence? That sounds pretty easy to use.


Thanks, I’ve reported the bug.

I meant: Instead of having data on the sequence, which is used to determine how the sequence is played back (like fps), you could just have a call to change the component frame rate, when that particular sequence plays … I’m working under the assumption that very few sequences actually need to have a unique frame rate (just for normal playback), and that for the few that really do, you can just manipulate the component frame rate at the right time, instead of tagging each sequence with it’s own independent frame rate.

I’m a weirdo

Heh, maybe, but you have more experience with sprite animation than I do, so there’s probably value in understanding your preferences.

Also, I would like to build something that most people would feel comfortable with, and looking at TexAnim … It doesn’t really give that vibe (it turns out that I’m also a weirdo, just of a different kind :D).

Hey, is there a test sprite sheet, in your preferred format, that you could let me have for some testing?

Also, about your API:

When you call play(“Sequence”), what happens if you make the same call again? Does “Sequence” reset and start from the beginning, or does that only happen if it previously stopped (reached the end)? What if it was set to loop?

Ah, I see. It just depends on how you want to approach things, I’d guess. Either setting the component when you set the animation, or setting the FPS on the animation; you’re setting the same information the same way. But I’d disagree that you wouldn’t want sequences to have unique frame rates; I’m pretty sure you’d want animations to have their own frame rates fairly often (think of a walk cycle that plays back at 16 FPS, and a “sleeping” idle that’s comprised of two frames and plays back at 1 FPS). Changing the FPS on the component when you alter the animation should be fine.


I know you said you don’t want to introduce the engine to the greater area for awhile, but maybe you could do so slowly. Is it OK for me to mention it on the places I frequent apart from the greater game development community at large (like Twitter)? More input can result in a better engine overall, especially when it comes to stuff that’s kind of opinion-related, rather than efficiency-related.


OK, here’s an ideal sheet. Really, you’d probably add some blank space around the edge of each sprite, and the sprites could / probably should start from the bottom-left corner (for OpenGL’s purposes). But it’s an OK sheet, I think. Lots of blank space, but that will eventually get filled in with other sprites.


In my version of sprite animation, calling play(“Sequence”) just basically tells the sprite to play that animation. It doesn’t hold the playback process of transforming the sprite’s UV data, because the sprite animation process is a component. So play() “queues” the animation, while the main() function actually does the heavy lifting.

The sequence indicated to play will only reset if you tell it to play another sequence different from the one it was playing originally (by default). You have control over this with the second variable in the play() function (so the signature is play(animationName, changeOnDifferentAnimation). If an animation is set to not loop, I think you’ll have to set the subimage yourself to the beginning to restart it; I have to do some more testing with it, as it’s not really as finished as it could be. I already have a stop() function to stop animation and a resume() function to pick up with it (in case you need to pause animation).

I’m pretty much based a bit of my concept of sprite maps from FlashPunk, IIRC. And I was wrong on what I said above - it should be the number of frames on each axis in the source image in the new SpriteMap() declaration. My mistake! I’d rather not have to provide that information, though; if I could access the vertex data directly, then I wouldn’t need to. That’s how I did it with the BGE’s sprite maps - just grab the information about UV frames from the UV data itself, from the vertices.

what about a check in between each frame for camera angle?

this would allow the sprite sheet system to select a different UV section in mid animation, for isometric 3d games, or even full 3d sprite games like duke nukem…

and again I ask… I have used spricle, and I have used Fweebs sprite gen tool,

however if we make a standard system for generating sheets, and a standard system for using them (in bdx, bge, and???)

A easy to use tool for turning 3d model animations into sprite sheets with multiple view angles?

I think it would make it into blender core if it was well enough made…

Ok, I merged your patch, and I also replaced TexAnim with SpriteAnim, which should be more in line with your preference, and also give us a few other options in the future.

I did a first draft of the docs for that (SpriteAnim), but more will probably have to be done.

I know you said you don’t want to introduce the engine to the greater area for awhile, but maybe you could do so slowly. Is it OK for me to mention it on the places I frequent apart from the greater game development community at large (like Twitter)? More input can result in a better engine overall, especially when it comes to stuff that’s kind of opinion-related, rather than efficiency-related.

I would prefer to wait until the end of the month/year.

We can use the time to squash the more obvious bugs (which keep popping up), and I’ll be able to put aside some time to make a video tutorial series, which can help us retain a significantly larger number people who visit the project page (inexperienced developers, who really need a “step by step” guide) - Right now, there’s very little that would keep them around, and those who “bounce” on that first encounter are unlikely to come back when we’re actually ready for them.

However, if you really can’t wait to tweet about it … It’s your decision, and maybe it’s the right call … I don’t know.

@BluePrintRandom

I don’t plan on making that tool.

@BPR - Changing the sprite depending on camera angle can be done via Java, and tools exist to export a spritesheet from Blender, IIRC.

@Goran - Great! It’s worth noting that it only works if you have a sprite that consists of a single plane, and not multiple ones. I can see the advantages of having sprites that can span multiple planes (waterfalls or streams, for instance). Just something to keep in mind to expand in the future.

So this isn’t really a bug per se, but just something to keep in mind: Animations only trigger based off of their FPS values (I’m guessing this is because it applies on the next frame for the animation), which is generally bad practice. What this means is that if you have a walking animation and a 1 FPS standing animation, and trigger the standing animation, it will actually start a maximum of 1 second after you started triggering it. Until then, the walking animation will be sitting there, paused. The animation should trigger immediately, regardless of how quickly the playback is.

Overall, though, this seems like a really solid animation system. I like the idea of “onLastFrame()” instead of a callback that gets called when an animation finishes.


Thanks for the merges! Function and Num keys are used from time to time.


I don’t mind waiting to tell anyone about the engine, though that could prove difficult if I share what I’m working on from time to time elsewhere (since it’s using BDX). I know the engine’s not perfect or anything, but it’s already really use-able as is. Even using the engine itself is relatively simple. The only things you really need to know are making a new project, adding game logic, and where to find the API; most everything else you can kind of figure out by yourself. On the other hand, I could see the benefit of waiting until it has some additional features, as well.


Something that I’d like to ask is about code documentation in the actual source. I’m unsure if that stuff gets scrubbed out in the compiled (?) .jar files, but if not, what do you think about it? Having to open the Wiki just to learn about what a function does could become troublesome.


Hey, I submitted a PR for additional flipX() and flipy() functions that allow you to set the flipped status via an argument.