Tag Archives: custom game

Back, and with hitboxes!

Hello there! After a short break, I’m finally getting back on track! This last month has been quite a ride, so many new experiences and, while not busy busy busy, been lazy lazy lazy. 🙂 Truth is, I’ve been resting or running errands when not working, and the little time I had at home I used to relax and rest a bit.

Can’t say it didn’t work out, after all, here I am once again! 😀

I took some time to also beat some S3&K with Super Tails (on the cellphone, touchscreen gaming is hard!) and Warcraft 2 (only did it before on the PlayStation, the PC version seems to be much nicer, although more rough), things I’ve wanted to do for quite a while!

While we’re at it, another game-related thing is my new commit on the MM3 repository! I’ve finally been able to test hitboxes (even the “debug” mode works now!) and it works great! It’s not a JAWS feature, but my implementation will do. I still need to adjust its size for the current animation (different shapes, different boxes), but that’s work for another commit.

Beside everything, now that I’m a full time Java developer, I’m learning more and more about its design patterns and how things go together on large systems. It’s been a wild ride, but I’m quickly getting used to. 🙂 Gives me the creeps to look at some of my old implementations, they desperately need refactoring! 😀

See ya!

New project at work = more free time = more hobby development

So, at last, I’ve joined the new project team, reading documentation and “first steps” to develop the new application. They seemed pretty organized so far, and I was able to solve all the hickups I’ve had when starting to install the development environment. Since I started by the end of tthe day, I didn’t have much time to do it and might finish tomorrow.

Since forever, my HabitRPG (they started running ads now?) is telling me that I must do four tasks (and I plan to kill them tomorrow):
– Put Carlin’s Explosion on GitHub;
– Establish a JenPop goal;
– Commit new code into it;
– Put Clonix (my attempt at a 2d physics game engine) on GitHub.

I’ll try to create some new tasks (and honor them, FFS) to better document and maintain those projects. But let’s see how things go. Anyway, tomorrow’s a big day so, see you then!

Some cleanup

Hey there, it’s hard to find time with Dexter and Breaking bad finales approaching! But they’ve already been dealt with for this week, so, more free time! 😀 Getting more tasks done, and not missing midnight, is quite an achievement for me.

Also, made a new commit from some of today and yesterday’s code on the new game, implemented a rough hitbox scheme, and still trying to debug it, works ok on bullets but not on enemies… perhaps it’s not a good approach to override a sprite’s rect() and I should implement my own collision functions, that look for hitboxes instead of them. Still, I can finally hit monsters and kill them (after the brief immunity period)!

I’m thinking about doing some cleanup tomorrow, on older posts, saw some code out of code tags, gonna check it out. I miss the CodeJam times, gotta do some more of those problems. Quite some work ahead!

 

Whoa… and we’re back!

Bah, the last couple of days almost made me die at HabitRPG, mostly because I must complete tasks before midnight (!) and I’ve got used to updating before going to sleep… and that was already late. I had something like 5HP left to avoid losing my beloved belongings, but tonight I made up and the experience gave me a new level (which restores all health), so I’m saved! 🙂 In a boring note, I could still have bought and used a potion, had the money to.

Been quite entertained with the new project, now I’m getting along with method encapsulation and developing resources as I need to. JAWS is awesome, but it lacks some features, such as hitboxes, and correctly being able to tell if a given element is partially inside the viewport … but I’m already implementing them, or didn’t look further into its code (the documentation is not as helpful as I need). JavaScript, in all its freedom, is a nice language but can be a pain sometimes too. Kudos to the guys that develop such great VMs to run all sorts of things, that must indeed be quite a challenge!

That’s it for today, just wanted to put some things out. Still gotta check Evernote everyday to get new blog subjects. I have so much to write about, but the lack of posts exists because I sometimes lack motivation to start the post… once I start writing, words flow nicely. 🙂

More on JavaScript classes, function warzone

Just like Python, JavaScript tends to create things once you mention them and they don’t yet exist. In my opinion, that’s a bit more harmful than useful, because there’s danger in accidentally creating new variables and values when you assumed it would be already holding a known value. Coming from a C/C++/Java background, I would expect some kind of error for the operation:

<html>
<body onload="testFunction()">
<div id="content"></div>

<script>
function testFunction() {
    function Test() {
        var somevar=1;
    };

    var test = new Test();
    test.somevar += 10;

    document.getElementById("content").innerHTML = ""+test.somevar;
}
</script>
</body>
</html>

In this context, somevar might not exist yet, and still, you’re adding 10 to its value! By printing it is possible to check that this var is a NaN, and no errors are issued. To properly (as I eventually found out by trying) get and set its value, one must create getter and setter functions, to “publicly interface” in other contexts:

<html>
<body onload="testFunction()">
<div id="content"></div>

<script>
function testFunction() {
    function Test() {
        var somevar=1;

        this.getSomevar = function() {
            return somevar;
        };

        this.setSomevar = function(value) {
            somevar = value;
        };
    };

    var test = new Test();
    test.setSomevar(test.getSomevar() + 10);

    document.getElementById("content").innerHTML = ""+test.getSomevar();
}
</script>
</body>
</html>

But hey, be careful when using “this”, its context is related to the current function, not the “class”, as one would think coming from a Java mindset. Using “this” inside class functions can cause undesired effects, such as defining new variables inside the “method” context and again we’ll run into the NaN problem:

<html>
<body onload="testFunction()">
<div id="content"></div>

<script>
function testFunction() {
    function Test() {
        var somevar=1;

        this.getSomevar = function() {
            return this.somevar;
        };

        this.setSomevar = function(value) {
            this.somevar = value;
        };
    };

    var test = new Test();
    test.setSomevar(test.getSomevar() + 10);

    document.getElementById("content").innerHTML = ""+test.getSomevar();
}
</script>
</body>
</html>

Pushed some updates to the game on github. 🙂

JenPop: genetic populations in your hands

I’ve started developing a new hobby project (yeah, why not finish the other projects first?), that can create entire generations of nodes based on a single parent, according to the rules and score methods you provide! It’s JenPop (if you didn’t guess, J is for Java :D, Gen is for genetic, Pop is for population) and I already have code to throw at you!

At the moment, only 2 features are available:

  • Create generations and children (of any object) based on the rules you provide, from a parent class extending GeneticNode;
  • Get node scores and best nodes based on the rules you provide;

And as a bonus, a sample of Tic Tac Toe implementing the above features, that will never lose. Can’t lose even when playing against itself! 😀 For the moment, the only way you can download and use it is by downloading the tarball from my Google Drive, but I’ll host the project online as soon as I decide where to.

As the next step, I’m aiming into being able to process the best “path” to use after calculating nodes from many generations, looking at the possibilities from the current state. After that, I think I’ll implement some cross-over methods, so that you can “diverse” your population, it’s useful for some problems.

Needless to say, I’m quite happy with the results at this moment.

See ya!

Tibia time: Carlin’s Explosion

Well, I’m an old Tibia MMORPG player (Jack Bouer used to be my main character) and even after retiring, I continued to back it’s (at the time vibrant) community for a while, be it by drawing the infamous TibiaNews’ Comic Strips (removed from the original server, re-uploading to my gDrive… soon) and the original TibiaScoop.com (merged with TibiaNews.net, apparently) games that I’ve launched. There was one game that I’d like to start, which was Carlin’s Explosion.

You’re a powerful bloodthirsty player, and clueless newbies are trying to get to the depot at all costs. Magically rewarded with infinite mana points, you decide to stop them by launching waves of the most powerful attack spell (at the time) the Ultimate Explosion! Kill as many newbies as you can before they fill the depot!

It contained an online highscore mechanism (that I can’t host for now, so it is disabled) where site members could compete. 🙂 Beside being based on the original tibia sprites, all artwork was remade by me (CipSoft complained at the time about using the original Tibia artwork on it). So, here it is! The infamous Java-based game, Carlin’s Explosion (hosting is for now a courtesy of Google Drive)! 😀

Java package download (run with hopefully just a double-click, or with a “java -jar CarlinExplosion.jar”).

Since I can’t host the jar with direct access (for an applet version), some screenshots:

Title Screen

Instructions Screen

Gameplay

Game Over Screen

I’ll upload the source code and artwork soon, after some quick review! 😀 Happy gaming!