Sunday, October 17, 2010

Components and Entities

After reading an article in the Slick manual concerning components, i see that it makes absolute sense, for entities to be composed of multiple components. In extension of that, i have added components and two initial components, also outlined in concept in the article. Though my implementation is different.

ImageRenderComponent takes the path of the image to render as an argument and the map, so it can calculate the absolute position of it's owner. On every call to the render method, the image is drawn on screen and has the potential of added orientation and scale down the line. I will probably add an AnimationRenderComponent later on as well, so entities can be represented by an animation.

MovementComponent handles pathfinding using the Slick pathfinding algorithm. The destination is updated on click (event registered elsewhere). It then moves step by step following the path located by the algorithm.

Unicode Fonts with Slick

I used the UnicodeFont component in the Slick library for font rendering and it works flawlessly. I don't really need the runtime glyph loading, but i made a mistake when adding the AngelCode implementaiton, which caused me to switch the whole thing out.

On a related note, here is an awesome site with free fonts:

The Incarnation of a Project

Well it's all nice and well having the tools for creating a game, but what to create? I guess it says a lot about this effort, that this is my second, and not my first, consideration. All in all, i really care about the process and the learning experience, and not as much about the actual game. None the less it will be Awesome!

I will make a Role-Playing Game, which seems the most interesting vs time to get it in a playable state (e.g. learning curve) and heres why:
  • Maps and graphics doesn't matter that much (hurray).
  • Initially the game can consist of you walking around talking to different NPC's.
  • Later i can add lot's of depth incrementally (e.g. quests, abilities, encounters). 
My first milestone will be:
  • The player (you) walking around a... 
  • Single 2D map (30x40 tiles)... 
  • Clicking on randomly positioned NPC's and... 
  • Starting a simple dialog.
May not sound like a lot of fun, but it's only the first milestone! :)

Gettings started with Java gaming

I have long been wanting to get started with some game development. I have also started several times, but each time it's i have lost interest before ever reaching something of early alpha quality. This time is no different from the others, but whats there to do, other than keep trying?

The choice of language has fallen on Java. There are several reasons for that, some of them outlined below:
  • Much of the general code found in the internet and examples in books are written in Java.
  • I prefer writing in a managed language, coming from a PHP background.
  • I like Java, though i don't have much experience in it.
Next comes the question of which library to base the whole thing on. Previous "games" i've written have been stock . Maybe that is the reason it's run into the sand. Here are some of what i was looking for, though some it may seem redundant:
  • Simple framework, without to much "magic" going on behind the scenes.
  • 2D which really relates to the simplicity-thing. I don't want to spend all my time designing levels and animations.
  • Still comes most of the basic concepts, giving me a direction to work in.
The choice fell on a Java library called Slick. It fits pretty well with my requirements, and i read a couple of positive mentions, while searching the web.

Now i have found out which language and library i am going to use. Note that this is somewhat of a self documenting effort. Here are some technologies related to Slick, the library im basing my game on.