2014. augusztus 22., péntek

Release of v.0.1.5(in time for LD)

Like I promised, I released this update in this month. A lot of good stuff is in this release as well and I can say that this was the most challenging one. So what's new?

  • The new vector based movement system that I wrote about in the last post. One of my favorite, because I find it so simple and elegant solution for moving sprites.
  • Acceleration added for sprite, which means sprite can speed up and slow down.
  • A new class: Direction, which is full of String constants. You can use it if a method wants a String direction.
  • You can find a Moving System example in the repo, which show how it works.
  • I made a getting started guide in the repo's wiki, which pretty basic.
  • I made a project template for faster start with DartRocket.
  • More event handlers for keyboard: onKeyDown and onKeyUp, which means you can use only the keyboard to handle this events. You don't need to add event listeners for world.
  • CollideWorldBounds mean that the Sprite can't go out of the world bounds if it's true.
  • KillOutOfBounds mean that the Sprite will be killed if it's out of the world's bounds.
  • Fullscreen mode has minScale and maxScale which you can set in the Game's constructor. I added this because scaling the game big time can make the performance worse.
  • Button has isDown handler for touch and for mouse click.
  • I made a small fix about using the world instead of the stage in the library.
  • One of the hardest change is that now the Camera class basic's function works. It was really hard, because "moving"  a camera actually means moving the world. So everything is backwards.
  • We can move the camera with moveDistance method, which uses direction names from the Direction class.
  • Camera has a follow method which will follow a sprite and an unfollow method which will do the opposite.
  • A new example, which show this new methods in practice.
  • Biggest breaking change is the fact that I removed the name parameter from the State's constructor, because I can give the name of the state thru the statemanager. This change will be also feel the same what Phaser use, although you can still give the next state's name to the State's constructor.
  • State no longer extends Stream<String>. I made this change because I wanted to use a private function to start a state instead of the public listener method and because the  State only need the private StreamController to work correctly.
  • This many change also brought to you an updated documentation.
You can find the changelog here.

New Examples
Moving system (code) : You can move with wasd, you can rotate with qe and you can accelerate with jk.
World-Camera (code): You can move the ship with wasd, you can unfollow the ship with space and you can move the camera with cursors.

Ludum Dare 30
Another big event for the week is Ludum Dare 30. I will participate in it and I hope I will get a better score this time. Naturally i will use DartRocket for this competition.

Ultimate Music of the week :D

2014. augusztus 11., hétfő

Some news

I have some brief news for the week.

DartRocket now has an official forum.
I chosed Ost.io to host the forum, because you can use it with a Github account.  I made the forum, so i can give support or talk about the development of DartRocket.

I started doing the wiki and I plan to make it a in-depth introduction of DartRocket.
I want to show with this wiki how the game engine is built up and how it should be used.
If the wiki is completed then I plan to publish a gitbook, which will give an a better reading experience than the wiki.

2014. augusztus 4., hétfő

Release of v.0.1.4

At last I released this update. One month of work went into this, because I wasn't ready to publish this update in July. This release has a ton of breaking change and a ton of new stuff. Just look at the changelog.

Whats new?
  • One of the biggest breaking change is: State us the Phaser like load, create and update methods. So you will have to use it instead of load, create.
  • Physics class with only one method(collision), which can detect collision between Sprite vs Sprite, Group vs Sprite, Sprite vs Group and Group vs Group. It's a cool method because i used Dart's optional typed system to make it work.
  • GameObjectFactory can make almost anything , but Background.color object.
  • Got some getters from StageXL: autoHiDpi, isMobile and devicePixelRatio.
  • I started trying out doing unit test, although i still have a long way to go.
  • World-Camera system, which is not fully functional because the Camera class needs work and an example how to use it.
  • Using World instead of Stage, because it's better to use store gameobject in some other container.
  • You can use Tween class if you want , because i exported from StageXL. Although you can make tweens through the GameObjectFactory.
  • New classes Keyboard and Touch, which only have some event handlers.
  • Button has and isDownByTouch method, which can the if the button is held down by touch.
  • The most awesome change is the new movement system for the Sprite class.

The movement system
This is the main reason, because I couldn't make the release in july . This was one of the hardest change to make, because I wanted to make something really easy to use. 

So i tried out two option:
  1. Using the onKeyDown and onKeyUp listener to make the sprite move. Thats why the Keyboard class have that function that handles both of them. This worked and made the code more readable, because i made it base on 4 different direction(up, down, left, right). The biggest fault of the system is that the sprite had to be stopped direction wise for every keyUp event.
  2. Using a Phaser like movement system, where you can control the sprite with changing it's speed value in the update loop. The only problem I had with this that you had to change the speed value to change direction and it looked ugly and didn't really made the code more readable.

My solution is based on 4 main different direction(up,down,left,right) and using these directions you can move around the Sprite. Direction is actually a vector(StageXL.Vector object), which means it's super easy to work with and made it possible to rotate directions and the sprite with ease. 
You can do any kind of top-down game with it.
Instead of using event listeners for keys in the create method, we must use the update loop to change the direction of the sprite, which actually made the code more readable.

tl;dr: I unified the two option that I mentioned before and made a really cool system.

You don't believe me?
Look at this example code and you can try it out live here.
You can move with WASD and you can turn with QE.

Future plans
I don't plan to wait for another month for a new release, so you can expect a new release in this month. :D

What will I work on?
  • Add some more feature to the movement system: acceleration and easier rotating
  • Making a universal isDown method for Button
  • Start working on the World-Camera system

Physics Engine
DartRocket's development is going great and soon i have to think about using or making a Physics Engine.
  • Using dart-box2d, which is not an option for me, because i want to use some really simple physics engine first and box2d is not the easiest thing out there.
  • Using Javascript physics engine is not an option, because i want a Dart only solution.
  • Make my own physics engine, which can do some really basic stuff. My only problem with this is the fact that I never liked physics in general, although in this case the physics engine has to deal with some vectors and I already use vectors to move some stuff, so it should be an easy task(or not).
I think after the next release I start working on the physics engine at last. 
Let me know if you have any feature request or new idea about how the physics engine should work. 

I'm thinking about starting a forum for the project, so I can give some support for the brave souls, who try to use or thinking about using DartRocket.

My favourite mix for development.