Author Topic: Roguelike Game Kit  (Read 20509 times)

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Roguelike Game Kit
« on: July 07, 2010, 02:12:18 PM »
Over the years I worked on so many game projects, and wrote code that might be useful for other game developers too. I want to release some of it under the GPL.

So I've set up a project at Sourceforge:
http://sourceforge.net/projects/rlgamekit/

At the moment there is a module for map data in the SVN (a layered map, e.g. ground, features, items, monster/player layer, but in a very generic fashion), and an example dungeon generator.

Also, a display module for such map data, showing funky colored ASCII characters in rectangular and isometric styles (sorry, couldn't resist).



I hope I can provide more of such modules, field of view calculation, generic item and monster data structures and the like.

Maybe the modules will be helpful for the one or other. For study, or to use for any kind of open source project, roguelike, crpg or just anything. The code is Java, and should work with Java v6.

It's a very early stage, the code needs more cleanup, but I have some hope that it will get somewhere.
« Last Edit: July 07, 2010, 02:18:34 PM by Hajo »

getter77

  • Protector of the Temple
  • Global Moderator
  • Rogueliker
  • *****
  • Posts: 4952
  • Karma: +2/-1
    • View Profile
Re: Roguelike Game Kit
« Reply #1 on: July 07, 2010, 03:32:47 PM »
Cool stuff, always nice to see more resources/something that could serve as the backbone to some future project somewhere out there.   8)   Thanks for taking the time and trouble to reckon and set up the lot of it, keep at it!
Brian Emre Jeffears
Aspiring Designer/Programmer/Composer
In Training

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #2 on: July 08, 2010, 02:36:12 PM »
It's sometimes difficult to make modules generic enough that they are still useful to other peoples projects, an still simple enough so that people can use them easily. But it's a good practice for myself, to split game dependent parts of the code from the game independent parts.

I've been working some more on it, and the Roguelike Game Kit now has a field of view (FOV) module in place. It should be a fairly efficient implementation of the shadowcasting algorithm, but I did not do any performance tests yet. I have used this with some success in former projects.


I've kept the FOV module independent from the actual game data. It does also not depend on other modules of the Roguelike Game Kit.

The example MapDisplay class contains code that shows how to link the FOV calculation with the tile painting code, that is, which parts you need to implement to tell the FOV code what kind of things in your game actually block sight.

ido

  • Rogueliker
  • ***
  • Posts: 618
  • Karma: +0/-0
    • View Profile
    • Tame Tick
Re: Roguelike Game Kit
« Reply #3 on: July 08, 2010, 03:46:43 PM »
Neat!

I've looked at your IsometricTileLocator and I think I might use the same technique myself.

For some reason I thought it would be a lot harder but your solution seems really trivial and the result looks really good :)

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #4 on: July 08, 2010, 07:43:25 PM »
In my first tries, I had overcomplicated the isometric view calculations a lot too. I'm glad you like it, I'm also happy how nicely it shapes up.

After the map structure and the field of view code, I wanted to work on a module for game actions. That is, a structure that allows to bind a (generic) action to a key press. I think I have the basics of this module in place now, too, and also implemented an example "Move" action for the demonstrator program. So, it now is kind of a super-simple mini roguelike walkaround demo.

You can fetch the JAR file with demonstrator code included from Sourceforge:
http://sourceforge.net/projects/rlgamekit/files/

You can run the walkaround demo from the console by typing:

java -jar RoguelikeGameKit.jar

On Windows (and maybe other operating systems) the demo can also be started by a double click on the RoguelikeGameKit.jar if java is properly installed. It needs Java version 6 or newer to run. The demo will generate a random dungeon, display the dungeon and let you move the @ character around. You can move by WASD, HJKL and cursor keys.

Once I had a lockup in the demo (couldn't move anymore) and it might happen that the @ is not placed inside a room of the dungeon at start, but in a wall. In such a case, just restart the demo. I'll try to find out why it locked up this one time - I couldn't reproduce it anymore so far.

In order to avoid misunderstandings - this project is not meant to become a roguelike game itself, it just provides modules which help to write one. The walkaroudn demo is there to show how to use these modules.
 
Having said that, it was an exciting moment for me too, to move the @ the first time, and see the field of view update :)
« Last Edit: July 08, 2010, 07:46:53 PM by Hajo »

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #5 on: July 09, 2010, 10:13:41 AM »
I've started to write some documentation for the Roguelike Game Kit. The field of view code might be the most interesting module for roguelike developers, so I started with that:

* How to use the field of view module

ido

  • Rogueliker
  • ***
  • Posts: 618
  • Karma: +0/-0
    • View Profile
    • Tame Tick
Re: Roguelike Game Kit
« Reply #6 on: July 09, 2010, 01:12:59 PM »
Why is the cursor location multiplied by 2 in the iso viewer code?

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #7 on: July 09, 2010, 01:44:10 PM »
if (dx,dy) be the distance from iso tile center to the next iso tile center, the size of such a tile is (dx*2, dx*2). Hard to explain without a sketch.

Code: [Select]
/\
/  \
\  /\
 \/  \
  \  /
   \/

The offset from tile to tile is (2,2) in this example, measured in screen coordinates, but the surrounding rectangle of a tile has the size (4,4). The "cursor" would be drawn as such a surrounding rectangle (not used in the demo code so far).



I've been trying to write more documentation, and now there is also a short introduction of the ideas of the layred map in place.

* How to use the layered map

I hope my writing is somewhat clear.
« Last Edit: July 09, 2010, 01:48:07 PM by Hajo »

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #8 on: July 10, 2010, 09:37:39 AM »
I've expanded the example dungeon generator a bit. It now can place doors.


The walkaround demo code was expanded too, to let the player open doors by bumping into them. The new jar file with the modules and the walkaround demo can be fetched from Sourceforge now:

:=> https://sourceforge.net/projects/rlgamekit/files/
« Last Edit: July 12, 2010, 07:57:07 PM by Hajo »

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #9 on: July 11, 2010, 11:14:38 AM »
If doors can be opened, there should be example code how to close them as well. I've expanded the walkaround demo with a game action to close doors. Also, it has now a "Player" class that can tell where and how to store player specific data. Maybe some day the player class can be generalized and moved to the libraries.

https://sourceforge.net/projects/rlgamekit/files/

Press "c" followed by a movement command to close a door in the walkaround demo.
« Last Edit: July 11, 2010, 11:16:30 AM by Hajo »

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #10 on: July 12, 2010, 07:55:51 PM »
There have been two notable additions since v.4:

- A simple menu system, with usage example in the walkaround demo.
- The walkaround demo now keeps track of seen ("remembered") squares.

That means, even in the demo you now need to walk around and explore the dungeon to see the full map layout. Also, you can quit the demo now by pressing Q, X or Escape.


You can fetch the latest version from Sourceforge:

https://sourceforge.net/projects/rlgamekit/files/

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #11 on: July 13, 2010, 09:27:58 PM »
I've had some problems with this release, and I hope I've got everything packaged correctly.

There have been two notable additions since v.5:

- The walkaround demo now generates new levels when stepping on the "stairs up" symbol.
- Player now always spawns in a valid position in the walkaround demo.

All changes:

Quote
FIX: Multiple choice boxes are now always centered on window.
FIX: Fixed a wrong dependency between MapDisplay and ASCIITilePainter.
FIX: Better tracking of "ok" state for multiple choice boxes.
NEW: "Stairs up" symbol in walkaround demo now generates a new map if stepped onto.
NEW: LayeredMap got "spawn position" property.
CHG: Dungeon generator now sets "spawn position" with a suggestion for player spawn position.
CHG: Walkaround demo now uses player spawn position to set the player starting location.
You can fetch the latest version from Sourceforge:

https://sourceforge.net/projects/rlgamekit/files/

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #12 on: July 14, 2010, 10:07:27 AM »
I've written a brief summary about the walkaround demo (purpose of the demo, starting the demo, demo controls, quitting the demo):

https://sourceforge.net/apps/mediawiki/rlgamekit/index.php?title=The_walkaround_demo

Next module on my list to be included in the kit is pathfinding.

ido

  • Rogueliker
  • ***
  • Posts: 618
  • Karma: +0/-0
    • View Profile
    • Tame Tick
Re: Roguelike Game Kit
« Reply #13 on: July 14, 2010, 01:04:20 PM »
Any chance or releasing this under MIT/BSD/public domain?

Etinarg

  • Rogueliker
  • ***
  • Posts: 424
  • Karma: +1/-1
  • Idea archivist and game tinkerer.
    • View Profile
    • Gedankenweber Blog (German)
Re: Roguelike Game Kit
« Reply #14 on: July 14, 2010, 01:11:22 PM »
Should be alright. BSD style licenses tend to be pretty "free". I guess I can dual license the code (GPL and BSD)?

Edit: I'll try to allow use under the BSD and GPL licenses. I'm trying to set up files and wording for that.

Edit 2: This seems to mean that all future contributions must also become dual licensed. Will this be a problem? Should I stick to one license rather?
« Last Edit: July 14, 2010, 01:27:48 PM by Hajo »