I'm a Programming Teacher. I've played games my whole life. I like supporting games that are multiplattform. I'm trying to become a Indie Game Developer. I love the old SNES RPG's and pixel art so my game is going to be a Secret of Mana 2 like game :)

RSS My Blogs  (0 - 10 of 17)


Khazrak Blog

I've had a hard time think about how the game actually will function (not programming wise).
Use Hitpoints or more like Super Smash Brothers?

I'm not sure which function to implement next.
I started on a abstract way to do button combinations.
That lead me to Annotations in Java.

I could have solved my code by doing lots of if's, but I feelt that there has to be a better way.
So by making a Enum with all the actions buttons can do, a Interface with @ and then connecting the @Interface to the methods of my InputHandler I could invoke (by Java Reflection) the methods by the Enum.

So if I send the Enum Button.SHOOT to the test-method it runs the method in the InputHandler that has that Enum Value in its Annotation and by that can check if the button is pressed.

So I can check if buttons are pressed by checking the Enum's with the test-method, instead of coding every possible combination.

Happy to learn something new! But I haven't mastered it...

Super Refactoring

Khazrak Blog

I have spent some time to learn the box2d wrapper from libgdx.
I made a simple abstract class that I used for every object in the game.

But I realised that the creation-code was a bloat once-run code.

And luckly I remembered my scarse Design Pattern training and figured to make a Factory for the creation process.

Not only did I remove a lot of code that was in the way in the Player class, the code was reused much more efficient in the creation process :)

And thank Linus Torvalds for Git!

To try to refactor the code without knowing a easy way to restore it would be terrifying!

Know it was 3 clicks away.

But now it works, 2 players, simple attack and a simple projectile.

I also solved some rendering bloat.

I just hope that it won't lag when i start to do more.

I've also started to use Idea IntelliJ.
Coming from Eclipse and Netbeans, it's just a really powerful IDE for Java.
It analyzes my code-style and gives superb code completion.
Git integration ofcourse.

I'm also using gradle as a build tool now, perfect for building the project on new computers :D

Code away!


Khazrak Blog

Some people have told me that you should first make some small games before you make a big one.
The game I want to make is big, lots of content and mechanics. And the progress have been slow but it has been progressing.
But I started working on a smaller game to gain some experience and have som fun.

The new game I'm trying to make is a Super Smash Brothers inspired game for PC.

For this I use Libgdx with Box2d. So the physics will be soo much better then if I would have done it myself.

For those who doesn't know. Physics in programming usually is a position that a sprite will be rendered to, and moving it (more like teleporting) so many times per second that the player doesn't notice the teleporting effect. So if the player falls to fast you could fall through a small plattform (teleportation effect again).

Box2d uses continues physics, which means that it test all the way from A to B, not just B.

The problem is that you put bodies in a simulated world with realistic forces, So if your going the easy route 1 pixel = 1 meter (metric system). But that leads to limitations in the forces.

So what you have to do is have a small simulated world and then scale everything up.
And I have succeded in that :D

So I now have a player (A box with a picture), a ground and a plattform. And the gravity and friction works great!

So the next step is to make a idle enemy that the player can punch to simulate how a punch force will work.

Code ahoy!

Back again

Khazrak Blog

Back again after the summer.

So I didn't really like the structure of the code so I rewrote most of the code, taking the good code and restrucutring code that had weird dependencies.

I've also started using squares instead of animation. This just because of my crappy animation skills.
Squares won't hinder me from doing most of the game mechanics.

I've looked more and more for alternatives to Java, like C++.
But I like the OOP-concepts of the langueage, and for somebody coming from Java and looking at C++...
C++ is horrible when it comes to Abstract OOP. So for now I'm sticking with Java.

So todo right now is to make Stats/properties and basic Enemy-class (More decisions then code).

For those who doesn't know, when you reach a level of programming, it's more about finding structure concepts that works easy for you then the pure "how do I do it". "How do I do it good" is a better question.

Keep on coding!


Khazrak Blog

I've updated the StageEvent to work with the current "requirements".
But for every new situation, there's a risk of need to change more of the none-stageEvent code.
Because of this it's easier to change right now instead of later. Later risk breaking the working code.

So now I need to make as many use-cases as possible, try to predict as many situations as possible.

This could be frustrating, to try to think what every store event would need to be able to do.

But hey, practice makes perfect

StageEvents update

Khazrak Blog

After som refactoring (gotta love refactoring as a programmer) I have working StageEvents.

The Game can now enter combat, after defeating the enemies a StageEvent is activated and a Dialog shows. Depending on the choice in the Dialog you get a new Enemy.

This is the basis for the whole game, still I need to try to make the characters move during a StageEvent.

Code on!

DIalogs and StageEvents

Khazrak Blog

I've completed the code for a basic dialog with a choice embedded.
I've also done some code about the StageEvent. It isn't done enough to test.
The problem is that I may need to refactor the structure of the gameloop. Right now the two main parts of the logic-loop is either free-moving or in the main menu.
The gameloop controls if the stages are paused or not. But I may need to change it so the stages can pause them selfs if a StageEvent happens.

So a sum of what the game can do right now:

  • Move with Keyboard or Xbox360-controller
  • Attack with a 2 hit combo.
  • Kill an enemy, and get experience and level up
  • Move about in the map
  • Go to the menu
  • Show dialogs.
  • Soundeffects

What is in working right now:

  • StageEvent, events of story, everything from dialogs to scenes

What is planed not far from now:

  • Stat-based combat
  • Combat update (needs more things! like combos, special moves etc)
  • Enemy attacks
  • Enemy-flock AI (Enemies working togheter)

Also needs work:

  • Lots of animation
  • Music (have none)

I have a very few people to brainstorm ideas with. I need to make the combat as fun and challange-rewarding as possible.

Technical I could release a small pre-alpha test build just for people to test.
But I have borrowed graphics from Snes-games to test the game.

What I need to animate to exchange to my own graphics is:

  • Idle: left,right,up,down
  • walk: left,right,up,down
  • Combat-waking: left,right,up,down
  • combat-idle: left,right,up,down
  • Punch: left, right,up,down
  • Combo1: left,right,up,down

So I have stuff to do :)

But when all the basics is done and a TestStage with StageEvents, music, enemies, boss-battle, inventory system is complete, I will definitely release a build.

Then the real job of good graphics, story writing and improving the code :) Lucky its fun!

So I've spent alot of time trying to animate the real character and not borrow graphics from older games (just for testing).
I'm really proud of the result of the punch-left-animation. But I'm having problems with animating the down-direction and up-direction, left and right is easier.

I've started working on abstract stage events. I'll see how i can make it good for every stage.
And it lead me to making dialogs. So now I'm working on that.
The graphics for dialogs is easy but pausing everything else is harder. All this leads to some refactoring. Thats good, because its easier to refractor everything early. I won't start to make the real stages and events before I'm satisfied with the basic stuff, especially the combat, which will be the main thing about the game.

My problem is I'm not fully sure of how I want the combat to be...
I can code it if I knew how I would want it...
Some blend of Secret of Mana 2, devil may cry, etc...I think. Skills and stats should be important in combat.
This is a game for gamers, It should be fun.

I have delved more into my code, and it's still some way to go, but you learn more and more as you go.

My Player class is soon just a mediator and getter/setter holder.

A added the feature of GameObjects is solid objects so you can't walk through them, but I've only tested it on enemies. I might want to change it so I can move enemies by pushing, but it will be a pain though some enemies should not be moveable like a giant dragon...

I refactored the Xbox360 Controller, I was able to get the start-button and back-button to work.
I submitted a Issue with the framework because the start-button (and back-button) wasn't working in pull-based code, only in event-based. So a little workaround made it work.

I've getting better at my pixelart of grass. I figured I would start there and work my way up to the character.
I'm actually using a Bamboo Pen. Some ask me way I would need it for pixelart, but to make that curve line that a pen makes so easy takes me soo much time without it, it's worth 60 bucks (58 euro/499 SEK).
It also makes me feel like a designer (I truly am a coder).

And last but not least I added soundeffects! Which literaly took 6 lines of code, thank you LibGdx.
And the sound ment more licenses to review! yay....

Refactoring Time!

Khazrak Blog

After some time some classes get bloated with code.

My Player-class is a good example.
It handles most of the combat (combat movement, attack-logic, attack-hittest) the movement, the animation of the character, the logic of the character.
Frankly, it gets messy.

So I started to refracture it. It's always good to refactor after some time to see if you can solve it better with less code. Many may argue that it takes time, time that they may not have.
But I see it as I have time, and it will save me time in the future if everything is at good place.

Why not make it good from the start? Because I don't know how it will work before I've done the whole thing.

So I dished out the combat-logic to a seperate class and tried to have the Java-cross-reference problem to a minimum. If you don't know what that is:
It's when a class that is an object inside another object needs to change or reach its "parent" (the object that the new object resides in). Kind of like the chicken or the egg....but not really...
C# doesnt even let you do it.

A also made a class for the dash-movement, I'll try to make the regular movement to a class to.
Then every class will have a specific goal, and the Player-class will be the mediator for it :)

Refactoring continues...

Last Online
Sweden Sweden
Become friends
Member watch
Blog Statistics
Views Today
Popular Blogs