The particle code is shaping up nicely. This is now the third re-design from the ground up and this is the one that I’m sticking with. I decided to use the CPU for particles. Yes, it is limiting and, yes I am aware of things like texture-data, transform feedback VBO, and OpenCL particle systems that run in parallel on the GPU. I chose to implement particles on the CPU because I wanted to have a modular system that was easily extensible. I didn’t want to write a tool that would dynamically generate a shader or OCL kernel for every possible combination of parameter manipulation modules. I wanted to have access to the particle data in order to do things like per-particle light sources and collision.
The current system meets these needs by using what I’m calling modules. Modules implement interfaces and are assigned to emitter definitions; essentially a form of dependency injection. Emitter definitions are collected within system definitions or assigned to other emitter definitions as child emitters that spawn either at the birth of a particle or on the death of a particle. Particles exist in an array and are generated on start-up. The particle pool manages particles by allowing emitters to request either a sorted or unsorted particle, and allows a maximum of 10k sorted and 20k unsorted particles.
When the particle manager receives a request to create a new particle system from a definition and attach it to the scene graph, it creates a new system instance, and subsequent emitter instances. The instance classes are very lightweight and contain instance specific members such as system world position, emitter position relative to the parent system, active particles, and counter modules copied from the definition. Each emitter contains a reference to it’s definition and, during the particle update loop, the modules attached to the definition are called and passed a particle to act upon.
Using a modular dependency injection in this way greatly reduces conditional branching within the update loop and allows new behavior models to be added quickly, easily, and with very little risk of breaking the save format.
Features:
Total Project Statistics:
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 645 15593 7098 45229 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 62 458 130 1839 Javascript 14 262 89 1192 XML 11 158 16 771 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 1051 27395 13259 79038 ---------------------------------------------------------------
Update 0.0.146e is live!
This update has a few fixes and one major addition: sprite animation editor! Currently the animator supports three types of interpolation: step, linear and cosine. Initially I had planned to also use cubic interpolation like a Hermite or TCB spline, but decided against it. The cosine has some of the features of a parameterized spline, like the smooth ease-in and ease-out, but lacks the fine-tuned control of a TCB spline. I’m ok with that for now. The cosine interpolation is cheap and the sprites are blocky. Seriously, how much granularity do we need here?
There is now an envelope editor that allows you to visualize all of the keyframes in the timeline for each transform and assign an interpolation type for each axis.
Lodestar:
* Fixed crash report newline spacing… again
Launcher:
+ Added animator to the menu
* Fixed empty menu on initial download
Sprite Animator:
+ Initial release; v0.1b
Sprite Editor:
+ Added hotkey Q for Add
+ Added hotkey E for Paint
+ Added hotkey S for Erase
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 483 12830 5477 37052 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 11 158 16 771 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 881 24581 11619 70601 ---------------------------------------------------------------
Didn’t get much done this week with the holidays and all, so I’m afraid there will be no update this weekend. I did get a great start on the animator and I hope to release it in next weekend’s update. Stay tuned!
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 472 12499 5307 35440 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 10 134 14 669 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 869 24226 11447 68887 ---------------------------------------------------------------
Version 0.0.144e is live!
This week was spent adding features to the sprite editor and I’m proud to say it’s done and time to move on to the animation editor. Here are some screens and the changelog.
I have nightmares about Java layout code.
Launcher:
* Fixed Windows Aero graphical glitch
Sprite Editor:
+ Palette string tags
+ Improved selected swatch indicator
+ Widescreen view
+ Center pane now uses all available space
+ Procedural HSB palette variance
+ Improved color preview in swatch editor and swatch selector
+ Scroll wheel scrolls through slices when hovered over slice view
+ Selection tool with selection size and location modification
+ Cut / copy / paste selection
+ Undo / redo paste selection
+ Fill, paint, delete selection
+ Select all
+ Crop to selection
+ Resize sprite
+ Clear palette button
+ Symmetrical editing: paint, fill, add, erase and most selection edits
+ Hold A, W, or D and scroll to move selection in 3D view
+ Hold A, W, or D + LShift to size selection in 3D view
+ Copy / paste palette swatches
+ Luminosity value for each palette swatch
+ Luminosity preview mode in 3D view
+ Swatch edits and pastes can now be undone
+ Redo functionality
+ Grid and sprite bounds visualization in 3D view
+ Origin editing
* Fixed timer thread shutdown bug
* Fixed duplicate filename extension bug
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 413 11046 4183 30782 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 10 134 14 669 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 810 22773 10323 64229 ---------------------------------------------------------------
Update 0.0.143e is live!
For those of you who don’t know, you can snag the software and all future updates for only 5 USD in our store. This update includes the 3D sprite editor, accessible from the little toolbox in the corner of the launcher. Get in early before the price goes up! Lodestar is still early in development and every little bit helps. :D
Keep in mind you will need a video card capable of at least OpenGL 3.3 and Shader Model 3.0 to run the software. The 3D sprite editor will run with OpenGL 1.1.
Here are the patch notes:
+ Added 3D Sprite Editor v0.1 to tooklit
+ New launcher
+ Access toolkit resources from launcher
+ Improved error handling
* Server threadpool now shuts down properly
* Fixed server crash when duplicate players try to connect
* Fixed five second session expiration bug
* Fixed silent crash when starting a game
* Crash report now generates proper newline for the issue tracker
* Fixed pre-launcher crashing when no internet connection
* Fixed pre-launcher Java 6 only requirement; now accepts 6 or 7
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 392 10315 4126 27732 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 10 134 14 669 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 789 22042 10266 61179 ---------------------------------------------------------------
Sprite editor in progress… will be in the update this weekend!
I had to write a converter to be able to load in the old LSS sprite format. As you can see by the picture with the orange hair, the old format was somewhat wasteful. Also, I ran into a problem: the old format uses three floats per voxel to represent color whereas the new format uses 16 indexed colors. This means that the old format used way more than 16 colors.
When I first loaded the sprite with orange hair, I used a simple bit of code that just put the first 16 unique colors into the swatches. All swatches were filled with various shades of orange. Not good.
So I thought about it a little bit. RGB values from 0.0f to 1.0f can be thought of as three dimensional points in the first (+, +, +) octant. Therefore it should be pretty straightforward to use the distance formula [ d = sqrt(deltaX^2 + deltaY^2 + deltaZ^2) ] as a measure of how similar two colors are. Testing against a threshold [ if d < threshold … ] allows subsequently discovered colors to use an existing indexed color if the new color is close enough.
It’s not perfect as it still produces some anomalous results, but it’s good enough to retrieve some of the hard work I put in on the old sprites a year ago.
Current features include:
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- Java 380 10137 4127 26833 PHP 309 10275 5858 26722 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 9 111 12 574 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 776 21841 10265 60185 ---------------------------------------------------------------
Improved error handling for the networking and scripting. Known errors that can be handled are displayed while everything gracefully saves and terminates in the background, returning the player to the title screen. The client no longer bombs all the way out when a minor exception is thrown.
http://cloc.sourceforge.net v 1.56
--------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------- PHP 308 10266 5858 26710 Java 354 9468 3860 24074 CSS 6 641 68 3242 GLSL 54 407 111 1579 Javascript 14 262 89 1192 XML 9 111 12 574 HTML 3 8 0 42 DOS Batch 1 0 0 1 --------------------------------------------------------------- SUM: 749 21163 9998 57414 ---------------------------------------------------------------