Jump to content

  • Log In with Google      Sign In   
  • Create Account


phil_t

Member Since 06 Oct 2006
Offline Last Active Yesterday, 10:55 PM

Topics I've Started

Scripting solution for C# project

29 May 2014 - 05:47 PM

I'm trying to come up with a scripting solution for my entity component framework written in C#. This would be for specialized scripts attached to entities. Right now I have a Script component to which you can attach script ids. These ids map to C# classes that implement the scripts. There is only one instance of each script. When it runs it is presented with "property bag" state associated with the entity, and it can read and write values to that.

 

It's functional, but the way I get/set script properties in code (accessing them by id from a property bag) is ugly. I'd rather just be able to treat them as regular C# properties on the script object. The reason I can't do that is because I need to quickly serialize the state of the script. 

 

I have the following requirements:

- I need to be able to reasonably quickly serialize the state of the script and equally quickly re-hydrate it. The state should be platform portable, and generate no allocations during serialization (this I have now)

- Be able to store variables of simple data types (float, int, etc...) as part of per-entity per-script state. (this I have now)

- Access those properties with clear syntax (E.g. "DeathTimer = 1.5", instead of "propertyBag.SetFloatValue(DeathTimerId, 1.5f)"  (this I do not have now)

- Be able to access an entity's components through simple syntax (e.g. "entity.Transform.Position = new Vector3(0, 0, 0)"). (this I do not have now, but I could probably hack something together to give me this nice syntax).

 

 

1) I've though about using Lua, but I'm not sure how flexible it is. Can I customize how C# properties/methods are exposed in Lua? i.e. make my ugly PropertyBag object appear as a regular object to which I can get/set properties.

 

2) I could invent my own scripting language to accomplish everything I want. I started down this path for a while, but it is a lot of work.

 

3) Keep using C# and find some solution to make my syntax nice (basically this means finding a good way to handle quick serialization of script state). This is the most flexible coding-wise, and has the least dependencies (i.e. I don't need to depend on some 3rd party Lua library), and I'd like to go down this path if possible. If C# had macros, I could easily "auto-generate" object properties that have their data stored in my PropertyBag (ala DependencyProperty). I think this would solve most of my syntactic concerns. But alas...

 

Any thoughts? What are other people using?


Problems with DXT compression and pre-multiplied alpha

29 March 2013 - 01:32 AM

I'm normally a big fan of pre-multiplied alpha, but I'm having some issues with using it with a certain texture.

 

Here's a screenshot to demonstrate the problem:

 

http://mtnphil.files.wordpress.com/2013/03/example1.png

 

The artifacts are obvious in the top image. If I don't compress the texture, I get the image on the bottom, which looks good.

In the middle is what happens if I use non-premultiplied alpha and DXT5. It looks pretty good (still a few small artifacts). I'm surprised it is so much better than pre-multiplied alpha.

 

Here is what the RGB and A channels look like for the DXT-compressed texture (grabbed from PIX):

http://mtnphil.files.wordpress.com/2013/03/dxt5_texture_in_pix.png

It looks as I would expect.

 

Other notes:

- I also tried DXT3, but there wasn't much difference in quality.

- No mipmaps are involved. All textures are drawn 1-to-1 texel-to-pixel.

- All screenshots are 3x.

 

Any idea what's going on here? I have a feeling the problem might go away if I had proper RGB values for the transparent parts, but I'm not sure how to make photoshop do that. (and if that were the problem, why would the non-premultiplied DXT scenario look fine?).

 

 


Like spherical harmonics, but 2D?

09 September 2012 - 11:37 AM

Would this just be plain old a fourier series? It's been a long time since my last math course.

Basically, I would like to have a small number of coefficients that I can use to represent a function that varies with the angle around a point in a 2d plane. This sounds like what spherical harmonics are often used for (global illumination affecting a point) but with one less dimension.

Could anyone suggest a website/tutorial somewhere that could show me how to do this? I have an engineering math background, but it's been about 15 years since I touched it :-).

Hyloth

28 October 2011 - 11:41 AM

Hi, I wanted to introduce the game project I'm working on. I don't have a name for it yet, so I'm using "Hyloth" for the time being, which is a dungeon from the Ultima series (one of my inspirations).

It will be an RPG set in an alternate reality in medieval-ish times (not original at all, but this makes it easier to develop), with a bit of a twist. The original seed of a story was to think about how alien abductions would appear to a non-technologically advanced civilization (a bit of a spoiler, but I figure not too many people from the general public will look at this forum).

I want to have a focus on exploration and a compelling living/breathing game world. I'm trying to combine the things I miss about old RPGs but with the gameplay advances that have take place in the last 20 years. And hopefully beautiful (but not necessarily realistic) visuals.

After 14 years as a professional developer, I quit my job to start work on this, so hopefully I have the motivation to execute well and see it through to the end :-)

One of the key parts of the game for me will be making a beautiful outdoor environment and having nature tie in with gameplay. Mostly lately I've been working on visuals, specifically weather and wind. I'd like to show off a bit of what I've done:




In the past I've done some gameplay prototypes with basic 2d graphics. I hope to begin working on the core gameplay and combat soon, and maybe have a play-testable demo by early next year.

Currently I'm using XNA, so I hope to make this for PC and Xbox 360. If eventually I think I have something worthwhile though, I may port to a more cross-platform solution (e.g. Unity) in the future.

Let me know what you think!

I have a developer's blog at http://mtnphil.wordpress.com, and the main website for my one-person company is http://icefallgames.com. Not much there yet except a few random game design thoughts, and some screenshots from my prototypes.

Phil
IceFall Games


vegetation wind animation sample

18 October 2011 - 07:05 PM


I've always wanted to try the Crysis-style vegetation wind animation that is described in GPU Gems 3. I finally got around to it yesterday. There were a few bumps along the road trying to decipher the original paper, so I wrote up an article about it and included an XNA implementation.
Here's the article if anyone's interested.

PARTNERS