The Dink Network

My own game pt. 2

May 1st 2006, 11:40 AM
In a previous blog message I posted how I started developing a game. Here's the next part, where I'll post some screenshots.

What I've done so far (over the last months, between a lot of work for university), is building the tile-based engine to render the world, a system for actors and sectors, and the editor. While sprites like monsters and projectiles are already supported, there's no AI or gameplay yet to use them, and no buttons in the editor yet to place them.

Everything from the game is loaded from a script.txt file, read by a token parser. Here's what the script currently looks like:

{ tile(file "tiles.png", alpha pinkkey) tile(file "trees.png", alpha pinkkey) tile(file "house.png", alpha pinkkey) tile(file "shadowtiles_black.png", alpha pinkkey) tile(file "shadowtiles_white.png", alpha pinkkey) tile(file "shadowtiles_ghost.png", alpha pinkkey) tile(file "clouds.png", alpha particle)
{ sprite(file "player.png", size 32 64, alpha pinkkey) sprite(file "monster.png", size 32 64, alpha pinkkey) sprite(file "projectile.png", size 16 16, alpha pinkkey)
{ 0

However, much more sections and features for the script are planned, including sections for events (simple C-like code), NPC dialogues, stats, items, damage types, ...

Here are some screenshots, kindly hosted by ImageShack, as long as the images are available on there:

My coding environment:

The graphics were drawn in KolourPaint. I'm however planning to improve them to look a bit more realistic as I try to gain more drawing skills, though I plan to keep the basic shapes. The front view perspective of everything isn't as nice as the iso-view in Dink, but I'm planning to keep it like that for simplicity.

The game engine is written in SDL with OpenGL, and requires no other libraries than those two.

The world is made out of 8 layers of tiles of 32x32 pixels. The first 4 layers are drawn below sprites, the other 4 layers are drawn above sprites. The tile layers are organised in sectors of 64x64 tiles each, which is only noticable in the editor, in the game you can't see the borders between sectors, and the map scrolls as you walk. The map files are saved with runlength encoding to achieve some compression. The textures are read from png files, with a png decoder written by myself to avoid havign more library dependencies.

For collision an extra layer is used that sets a collision type for each tile, with collision types such as walkthrougable, non walkthroughable, only walkthroughable for flying units, sliding ice, fall-down tile, thin border, ...

The tiles use 32 bit color and have an alpha channel for transparency, that will be used for shadows, ghost-monsters, translucent spell-effects and translucent clouds. Because painting programs are good at making it very hard to edit the alpha channel of a png file, you can also just draw an image without alpha channel and make the game calculate the alpha channel for you based on different alpha types such as using the pink color as key, or making the alpha channel equal to the brightness of the image.

The GUI for the editor and game is one that's written by myself and works in OpenGL. The GUI supports buttons, checkboxes, scrollbars, draggable windows, ...

The editor and game are merged in the same executable. The map format is simple enough to allow one to make a separate editor to edit such maps.

I have no name for the game yet. For the gameplay, I'm going to choose for a style similar to Dink Smallwood, that is, somewhat homouristic, not too complex stats, but RPG-like. I haven't really thought about the story yet, because I think a story will come on it's own once I start mapping.
May 1st 2006, 12:06 PM
Peasant Male Netherlands
Any fool can use a computer. Many do. 
Looks nicely done!

Links for the lazy:

Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4
Coding Environment
May 1st 2006, 03:30 PM
Peasant Male Netherlands steam
Olde Time Dinkere 
Ooooh. Aaaah.

Nice work. Continue like this.
May 1st 2006, 04:26 PM
Peasant Netherlands steam duck
Mmmm, pizza. 
Aye, that looks nice
May 1st 2006, 04:56 PM
Sounds like it has a lot of potential. You've programmed some cool stufff and have some cool ideas so far. Keep up the good work. And I hope it doesn't get dumped the way Merlin's ones do. Sorry if that offended you Merlin, because that was not my intent.
May 1st 2006, 11:53 PM
Peasant Male
No problem.
May 2nd 2006, 03:57 AM
May 8th 2006, 06:54 AM
Making a C-like scripting language like DinkC is very hard, Dink Smallwood is really good in this aspect.

Because I can't make something like that, the scripting language will be something much simpler: a sort of assembly like script with a stack and RPN notation. Global variables won't have names, but numbers (a bit like those of StarCraft). For example, to set the value of global variable number 25 to 200, you'd type the code:

"200 25 set"

To add the values of global variable number 36 and 78 together and store the result in local variable number 3, you'd type

"36 get 78 get add 3 lset"

For things like giving the player an item, for example to give him item number 13, you'd type "13 giveitem".

An if structure would be stack based as well, if value 0 is on the stack, the "else" part is executed, otherwise the "if" part, for example:

"14 get if { do_this } else { do_that }"

will do this if the value of global variable 14 isn't 0, otherwise it'll do that.

Do you think that would be useable?
May 8th 2006, 09:19 AM
Peasant Male Netherlands
Any fool can use a computer. Many do. 
Ah I remember a programming language that used that syntax (stack based), lemme check.. Forth (Wikipedia)

I think it would be fun to program in that. It might be confusing for new people but I can imagine that parsing such script would be easier - I guess Seth introduced the ampersand (&) to make it easier for him and such
May 8th 2006, 02:43 PM
Peasant Male Norway steam
Back from the ashes 
Hm... well, I managed to correctly parse the DinkC language (well, almost) after a couple of days of programming... redink1 pointed out where I failed in the alpha/beta-test program which used this lexer. As I've never actually learnt lexical analysis, I think I did rather well. Had I done more thorough pre-studies before I embarked on programming the lexer, I suppose I could've succeeded completely.

The DinkC (at least prior to v1.08) language is extremely simple compared to "proper" languages.
May 8th 2006, 04:54 PM
Making a C-like scripting language like DinkC is very hard

Oh, yes, I'd imagine. I wish I had the knowledge so that could help you, but alas I don't.
May 13th 2006, 09:44 AM
I released a test version, can I post it here, or is it too unrelated to Dink Smallwood?

May 13th 2006, 11:20 AM
Noble Male United States xbox steam
Super Sexy Tal Pal 
I don't see a problem with mentioning it and posting some links on the board.

On the other hand, if you're asking whether we'd upload it to this site or not, probably not.
May 13th 2006, 12:10 PM

I made a google page for the game, all info and the download link are there now!

It's a test release of the game, to test if it works as intended on different platforms. There should be an OpenGL rendered tile world, and music! It works in Windows and Linux. Please let me know if it works!

Please also test the editor by pressing the e button!


P.S. the game is only 900KB, since the textures are compressed as pngs
May 13th 2006, 06:51 PM
Cool! I didn't expect it o soon!