View Full Version : Dink Source

07-11-2003, 07:17 AM
I'm planning to release the Dink source under a very liberal "do what you want with it" license very soon. I figured I'd better put up a forum so people could all complain and crucify my programming techniques (from the ancient past, mind you!) in one place.

07-11-2003, 08:34 AM

07-11-2003, 02:12 PM
Wow! I've been waiting for this for a loooong time

07-12-2003, 02:29 AM
Seth, what caused you to suddenly release the source code?

-- Merlin (Andrew)

07-12-2003, 03:13 AM
Just thought I'd post this here in case Seth had any comments on it. I posted this on the dink network a little while ago.


Just happened to browse onto the site and what do I see. Well anyways, I can't afford the time to get involved in another project like this after working on WDE (had to force myself off that project). Besides, I really need to start and finish my own game. But I thought I might give everyone a few suggestions on what might be done.

First off the suggestion of some source control is a very good idea. You definitely don't want the codebase splitting off into multiple directions.

The absolute first thing that should probably be done is clean up the source code. Don't do anything else until this is done. Looking at RTSoft's board I saw that Seth had said that there were 30,000 lines of code in mostly 3 files. 3 files is WAY too few files for that amount of code, especially with C++. You will need to split these 3 files in probably 10 times that to even come close to organising them. C++ classes should also be implemented (moreso at least) to contain the code for these files. Looking at the WDE might help in this regard, but perhaps not.

One thing that should definitely be done is port dinkc to a proper interpretter by using a tool such as lex or yak. I'm sure there's better since from what I've seen of those two they are rather difficult to get to work with without a lot of work. The only one I've worked with is Visual Parse which is simply awesome but at $500 a copy not a viable solution. Unless you've had a class on compiler design this could be a difficult thing to set up.

Graphics: 16-bit/32-bit color. I would recommend supporting both but you should give preference to 16-bit for speed and to reduce download size. Adding jpeg support might be an interesting addition to reduce file size. Higher resolutions are not possible without changing the dink format and so should be probably not be done. You also wouldn't want to switch the code to directx 8 or 9 since you won't be using any of the features in them. Better to keep a wide userbase by not requiring users to install them.

Porting: Since someone mentioned porting to other platforms you must keep in mind the game is coded in directx. If you do intend to make this work on other platforms you'll need a C++ cross platform library such as SDL. Allegro might also work although I don't know anything about it. This change should be done to the base source code if done. Splitting off the source code is not a good idea.

Sound/Music: I'm not sure if I can recommend this or not as it will mean very large downloads. Mp3 support should probably not be considered due to license issues and file size. Ogg vorbis support would probably work well. Those files tend to be half the size of comparable mp3s. It's also license free. For implementation you can either choose to use libraries such as fmod or the ogg vorbis library. The ogg vorbis library would be my choice although using fmod would allow support of many many different formats (mp3s, ogg, mods, midi, etc).

Movie playing: choose a high quality codec like divx (such as xvid). This will still absolutely wreak havoc on download sizes but is much preferrable to using mpegs or old avi files. Make sure to not require the codec to be installed but rather is included with the new game. Also make sure of the licensing before choosing a format.

Also, I would recommend splitting off the exes so that you keep the old dink.exe and create a new one. Unless you want to reproduce all the bugs (and I guarantee this will be problematic if you want to make real improvements to dinkc) this is probably the best solution. Maintaining the buggy old code inside the cleaned up code would just be a nightmare. And I'm not sure you can claim to be cleaning up code if you leave bugs in.

The dink editor: If you make any major changes to the dink file structures you will break both WDE and dinkedit. So are you going to update both or not.

File formats: I would recommend eventually changing the file structures so that the dink.dat and map.dat both fit into one file. Adding support for multiple maps seems like something that is desirable. The map.dat also only utilizes on average maybe 10% of the file efficiently. Whether you want to implement some of the features the extra data was for (sprite rotation, etc) or remove them is up for you to decide. You should probably also eliminate the .ff format (microsoft fastfile actually) in favor of some comprehensive wad format for all files. That would also eliminate the need for .d files which are compressed .c files, not compiled .c files.

Removing the limit on sprites and only using the space necessary would also be good. I would note that unless someone has a lot of time to spend you probably don't want to go messing with these files. The limit on tiles could also be removed (rather easily actually). You shouldn't even think of the possibility of eliminating screen scrolling as that would break nearly everything.

Really though, I'm not sure if it's worth it to change the file formats. Might as well start coding a different game from scratch than make major changes to these.

Well I'll stop here. I'm not in any way saying this is how things should be done rather that these are simply some ideas to discuss. I'm sure many people have other/better ideas since I'm just spouting these ideas off as I type.


07-12-2003, 04:55 AM
To answer Merlin about why I decided to release now, I dunno, I just had some free time. Been planning to release it for a while, and now that it's pretty obvious I'll never find the time to go and clean it up/fix bugs, I might as well at least give others the chance to do so before it's not totally useless to anybody.

What really stopped me from releasing it before now was thinking someone would try to make a Dink II, (something I plan to do at some point) and otherwise abuse the copyright and ownership of Dink Smallwood and its related media.

But I think my license I've written makes it pretty clear they can't do that.

07-12-2003, 04:23 PM
You are aware that there will be 5 million engines floating around here, right? Just got practice, I might try to re-write your engine code, but I doubt I will release it.

07-12-2003, 08:37 PM
Fragmentation was definitely an issue, but now that it&#39;s a six year old game... <shrug>

I don&#39;t think it will really happen, probably only one or a few versions will see much distribution (it would have to be GOOD, probably released by a self formed group/team/alliance, could be a sourceforge project, or multiple source forge projects by different people) or matter much even if it does.

I think people will have fun looking over the source and being amazed that the game worked and LOL&#39;ing for a week or so at it.

07-13-2003, 11:41 AM
but you&#39;ll be amazed what an opensource community can do nowdays to ugly code, its like plastical surgery, with exception that its free&#33;..

and most/all of what you said nexis is correct..

08-14-2003, 02:10 AM
why do some people complain about the code i mean the game works its fun to play and it worked i think seth did a pretty good job with the code

08-20-2003, 03:01 AM
Have you even seen the code?

01-27-2004, 07:40 PM
Hey, I started to read that article that was posted here. I read the part about so much code in only 3 files and it should be placed in about 10 times that....( I&#39;m not a programmer, I would love to be, I taught myself basic back in 1988, I&#39;m 45, soon to be 46... I don&#39;t know where to start... just some background real quick) It seems to me that if you can condense that much into three files and it works, You truely have a touch of genious... my hats off to you Seth.. by the way... I would like to speak to you about developing something for me...

Ahso Rottenfeather
01-27-2004, 07:48 PM
one more thing... I am downloading Dink right now so I can try out the game... I&#39;m an old rpg playin fool... been playin em since as far back as I can remember... I just love em...

Ahso Rottenfeather
01-27-2004, 08:28 PM
Why won&#39;t it show that there is a new post in this category?