Saturday, May 8, 2010

Retrieving player's ranking in MySQL

Here's a neat little trick I figured out for myself when I was coding in MySQL. How to retrieve a player's current rank in a Leaderboards sort-of table.

-- this will calculate our current rank
SELECT count(DISTINCT exp) AS rank FROM player WHERE (exp > $exp);

-- this will retrieve 3 players that are of greater rank than us
SELECT * FROM player WHERE (exp > $exp) ORDER BY exp, username ASC LIMIT 3

-- this will retrieve 3 players that are of lower rank than us (or equal rank)
SELECT * FROM player WHERE (exp <= $exp) && (username != '$username') ORDER BY exp DESC LIMIT 3

-- top ten players
SELECT * FROM player ORDER BY exp DESC LIMIT 10

My example code comes from a PHP environment so $exp is a variable storing the selected player's current experience points, which in this example determines his rank. The greater one's experience points, the greater his rank. $username is a variable storing the selected player's unique username.

Thursday, May 6, 2010

Death Zone Zero: More Concept Art

Here's an update on the Rifleman concept art, together with the female version.

Photobucket

I'm not sure if I made the female version look "post-apocalyptic" enough. Maybe I'll redo it sometime.

Wednesday, May 5, 2010

Death Zone Zero: Update: New Unit "Cannoneer"

New in this update is the Cannoneer, a mobile artillery unit with a devastating, far-reaching attack. The only problem is the projectile takes a long time to get there; when the Cannoneer attacks, his shot only arrives at the target at the next turn, giving enemies a chance to run and take cover from his attack.

Photobucket
http://anomalousunderdog.herobo.com/Unity/DZZPrototype.html

Note that I don't have a 3d model for the Cannoneer yet— heck, I still don't have concept art for him yet, so I'm still using the placeholder 3d model of the Rifleman.

Monday, May 3, 2010

Death Zone Zero: Rifleman Concept Art

So I decided to take a break from programming and do some concept art.

The Rifleman 3d model I'm using right now is in fact just placeholder art. Its not the real Rifleman that I'll be using in the final version of the game. So me and my buddies made some concept art for the new Rifleman.

Photobucket
This one is made by Ryan Sumo. Here's his blog and portfolio.



Photobucket
This one I made myself. I'm heavily influenced by art from STALKER.

Friday, April 30, 2010

Death Zone Zero: Update: Preliminary AI now working

The enemies will now retreat when their HP becomes 50% or lower. That's about it.

Photobucket
http://anomalousunderdog.herobo.com/Unity/DZZPrototype.html

Language Discrimination

Photobucket

I had a funny thing happen to me just now. I couldn't get any help in Unity's IRC chat channel because I use Unityscript, Unity's version of Javascript, instead of the more sophisticated C# language.
[11:41] <_underdog> hi all
[11:41] <_underdog> I got a question
[11:42] <_underdog> when I put a yield WaitForSeconds in my function, Unity gives me the error "The return type of a generator must be either 'System.Collections.IEnumerable' or 'object'."
[11:42] <_underdog> any idea why?
[11:43] <blitzwing> language?
[11:43] <tigeba> http://unity3d.com/support/documentation/ScriptReference/index.Writing_Scripts_in_Csharp.html
[11:43] <_underdog> unityscript
[11:43] <blitzwing> learn C#.
[11:43] <_underdog> why whats wrong?
[11:44] <blitzwing> its js... you're stunting you're abilities
[11:44] <_underdog> what's wrong with js?
[11:44] <_underdog> what does it have to do with the problem at hand?
[11:45] <blitzwing> the only people answering you are C# coders :)
[11:45] <_underdog> discrimination :(
[11:45] <dr_link> Shame how C# is Microsoft made. :(
[11:45] <blitzwing> not really
[11:45] <_underdog> yes it is
[11:45] <blitzwing> MS put a lot of time into it
[11:45] <dr_link> Not necessarily this version of C#
[11:46] <blitzwing> Anders Hilgberg was Mr Delphi.
[11:46] <dr_link> lol @ his name
[11:46] <dr_link> anyway
[11:46] <_underdog> I hate Microsoft btw
[11:47] <blitzwing> good for you.
I was given some help later on.
[11:49] <tigeba> _underdog: FWIW when people ask about that error its usually because they are using C# but trying to use the unityscript syntax
[11:50] <tigeba> for the coroutine
[11:50] <_underdog> hmmm I see, its weird tho, I'm using unityscript all the way
[11:51] <tigeba> try the coroutine example
[11:51] <blitzwing> well its not wierd, thats just a common mistake people new to C# make
[11:51] <tigeba> in the docs, it should work
[11:51] <blitzwing> seeing you're not using C#, it doesn't appy to you