• entries
15
14
• views
15677

Game development and maybe a bit of Haskell.

## The SpaceGame in 3d!

I have decided to convert my game RymdspeletHD (translation: The Space Game HD) to 3d. I suppose that the new title will be something like RymdspeletHD 3d Deluxe Edition.

My idea with this conversion is that it might be a project that I may actually finish, instead of trying to make yet another full blown rpg or an epic freespace clone. I am using my home brew 3d engine to complete this (that I wrote for my freespace clone, which I never finished ). It's all being written in glorious C# with the help of OpenTK.

I just implemented the cook torrance lighting model in the game and I am on the way to do some of the initial game play. Already got movement and shooting covered but collision detection is missing. It would be nice if you were actually able to hit one of those nasty asteroids. I have not decided exactly on how I will handle the collision detection yet but I will either do simple sphere colliders as I have done in the past or some kind of mesh based detection for more accurate collisions.

I have attached screenshots of both the 3d and 2d versions to this post. As you can see I have quite a lot of work to do before I can match the visual quality of the old version. But at least the lighting will be dynamic and nice.

If you're interested in playing the regular RymdspeletHD then it is still available at www.rymdspelet.net

## Unnamed Space Shooter, with screen-shots!

Here are a couple of screen-shots from a Freespace like space shooter that I have been developing for the last six months. I am using Unity3d and C# to create the game. There is only one mission in the game at the movement but most of the features that I want are already there like complex objectives, including but not limited to destroy a specific group, protected a specific group, reach a point etc. All objectives can be time limited, start after a specific amount of time, depend on other objectives and more.

There are also multiple weapons both primary (lasers) and secondary (missiles), the player can active or deactivate individual lasers, multiple lasers can be active at the same time, and switch between available missile launchers. The missiles have target locking or they can be just simple fire and forget missiles.

I have also implemented some auto-piloting functionality such as automatic speed keeping either at full or half speed. Or the ability to match the speed of your current target, useful for pursuing someone while blasting them to pieces. There is also an afterburner that allows you to go slightly above the ships speed limit and accelerates faster than the ordinary engines.

The ship control itself is not realistic and is more like driving a car, I found this to be more fun than the realistic alternative.

That's it for today, the screen-shots are in the gallery just above all the text, just in case you didn't notice.

## A couple of hours with Unity

I downloaded and I have now spent a couple of hours playing around with it, most of which was spent building the light maps. The result is a medieval city scene viewed from a top down perspective and a character that goes where you click. The camera can be moved be moving the cursor to the corners of the screen and there is also a monster that will try to hunt you down, although it does not deal any damage yet. Expect more updates soon.

There is a web player available here: http://www.tinyrocke.../WebPlayer.html

Update
It is now possible to attack (and kill) the monster and he got a buddy waiting for you further down the road. There is also some wind blowing in the background.

Update 2
The town is bigger now and there is new enemy "hiding" in it. I have also added basic path finding using Angry Ant's Path and some basic leveling, don't forget to spend your characters points or you will probably meet a gruesome death.

Update 3
I have implemented the quest view and added one quest, "Kill all the monsters"...

## I made a particle editor

The title says it all, I made a particle editor for my current game project and it works well enough for the moment. It has most of the features that I need like adding / removing emitters and affectors, combining different particle systems and loading in meshes and attaching the system to a tagpoint to get a hint of how it will look ingame. It is written in C# and I have probably spent 20-30 hours on it over the course of a couple of weeks, this includes time spent on creating the particle engine as well.

I have created some tools to create roads that follow the landscape nicely. I just define a set of points for the road, create a spline and make a couple of triangles along it and match the height of each vertex to the terrain. It works great so long as the terrain is flat ... I will have to figure out a better way to match the height, maybe flattening the terrain under the road but it's hard to get it to fit perfectly. And I will probably have to come up with an explanation for the existence of asphalt in my fantasy world

## Paint, items and conversations

The terrain base color map has become much more important now that the detail textures are gray-scale so I decided to make a painting mode in the editor for the color map. It consists of a color picker and an rgb value representation. It is also possible to right click on the terrain to use the color under the mouse cursor. The color picker is just a simple texture and the pixel color under the mouse is used when it is clicked on.

There is also a new brush menu in the editor where different brushes can be selected and where the brush strength and size can be set.

I have also made various improvements to the actual game, one of which is a new item system. Each item has a number of effects that are applied when the item is equipped and used. An effect can have various attributes such as different timing modes and a random chance of being applied. For example an effect that does 10 damage over 4 seconds or an effect that has a 20% chance of healing 14 health points. So when a characters hits something then all the effects of the currently equipped item are applied to the target.

Here is a screenshot of the player character holding a nice untextured sword

And finally I made some changes to the conversation editor, some stuff got move around, real open / save dialogs and various short-cuts for linking, moving and copying lines. It is also possible to change the font and the font size.

## Multi-colored characters

I just branched my standard shader into a special character shader that allows three areas to have different colors per mesh instance - skin, hair and eye color.

I have also modified the terrain shader to use gray-scale detail textures instead of color textures. This makes it possible to combine four detail textures into one texture, one for each channel, resulting in less texture fetches. I use a base color layer on the terrain to bring back the colors and the detail textures are also used as height maps to calculate a nice per pixel normal. All in all this saves a couple of texture fetches and quite a lot of texture memory as only two textures are used instead of 9 (1 base + 1 detail compared to 1 base + 4 detail color + 4 detail normal).

## Continuing the conversation

Worked a bit more on the conversation editor. Line links can now be established and broken, the "l" button and the "b" button. Lines can also be moved up and down on the same level using the left and right buttons. And I also made it so that NPC responses are colored in red and links in violet.

There are also some more visual changes like icons for most of the buttons and the three main areas, the conversation list, the tree and the line editor can be resized.

## Starting a conversation

I am working on a rpg in the style of Baldur's Gate and Dragon Age. An important part in these kind of games is the conversation system. The conversations are not just simple one liners but they branch and repeat in various ways so it is important that the conversation system is flexible enough to handle all of this.

A conversation is a line that may have several lines or responses. It may also have an action script that is executed when the line is activated. There can also be a condition script and if it evaluates to true then the line is visible. This means that there can be several roots in a conversation and the one that is used is the first one whose condition evaluates to true.

A line can also be a link to another line which means that the conversation jumps to that line instead, this can be great for conversations that repeat.

This is what I got so far:
class ConversationLine {public:	Guid ID;	Guid Link; // optional	string Condition; // Optional	string Action; // Optional	string Text;	List Lines;};typedef List Conversation;

I made an editor for this conversation system in C# and I will probably implement it in the actual game as soon as I have got the GUI up and running. I have attached a screenshot of the editor below.

## Adventures in the land of Linux

I have started to port my current project to Linux. I began yesterday by installing Ubuntu, Xmonad and configuring vim. I resumed today by installing Code::Blocks (I'll probably use cmake for project configuration once I have got it all to compile) and checking out the latest version of my project. I created a new static library, added all source files and hit build ... *boom*. The first few errors were simple to resolve, just a couple "#ifdef WIN32" but the later problems were a bit more interesting.

Problem:
DataMap::const_iterator iter = ... // Expected ; after const_iterator
I tried the following but to now avail
std::map::const_iterator iter = ...

I came up with the following working solution after a visiti to google
typedef typename DataMap::const_iterator DataMapConstIterator;DataMapConstIterator iter = ...

A couple of compilation units passed successfully until we entered the magical land of GameMonkey. Got a gmConfig_p.h for gcc that solved most problems but there were some code that required the program to be compiled as 32 bit. So I added the "-m32" flag and got a fancy error message "gnu/stubs-32.h no such file or directory". "sudo apt-get install libc6-dev-i386" killed that one.

Getting the Ogre include files to compile did not prove to be much of a problem, just had to download a couple of files that were not included in the Win32 sdk.

There were only a couple of small errors after that, some include paths had case errors (Linux is case sensitive, Windows is not) and TinyXML required "TIXML_USE_STL" to be set. Everything compiled after that so now I will have to actually compile all dependencies so that the linker can get to work. But that will probably have to wait until after the weekend.

## Bachelor project - almost finished

Just finished the presentation of my bachelor project, a Haskell Interpreter in javascript. It went pretty good but it could definitely gone better, a bit of stuttering on my side, we rushed through some parts and most of the crowd did not know what Haskell was. So now it's time to grade my coworkers, have a grading discussion with our mentor and await the final grading. I might just get a VG (Very Good, "V?l godk?nt" in Swedish) grade at least with a bit of luck.

/ Johan

## RymdspeletHD - New beta

Just finished a new beta version of my addicitive space asteroid shooter RymdspeletHD, it is available at http://www.rymdspelet.net as usual.

I'll probably have to polish it for two or three versions more before it is ready to get out of beta and be released for "real". And if I manage to get my friend to actually to compose something then there might actually be some awesome music in the next version.

Changes:
* Explosions are finished before end of level text is shown
* Ship rotation controls are a bit less sensitive
* Top 10 highscore is shown on main menu
* Various graphical improvements

## A haskell interpreter in Javascript

The report for my bachelor thesis has just been completed, a Haskell interpreter written i javascript. We were four people working on this project and my main responsibility was to make the parser, this meant stripping comment, applying the layout rules, parsing the actual grammar and generating the abstract syntax tree. Most of the language as it is specified in the Haskell 98 online report can be parsed, but we have not tested everything yet so there are probably a lot of bugs. The layout rules are applied correctly in most cases but some things like let expressions in list comprehensions does not expand correctly as we do not keep track of invalid and valid parsings for let expression, just of matching 'let ... in' expression do get the basic stuff working.

The simple lexer and the complete parser was made using a parser combinator library called JSParse and it worked out fine except that it does not keep track of line numbers, columns or which parser that failed so it is really hard to get any good error messages. There were also a couple of bugs in the butnot-parser and in the caching for the choice parser. I managed to fix both of them and the functioning version can be found at our git repository.

We do not support type classes at the moment but we will most likely fix that in the two coming weeks as we really want them in the final presentation of the project.

The source code for the whole project can be found at our git repository, feel free to clone it. http://github.com/johang88/haskellinjavascript

I have also put up an online demo at http://hiji.tinyrocket.se that works in firefox and chrome but internet explorer remains untested. The demo has a small part of the standard prelude library the definition of which can be found here http://hiji.tinyrocket.se/hs/Prelude.hs

Have a nice day

/ Johan

## First post

So I just got a GDNet+ subscription, payed for a whole year, just to show my appreciation for this site. Figure that I might just as well use this journal for something, but that will probably have to wait as I am busy writing a report for my bachelor thesis, a Haskell interpreter in javascript. You can probably expect some more information about that project in the future.

In the meantime, why don't you check out the beta version of my awesome asteroid space shooter RymdspeletHD

/ Johan G