Defining Awesome — Map pixel render script example
  • Status Updates

  • Map pixel render script example

    Written by . Posted at 6:41 am on May 12th, 2010

    I got the map pixel renderer working through a script file. I used Angelscript cause its the fastest and easiest to use. It has a C syntax and I hope most modders will be familiar with it. This basically works like a pixel shader, so we pass texture information and details about how the tile should be rendered and we get a nice image from it

    This is the simplest possible code just taking the color of the tiles texture.

    Code:

    Screen:

    Lets do an effect with a second texture. How about a simple rust effect that appears on light areas of the texture.

    Code:

    Screen:

    For some more interesting effects we use math functions. Here is a gradient effect using sine.

    Code:

    Screen:

    Be Sociable, Share!

    17 comments.

    1. looks like possibilities are endless. good job. when can we expect some kind of a preview for the map editor and new assets?


    2. Next week. I’ll have it ready.


    3. Will there only be 45° diagonal tiles (like it is now) or will you implement tiles with other angles/is your algorithm capable of finding other angles from the map bitmaps.


    4. what the gradient is interesting.
      How would you programing? C, C++?


    5. Neat scripting idea, and impressive bindings!

      I’m wondering, how is this parsed? Some sort of parser you wrote or a library you’re using?


    6. Answered my own question: Angelscript. I need to skim less over articles, ha.


    7. Makron666

      Good question: What is ‘f’, it pops up all over your engine.


    8. the dude

      watch some Metalocalypse, maybe it will give you inspiration for the game, and fucking finish the game


    9. FinDude

      Makron, could it perhaps be notition for (f)loat type variable?


    10. Makron666

      Yes, it could, but just to be sure. Also, yea metalocalypse will inspire you.


    11. Will there only be 45° diagonal tiles?

      There will be 22.5° angled tiles for sure. I can make more but they require more work because of their “tile nature”. But it is possible.

      I’m wondering, how is this parsed?
      I was seriously considering writing my own parser like the Doom 3 shader parser but decided to use AngelScript instead.

      ‘f’ is for float, to distinguish from double and integer.


    12. Wow this looks amazing! Great job so far MM!
      Question: data.texture2pixel – is that similar to data.texturepixel, but just a different “layer” or something (I’m not very experienced with this type of thing)? (I expected an array of textures, which is why I’m asking)


    13. WHAT ABOUT FORS AND WHILES AND POINTERS AND MALLOCS AND FREES.
      Probably not the second two.


    14. It’s about time sooemne wrote about this.


    15. I found your site through Aditya on twitter It’s always nice to find a fellow podcaster who’s also a journalist. I do hope you find the doggie stronger and better tomorrow.


    16. Admittingly I’m looking at this from Java perspective, yet your blog entry baffles me: With all DI containers I used, a factory was something configurable as well. Dependencies were injected the usual way by using setters, constructors or annotations. The only difference was to additionally configure the name of the actual creation method, so the containers knows, which method to call in order to create a new object. No dependency on the DI container itself is needed this way.What’s so different in the .NET world, that you need to rely on the DI container inside a factory there?


    17. Even after you tell me I don't see the car wash… but I do see a cool abstract! 😀 (Is the linky down? I don't see it… wanted to go visit some other linked sites.)


    Post a comment.

    Links