RSS
 

Archive for February, 2012

Effect System

27 Feb

Been working on a new Effect System for Spellbook and Grey lately (not much time for it, though)…

For discussion purposes, an Effect System is a subsystem that will allow me to quickly build and modify effects. Effects in this context are any sequence of visual/audio items that need to do be done in a sequence to augment the animations of the characters…

For example, when Grey does a life-shaping spell, he needs to play his animation (with any sound effects needed), turn on two point lights that follow his hands, draw a beam of light from the ground to the sky, etc… When the effect ends, we need to activate whatever he life-shaped into existence (which can have any number of effects as well).

I’ve defined some goals for this effect system:

  1. Independent – The system should be independent of most existing Spellbook systems, specially minimizing dependencies with the animation system (because of a point below).
  2. Multithreaded – This system should be able to run in a separate thread, synchronizing only for the rendering parts. I want this so that I can do more complex effects, like physics-based cloth animation, etc, without nuking the frame rate.
  3. Data-driven – I should be able to design a whole effect without doing any actual coding. For phase 1, the idea is to have a XML-driven effect, which describes the effect and the changes in properties of the entities that make up the effect, but in the future I want to build a component in SurgeEd that allows me to design the effects in a more user-friendly environment (a Flash-like timeline)
  4. Jump-to-frame – Because I want one day to have a decent application to author effects, I need the effects to be capable of jumping to a specific frame (so I can implement the timeline). In most casts, it’s simple enough to do this (because the state is implicit in a formula), but cases with more random components (like particle systems), this might be more complicated.
  5. Event-tracking – The effect must be capable of raising events (for example, if the spawn of the creature needs to start at a specific time in the effect)
  6. Time-scaling – The effects must be capable of going faster or slower, depending on the instancing of the effect: for example, if the cast time of a fireball is normally 3 seconds and I want it to be done in 2 seconds, the effect must be speeded up.
  7. Hierarchy – The effects must have components that can aggregate other components (and respect the scaling/orientation/position of its parent)
  8. Object reference – All effects must have a source object (that will be the target of animation controls, for example)
  9. Reuse of meshes – The system must be capable of reusing meshes; for example, if I have the same effect running 10 times, I must be able to use the same mesh for all of them, so I can cut the DIP calls from 10 to 1.

 

Of course, some of these will clash with others; for example 9 makes it harder to implement 7, since I have to do all hierarchy calculations in the CPU, instead of going for the GPU.

Anyway, what I have for now is an Effect System, that manages Effect Instances, which contains Effect Objects. The instance is build from an Effect Declaration, which describes properties and interpolators. The Effect Instance animates the properties using the interpolators (in this context, interpolators are everything from a linear interpolator in which a value goes from A to B in C time, to random interpolators which just assign a random value A to the property). The Effect Objects then use these properties to update a renderable mesh that it requests the Effect System…

All in all, the system is becoming interesting, with a good decoupling of animation and render tasks (because of 2), and the fact that I treat everything as a function of properties and interpolators helps along with 3.

Hopefully I’ll have some more on this by the end of the week, on the Spellcaster Studios blog. Any questions/suggestions, don’t hesitate! Smile

 
 

Realm of the Mad God

20 Feb

Now this is how you make a good game with little resources: Realm of the Mad God!

A lofi dungeon crawler that you play on your browser, with charming 8-bit art done by Oryx (at least I think I recognize the sprites)…

Give it a try, it’s really cool!

 
No Comments

Posted in Games, Indy

 

Tarja Turunen Live

16 Feb

Yesterday I went to a Tarja Turunen’s concert. For those that don’t know, Tarja is the previous Nightwish singer… She left the band some years back and has been doing solo albums since…

 

Although her work isn’t as good as Nightwish when she was there, it’s on par with Nightwish nowadays!

Anyway, the concert was amazing… she showed herself to be a great front-woman, delivering an amazing performance, showing off her unbelievable classical-trained voice, with a good mix of rock/metal and slower/ballad songs.

I was quite surprised that it worked so well live, with a very eclectic audience cheering the whole show…

Definitely one of the best concerts I’ve seen lately, and I’m looking forward to her next album/tour!

 
No Comments

Posted in Music

 

Why is Dr. Who so awesome?

13 Feb

…Well, I don’t have any clear idea on that, but that’s the reason I didn’t work as much as I should on the weekend! Smile

I’ve started watching the new series of Dr. Who (the 2005 version), and I’ve watched 3 seasons so far, and I find it riveting; no idea why I didn’t find this so cool the times I’ve tried watching it in the past!

Anyway, my main idea on this is that the character of the Doctor is at the same time accessible and yet mysterious… We don’t know that much about him, and that keeps us glued to the screen trying to figure out who exactly he is…

Hopefully, this will be one of the drivers for Grey. Although he isn’t as accessible as the Doctor, he is very mysterious, with a past veiled even from him… I hope people will find that interesting enough to keep on playing!

 
No Comments

Posted in General, TV

 

Damn work! :)

10 Feb

Not much has gone on lately, except for the bad week start and then work has gone crazy, so I haven’t done much lately on my hobbies… Haven’t played SWTOR in ages, so I still haven’t had the time to finish all the questing so I can do an “early impressions” review…

Anyway, I took the opportunity to read up a lot on shading systems, specially multi-materials on a deferred rendering context, and I decided that when I have the chance, I’ll implement something like this: Anisotropic Lighting, combining a 3d texture to store the maps and a material id lookup (since I still have component free on the G-Buffer). Still not an ideal solution (since I can’t parameterized that much the materials, beyond the lookup… for example, I can’t parameterize rim-lighting with a falloff parameter, I have to fix that so I can generate the lighting lookup table). Anyway, it should give me some more flexibility in having different materials, specially on Grey

grey_anim03

The hair and fur shading seem “incorrect”, and this hopefully will allow me to fix it (with double-sided lighting for the hair and some anisotropy on the fur).

There’s a new blog post on Spellcaster Studios, showing some props and base textures for the terrain tiles, besides some explanation on how we’re going to make the terrain in the first episode.

Another thing that I’ve been working was with some SQL queries for work: I had a query that basically inserted some rows into a database, but it could only do that if there wasn’t some other rows there yet. Basically, I need to queue some reset commands, but could only do that if there wasn’t any pending reset commands…

First version just iterated and checked in PHP, and took about 15 seconds…

Then we built a query that did all that in one SQL query, and it took about 9 seconds (because it had to do a SELECT query for every hit in 1400+ rows)… Still too slow…

Finally, we just designed a series of statements with a different point of view… Instead of adding the new data and before adding it check if it was already present in a specific table (a query), we created a temporary table that had all the pending requests, and we just checked if the data we wanted to insert was in that table or not (a “static” structure)… Boom, down to 0.005 ms per query…

For fun, here’s the code:

CREATE TEMPORARY TABLE TempTable(
   key VARCHAR(50) NOT NULL
) ENGINE=MEMORY;

INSERT INTO TempTable(mac)
SELECT data FROM MainTable WHERE ((type=5) OR ((type=7) AND (error LIKE 
'processing%')));

INSERT INTO MainTable(id,user,status,type,data,error,comment,time) SELECT 
NULL,1,1,5,OtherTable.key,'','Device reset request (type=5)',NOW() 
FROM Services
INNER JOIN Addresses
ON Services.address=Addresses.id
INNER JOIN Devices
ON Services.device=Devices.id
INNER JOIN OtherTable
ON Devices.parameters=OtherTable.key
WHERE (Addresses.location=40) AND (Services.type=1) AND OtherTable.key 
NOT IN(SELECT key FROM TempTable);

DROP TABLE TempTable;

So, even something like SQL can be optimized! Smile (I really hate SQL and database programming, but this kind of things are quite neat!)

 
 

Bad weekend…

06 Feb

Had a terrible weekend… my grandmother passed away on Sunday, may God have her now…

Although it wasn’t something we didn’t see coming, it always hits you hard and makes you wonder what’s the point of this all… Fortunately, my grandmother wouldn’t approve of such nonsense and would say for life to go on…

Goodbye grandmother, you will be missed…

 
No Comments

Posted in General

 

Not much new…

02 Feb

New blog post at Spellcaster Studios, about animations…

For myself, not much to add in my life lately… Between my real job, developing Grey and getting to level 50 in Star Wars: The Old Republic, I haven’t had time for much of anything… Smile

Ah, the hard life of someone with too many hobbies, not enough time!

 
No Comments

Posted in General