Loki's blog

  • Home
  • maloki.net
    • 25 May 2012
    • 0 Responses
    •  views
    • Instagram Photography
    • Edit
    • Delete
    • Tags
    • Autopost

    via Instagram http://instagr.am/p/LCp5ENs0Bg/
    • Tweet
  • Lone Mushroom

    • 25 May 2012
    • 0 Responses
    •  views
    • Instagram Photography
    • Edit
    • Delete
    • Tags
    • Autopost

    via Instagram http://instagr.am/p/LCpbOkM0Be/
    • Tweet
  • Lone Mushroom

    • 25 May 2012
    • 0 Responses
    •  views
    • Instagram Photography
    • Edit
    • Delete
    • Tags
    • Autopost

    via Instagram http://instagr.am/p/LCpauSs0Bd/
    • Tweet
  • Realignment

    • 12 May 2011
    • 0 Responses
    •  views
    • Edit
    • Delete
    • Tags
    • Autopost

    First of all, I've stopped working on CanLaro for quite some time now and I'm not sure if I'll continue working on it anytime soon. There are some other HTML5 libraries and game engines out there such as ImpactJS that works pretty well already. I'll be keeping the repository up on GitHub though, just in case. 

    I've also decided to make the switch from WordPress to Posterous. I will not have any control over what features gets added or removed to the blogging engine, but I think I can live with that. These limitations allow me to focus on what's important: the contents and the projects I'm working on.

    Finally, I'll be starting a dev diary for my projects. I'm writing it mostly for myself, but you're welcome to read it. I'll still be posting some dev work here on my main blog, but I'll be restricting it to about major or minor releases and other reladed stuff I'd like to share.

    • Tweet
  • CanLaro: HTML5 2D Canvas Game Development Helper

    • 9 Sep 2010
    • 0 Responses
    •  views
    • canvas html5 javascript projects
    • Edit
    • Delete
    • Tags
    • Autopost

    While looking around for some HTML5 Canvas code, I found a lot of examples, but only a handful of reusable libraries. The drawing functions, are useful and there are draw image functions that draw a part of an image, useful for a sprite. Nice but it can get troublesome with tiled animation and transformations. In the end, I decided to make one myself: CanLaro!

    Can: short for canvas, also "to be able to"
    Laro:  Tagalog word for game

    My goal for this library is mainly to provide code that can help any 2D game get started as long as you know some Javascript and know what a game loop is. I wrote/am writing this mainly as a helper and you are free to write your game as you please.

     

    Here it is in action: CanLaro Demo: BobCanvas. 

    Canlaro

    At the moment, here's what it offers:

    • Sprite
      • multiple animations (different sets of frames per animation)
      • transformation (rotation, translation, scale)
      • alpha
    • Keyboard Input Handler
      • configurable key mapping
      • key state checking (of course!)
      • opposing keys

    Check the README at the CanLaro github project repository for more details and updated documentation.

    Planned possible updates:

    • Resource Manager/Loader (there's code in there, but it still needs some work)
    • Sprite Manager
    • Audio Manager
    • ...
    • Tweet
  • Ubiquity 0.5; Updated Ping.fm command

    • 10 Jul 2009
    • 0 Responses
    •  views
    • Programming Technology projects
    • Edit
    • Delete
    • Tags
    • Autopost
    Ubiquity 0.5 is out! If you currently have and older version of Ubiquity installed for Firefox, it won't automatically update since it would break a lot of other commands in the wild. If that's ok with you, you can download Ubiquity 0.5 at Planet Ubiquity. Of course, mine broke, too, and I just updated it! Whoo! I updated my Ping.fm Ubiquity command to use the new parser. Others should also be able to localize the command if they want to do so*. The old version of the command is still up just in case some issues pop up in this version of the command. There are still some tweaks (and maybe some other features) I want to put in but this is it for now. Time for me to get some sleep. It'll be a busy day at work later! -- *Well, not now, but probably in the future as:
    "Community commands (those hosted on individual servers, locally, or on the herd), however, cannot be localized at this time." (via: Labs/Ubiquity/Ubiquity 0.5 Making Commands Localizable - 09.07.10)
    Maybe soon...
    • Tweet
  • Don't Repeat Yourself using LINQ & Delegates

    • 29 May 2009
    • 0 Responses
    •  views
    • C# DRY LINQ Programming Technology
    • Edit
    • Delete
    • Tags
    • Autopost

    In one of my projects, I had to look for certain objects using certain qualifiers: ID, Name, ID & Name, etc… Without optional parameters (Hello C# 4.0!), I ended up with copying & pasting whole blocks of code: initializing, filtering, returning the result, error handling, etc. I wondered if there was an easier solution to that and then it hit me! LINQ & delegates!

    Let’s start with a simple class:

    public class Employee
    {
        public string FirstName { get; protected set; }
        public string LastName { get; protected set; }
        public int Id { get; protected set; }
        //...and other methods...
    }

    Then, we have a List of Employees:

    List<Employee> Employees = new List<Employee>()
        {
            new Employee("Juan", "dela Cruz", 1),
            new Employee("John", "Doe", 2),
            //and so on...
        };

    Now let’s try making some convenience methods for retrieving a collection of filtered Employees.

    public IEnumerable<Employee> GetByLastName(string last)
    {
        IEnumerable<Employee> result = 
            Employees.Where(emp => emp.LastName == last);
        return result;
    }
    
    public IEnumerable<Employee> GetById(int id)
    {
        IEnumerable<Employee> result =
            Employees.Where(emp => emp.Id == id);
        return result;
    }

    Quick & easy, yes? Now what if instead of a List, our collection of Employees isn’t that stable. We’d need to put each of them in try-catch blocks and add error handling. This can quickly become high-maintenance code.

    Enter LINQ and delegates!

    We then basically need one method that will contain all the error handling, initialization and whatnot. We just pass a delegate will filter the collection:

    public IEnumerable<Employee> GetEmployee(Func<Employee, bool> query)
    {
        try
        {
            //initialization
            IEnumerable<Employee> result = Employees.Where(query);
            return result;
        }
            //handling other exceptions...
        catch (Exception ex)
        {
            //Error handling
            return null;
        }
    }

    Did you notice: Func<Employee, bool>? All we need is to pass an expression that uses the Employee as input and returns a boolean (true if it passes the condition or false if not).

    What does this mean? Well, we can now replace the convenience methods we wrote earlier with this:

    public IEnumerable<Employee> GetByFirstName(string first)
    {
        Func<Employee, bool> query = emp => emp.FirstName == first;
        return GetEmployee(query);
    }
    
    public IEnumerable<Employee> GetById(int id)
    {
        Func<Employee, bool> query = emp => emp.Id == id;
        return GetEmployee(query);
    }

    We’re back to code that’s easy to maintain with all the initializations, error handling and other code blocks that you need.

    You could even do away with the convenience methods and use lambda expressions all the way!

    GetEmployee(emp => true); //get everything
    GetEmployee(emp => emp.LastName.Contains("Locs"));
    GetEmployee(emp => emp.FirstName == "Richard"
        && emp.LastName == "Locsin");

    Have fun!


    Related resources:

    • LINQ
    • Lambda Expressions
    • Tweet
  • On Drawing

    • 14 Apr 2009
    • 4 Responses
    •  views
    • Personal
    • Edit
    • Delete
    • Tags
    • Autopost

    Just something I said a while ago to Oyen on drawing...something I have to keep in mind myself.

    Don't censor what you think. Don't throw away any ideas, just sort and archive. No matter how bad you think you draw, just do it. Pick up styles that you like and try to copy them. Explore other styles & copy them again. Along the way, you'll keep a certain style that's uniquely you.


    I should really be carrying my Moleskine notebook and a few pens around...

    • Tweet
  • Braid: Soundtrack + Level Editor!

    • 14 Apr 2009
    • 0 Responses
    •  views
    • gaming
    • Edit
    • Delete
    • Tags
    • Autopost

    Braid is finally out on the PC. Jonathan Blow is working on some bugs. AAAAND there's the official release of the Braid Soundtrack, and a Level Editor!

    Soundtrack

    The Braid Soundtrack is available on Magnatune with two remixes of songs from the game (Maenam and Undercurrent by Jami Sieber, Jon Schatz remix)! The soundtrack itself is amazing. You can stream the music and listen if you don't believe me.

    Level Editor

    To get the level editor on Braid, add a "-editor" argument when running the game and press F11. The interface might be a little confusing but fortunately, documentation will be released soon:

    Yeah, after I get a new version out in a few days that fixes the problems some people are having, and when more people have played/finished the game, I am going to post some documentation for the editor. The way it works is you can make levels with the editor (up to a full game, potentially) and run that with -universe later... also a tool will be released that lets you take Photoshop files and import them into the game, if you want to put new graphics in your levels.

    -Jonathan Blow, Steam Forums

    Now that the "what if" there was a level editor has been fulfilled, we can expect user-created "what ifs" in the coming months, weeks, ...or even days? I'm excited :D

    [gallery]
    Source:Steam Forums (On Braid Soundtrack, Map Editor)
    • Tweet
  • Windows 7 Secrets

    • 14 Jan 2009
    • 1 Response
    •  views
    • Microsoft OS Technology
    • Edit
    • Delete
    • Tags
    • Autopost
    Yesterday, I posted my first impressions on the Windows 7 Beta. Today, I've bumped into a great informative post by Tim Sneath with his 30 favorite secrets in Windows 7. Much thanks to Tim! Back From Retirement I was happy to find among them a way to bring back the old Quick Launch Toolbar! (#13)
    • Right-click the taskbar, choose Toolbars / New Toolbar
    • In the folder selection dialog, enter the following string and hit OK: %userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
    • Turn off the “lock the taskbar” setting, and right-click on the divider. Make sure that “Show text” and “Show title” are disabled and the view is set to “small icons”.
    • Use the dividers to rearrange the toolbar ordering to choice, and then lock the taskbar again.
    I just love the Quick Launch toolbar since it provides easy access the usual programs and folders I use without much clutter on the taskbar. No Shaking Required In my previous post, I also mentioned that the Aero Shake seemed impractical for non-touch/pen input. I guess Microsoft's answer to that is the shortcut: [Win+Home]. (#3) Hide and Go Peek When on keyboard intensive tasks such as writing and coding, I hate to move my right hand and reach for the mouse. Good thing there's [Win+Space] that reveals the Destkop like Aero Peek (#17), and [Win+1], [Win+2], ...[Win+5] for quick access to the first 5 items on the taskbar (#11), and [Win+T] to shift focus to the taskbar (#21). (Note: [Win+T] works on Vista, too) Still More? These are just my favorite "secrets" from what Tim Sneath posted. I can't help but wonder what Microsoft is intentionally hiding from us, especialy after reading this from the Windows 7 Beta 1 review on TechRadar UK:
    The beta is feature complete; although there are "a couple of things that we're holding back", according to general manager Mike Ybarra. ... "all of the code is in the build, just the discoverability is not." ...
    Very Interesting...
    • Tweet
  • « Previous 1 2 3 4 5 6 7 8 Next »
  • About

    26-year old Filipino game developer and gamer who loves food, especially cookies. Mmmm, Cookies!

    28432 Views
  • Archive

    • 2012 (3)
      • May (3)
    • 2011 (1)
      • May (1)
    • 2010 (1)
      • September (1)
    • 2009 (8)
      • July (1)
      • May (1)
      • April (2)
      • January (4)
    • 2008 (17)
      • December (1)
      • November (3)
      • September (3)
      • July (6)
      • June (1)
      • April (1)
      • January (2)
    • 2007 (24)
      • November (2)
      • October (2)
      • September (3)
      • August (4)
      • July (6)
      • June (2)
      • May (2)
      • March (2)
      • February (1)
    • 2006 (10)
      • November (3)
      • March (1)
      • February (2)
      • January (4)
    • 2005 (5)
      • December (1)
      • November (2)
      • March (1)
      • January (1)
    • 2004 (3)
      • November (2)
      • October (1)

    Get Updates

    Subscribe via RSS
    Twitter
  • Other blogs

    • Photography
    • Singularity
    • Hungry
    • Tumblog

    maloki.net

    • Home
    • Projects
    • Contact