Ben James :: adventures in gaming

100101.org

27
Jan

Revenge of the Big Brown Box

My video, Revenge of the Big Brown Box, has been selected as a finalist in the Big Brown Box video contest.

The winners will be announced on Feb 17, so until then I am hoping to get as many hits to the video as possible, to maximise my chances!

Please click the video below and, if you like it, send it to as many as your friends and family as you can.


24
Oct

Magento API Calls - Filter Parameters

One of the tasks ReadyToShip regularly needs to do is pull down all the orders from Magento that have been modified since the last time we got them. You would think this would be easy enough to do, since the sales_order.list API call provides a 'filter' parameter, used like so (this is perl but you should be able to easily figure it out for your own language):

my $server = Frontier::Client->new( url => "http://magentourl/api/xmlrpc/", debug => 1 );
 
my $sessionID = $server->call("login", ("username", "apikey"));
 
my $result = $server->call("call", ($sessionID, "sales_order.list", [
    {
        updated_at => {
            from => "2008-10-05 12:49:51"
        }
    }
]));

Unfortunately, the terms you can use are not very well documented. The wiki page gives an example of a 'like' match, but what else can we do with this filter parameter?

Well, I needed to find out so I started digging into the code and I found my way to the Varien_DB library where the SQL was constructed for these filters. And thus, I can deliver to you the following:

Parameters you can pass to a Magento API filter
from returns rows that are after this value (datetime only)
to returns rows that are before this value (datetime only)
eq returns rows equal to this value
neq returns rows not equal to this value
like returns rows that match this value (with % as a wildcard)
nlike returns rows that do not match this value (with % as a wildcard)
in returns rows where the value is in this array (pass an array in)
nin returns rows where the value is not in this array (pass an array in)
is unsure
null returns rows that are null
notnull returns rows that are not null
moreq unsure
gt returns rows greater than this value
lt returns rows less than this value
gteq returns rows greater than or equal to this value
lteq returns rows less than or equal to this value
finset unsure

I hope you find it useful!


22
Oct

Writing a Magento Custom API call

I've been doing some work with the open source Magento web store software, mostly to do with their XMLRPC API for our ReadyToShip software. Inevitably, the requirement arised that couldn't be solved by the existing Magento API calls, so it was time to take a look at writing some code and building my own custom api call (as suggested by the Magento documentation).

Unfortunately, the documentation on doing so is kind of sketchy, so it was a slightly frustrating experience, not least because of the complexity of Magento's data structures. I've got a 'Hello World' API call working now though, and this post will have a dual purpose: to help others who have been wrestling with the same problem, and to actually get it straight what I did to get it working!

Before I start, can I just say that Mage::Log is your friend! I figured out a lot of what is going on here by throwing Mage::Log("Bla bla") throughout the existing Magento code.

OK, first steps, here is the directory structure of my custom files:

magento/
  |-- app/
      |-- code/
      |   |-- local/
      |       |-- CompanyName/
      |           |-- ModuleName/
      |               |-- etc/
      |               |    |-- api.xml
      |               |    |-- config.xml
      |               |-- Model/
      |                    |-- ObjectModel/
      |                         |-- Api.php
      |-- modules/
           |-- etc/
                |-- CompanyName_ModuleName.xml

A lot of directories for only 4 new files! But the directory structure is important, as Magento makes use of strict naming conventions to find where it's class and config files are.

OK, let's tell Magento that we're writing a new module, and in doing so, where to find it. Here are the contents of magento/app/etc/modules/CompanyName_ModuleName.xml :

<?xml version="1.0"?>
<config>
    <modules>
        <CompanyName_ModuleName>
            <active>true</active>
            <codePool>local</codePool>
        </CompanyName_ModuleName>
    </modules>
</config>

Pretty simple, huh? From this piece of XML, Magento knows to look in the magento/app/code/local/CompanyName/ModuleName directory for your module.

Next, let's take a look at the config file for our module. Here are the contents of magento/app/code/local/CompanyName/ModuleName/etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <CompanyName_ModuleName>
            <version>0.1.0</version>
        </CompanyName_ModuleName>
    </modules>
        <global>
                <models>
                        <test>
                                <class>CompanyName_ModuleName_Model</class>
                        </test>
                </models>
        </global>
</config>

In this file we're defining an extra variable for our module (I suspect the <modules> section could go in the CompanyName_ModuleName.xml file, actually, as all the XML config is merged together), as well as telling Magento the base class name for the module (this is important to those constantly having Magento look under the Mage/ directory for your class files instead of your company name, a problem I struggled with for quite a while).

Next is the definition of our API call, here are the contents of magento/app/code/local/CompanyName/ModuleName/etc/api.xml:

<?xml version="1.0"?>
<config>
        <api>
                <resources>
                        <resource_name translate="title" module="companyname_modulename">
                        <title>Title Of My Resource</title>
                        <model>modulename/objectmodel_api</model>
                                <methods>
                                        <methodName translate="title" module="companyname_modulename">
                                                <title>Title Of My Method</title>
                                        </methodName>
                                </methods>
                        </resource_name>
                </resources>
        </api>
</config>

I'm still a bit fuzzy on exactly how this section works, but what I do know is that the <model> variable is what tells Magento where your class is. I think the resource name can be whatever you like, and I'm not sure where the module attribute is used as I seem to be able to set it to anything I like and it still works.

Finally, let's look at the API method itself, here are the contents of magento/app/code/local/CompanyName/ModuleName/Model/ObjectModel/Api.php:

<?php
class CompanyName_ModuleName_Model_ObjectModel_Api extends Mage_Api_Model_Resource_Abstract
{
        public function methodName($arg)
        {
                return "Hello World, here is my argument: " . $arg;
        }
}
?>

And there you have it! You can call your method using resource_name.methodName like you would any other API call.

Note: if you have Magento caching turned on, you will need to refresh the cache under System -> Cache Management before the changes to your model will take effect. This caught me out a few times as changes I'd made were not being reflected in the debug output, very frustrating! For debugging purposes I would suggest turning the caching off temporarily.


03
Sep

…hopefully you’ll be seeing more from me on this site in the coming year

Oh man, nine months since my last post, that is incredible. Not sure why I keep this thing up here.

What have I been up to? I said in my last post that I was hoping to get back into XNA, I fiddled with it for a while and wrote a prototype game that used the Guitar Hero controller; it was a hybrid sh'mup slash rhythm game, but I couldn't quite get it to be fun.

I've been working hard on Ready To Ship, the new application I've been developing at work, and that's kind of kept me from wanting to do anymore coding at home. I did have an idea for a collaborative web game thing, kind of inspired by Real Lives and Kudos, but with user created events and a paper doll avatar system. I still hope to get it going at some point because I think there's potential there for a lot of funny stuff.

Kurodust is gearing up to record and release their second album, so that's been my main creative outlet for the past 6 months or so. We're working on finding an artist to do some cheap work for us so we can redesign the website and figure out the album art. If we can't find anybody I guess I'll just pass myself of as an artist again and come up with something.

Things I was hoping to do but haven't got around to: redesigning this blog, taking piano lessons, actually finishing another game. I guess that's a short list, so that's not too bad.

Until June!


01
Jan

Two Thousand And Eight

Where's my jetpack already?

4 months since my last post, that's just inexcusable. I suppose I haven't been focusing much on my game development after the WiggiWorld contest, though I got 75% of the way through a contest for the JayIsGames contest and then couldn't make the final stretch. It's a shame, because I think the game had some potential; perhaps I'll finish it one day.

Sometime early this year I want to redesign this site and get back into game development, I'm thinking about going back and working in XNA again though, now that the new version is out. Man, I'm so finicky, I can't stay put. Anyway, I want to go back to my AI experiments; I was thinking of doing a side scrolling dungeon game that played itself (partially based on some of Squidi's ideas), but the more I thought about it the more ambitious that sounded, too ambitious for an early experiment. So I think I'll try to create my sheep/wolf/shepherd ecosystem experiment again.

I don't think I've talked about it here before, but it's pretty much just a simulation of sheep (flock together, find and eat grass), wolves (chase and eat sheep), and the shepherd (protect sheep from wolves). I started it a while ago in XNA and hit problems with the sprite architecture, but I might give it another go. I still haven't actually decided whether I want to do this in Flash or XNA.

Anyway, happy new year everybody, and hopefully you'll be seeing more from me on this site in the coming year.


15
Aug

Wiggi World Winners Announced

I didn't make the cut :( I did get an honourable mention though, which places me in the top 15 out of over 50 entries, so I guess that's still pretty good for my first flash game.

There were a bunch of good entries that got submitted in the last week or so, some of which took the prime places in the final standings. I'm a bit disappointed in some of the results, but I can see that my game had a few problems that probably cost it a place.

I agree with most of the decisions made by the judges, though I didn't really think Wiggi Fire Mission deserved sixth place, definitely not above Galactic Mediator which took seventh. I also thought Wiggi Walk was a bit too simple to be so high in the standings, but it was well made and showed the values they were looking for, though I still think most of the entries were a bit heavy handed in that area.

Oh well, onward and upward! I am waiting to find out whether blogging the progress of my game is legal in the JayIsGames contest, if so I'll have the prototype of my first entry done in the next few days. I'm making sure not too aim too high when it comes to the graphics this time, and the hard bits for the physics are already worked out so I'm feeling quite confident.

I've started adding a few blogs by Flash developers who are doing some interesting things: fellow Melbournian Michael Battle seems to share my fascination with automated agents and emergent gameplay, and Martin at Grapefrukt.com who is also big on prototyping gameplay elements. Hey guys!


14
Aug

Flash Contests

The WiggiWorld (whoops, apparently it's WoogiWorld now) contest is over, and the winners should be announced in the next couple of days. I think I'm still in with a chance to be in the top 7 and therefore winning $500, but there were a few good entries submitted in the last week which will drop me down a few places, I'm sure.

In retrospect I should have pushed the values they wanted a bit more; at the very least I should have put some 'Did you know...' type things between the levels to provide a bit more education. To tell the truth, I find that most of the entries are shoving the values down the kid's throats, but I don't know if my entry being more subtle will gain me any points.

I also think I should have gone with something more simple, especially as this was my first flash game; it seems that the games that are simpler and more polished are leading the way, such as Veggie-Matic and Wiggi Dance Academy.

The JayIsGames 4th Casual Game contest has started now as well, the theme is Ball Physics; I've had a couple of ideas, but haven't really got started on prototyping anything yet. I'm hoping to do so tonight. Unfortunately the rules of the contest specify that the game can't have been published anywhere else on the web, so I won't be able to document the process very thoroughly, though perhaps I'll do so anyway and just publish it after the contest is complete.


04
Aug

Gameplay Prototype : Consume

This is an idea I had a few weeks ago, mostly inspired by the wonderful game Katamari Damacy. I thought it could be a good idea to simplify the base concept into a simple 2D game.

I started with the basic idea that you can consume circles which are larger than you, and are damaged by those larger than you. Here's my first draft, use the arrow keys to move.

You need Flash Player to view this content.

You probably noticed that this by itself is not particularly fun; you quickly become either quite large or quite small, and that's pretty much the end of the game. (I didn't bother putting in win/lose conditions for the prototype, but you can imagine what they would be)

So, what's the next step? Well, let's test out my list of ingredients. We've obviously hit the first mark: the game is quite simple. Too simple at the moment. Let's take it a bit further then, and add a sense of progression (and competition, since we'll have a measurement now to compare against our friends).

You need Flash Player to view this content.

The simple addition of a size value gives this game some more meaning, and a reason for playing. I took a note from Katamari's book and did a quick and nasty pull back in scale when you get to a certain size; this doesn't work especially well when you have no real life objects to scale it against, but it means that the score could go up indefinitely if you played well enough. I could probably clean this game up in it's current state and release it as a nice little diversionary game. (Needs better physics, better zoom effect, maybe some effects when the balls hit each other)

What would push this game (I think) from a nice diversion to something more popular? Another ingredient, style. Katamari has style, if you were just a ball rolling around picking up random shapes (like in the tutorial) you would get bored very quickly, but given the quirky style, different environments and fantastic music, the game becomes a hit. (And hey, they're about to release the 4th installment and are barely changing the gameplay, so that shows you how far style can go)

I'm not going to continue to develop this game, because it's actually been done before. Check out Cosmic Crush. (I'd forgotten about this game when I came up with the idea originally) If I was going to continue though, I'd need to think of something unique, it would need to suit the setting, and (for me) it would need to be easy to draw. So...

You need Flash Player to view this content.

That'll do. Maybe a little too much like Spore to be completely unique, but oh well. (This is a very quick and rough example, but it already gives you a better sense of scale changing and makes it more interesting to play)

Stay tuned for my next gameplay idea, which I'm hoping will turn out a bit more fun!


02
Aug

Gameplay Prototyping

I've been thinking hard about gameplay and the importance it plays in games, especially in casual games, and I realised that if I'm going to create something popular and fun then I'm going to need to make sure my ideas are feasible before I put too much time and effort into them.

This is where prototyping is going to come in useful. I've decided that for any gameplay ideas I have, I'm going to whip up something quickly that gives me a chance to see how it will play before I start creating graphics, menus, etc., which will save me a large amount of time if it turns out that, no, that idea actually sucks.

This isn't always a useful step, of course; if the main draw of your game is the style in which you're doing it, then stock standard gameplay may do the trick, in which case you pretty much know that it's fun already. If you're bringing something new into the gameplay in any way, however, prototyping the base gameplay before getting into the more time consuming stages of development is definitely wise.

I'm going to be putting together some prototypes for some simple game ideas over the next couple of days, and I think it'll be interesting to see whether they turn out to be fun, tedious or in between.


01
Aug

5 Ingredients For Making A Popular Flash Game

I've noticed somewhat of a trend when it comes to those casual games (usually Flash, but not always) that get the most popularity and acclaim, and are the most addictive and fun (the latter leading to the former, generally). I hope to use these concepts in my next game, but perhaps they will be useful to others looking for ideas as well.

So here we go.

Simplicity

I think this has to be number one; the simplest concepts are the easiest for players to grasp, and are often the most addictive as there are no complex rules to learn or stories to follow. It's obvious what you have to do and it's just a matter of doing it well enough or for long enough to accomplish your goal.

This is not a hard and fast rule, of course, but there should still always be a clear goal and a clear method of achieving it; if the player is confused about what to do they're just going to stop playing.

Examples: Red, Double Jeu

Continue Reading »

Powered by Wordpress 2YI.NET Web Directory