The Dink Network

YeOldeDink 0.1: A Freedink Fork

November 8th 2022, 11:57 PM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
This is a fork of Ghostknight's repo with a few extra features added, intended for developers and those who want to understand the engine better. After Ghostknight went to the effort to update the logging mechanism, I felt it was wasted on the existing debug interface so I made my own with Dear Imgui.

Improvements are as follows:
A completely updated debug interface with a visible log and the ability for people to make their own additions,
Improved PNG support without having to do any filename rejigging or sprite resizing,
Turned off some of the annoying mouse capture options,
The OpenGL renderer is inaccessible in favour of the "software" renderer,
get_client_fork() is implemented as per Seth's recommendation and returns 3

Pitfalls and gotchas:
8-bit mode won't work at all,
The editor won't build and will throw linker errors because I didn't do the makefile properly,
The executable it outputs is still called "freedink" so don't do "make install" unless you want to overwrite,
No Windows release unless someone really wants one,
the tile surface isn't cleared upon the screen reloading meaning transparent tiles will overlay upon the previous screen's tiles like in the screenshot,

Screenshot 1
Screenshot 2

All the relevant widgets are exposed in debug_imgui.cpp in case you want to add your own features. My dev platform is macOS, but I also gave it some minor testing on Ubuntu, which worked fine. Compilation should be the usual "./bootstrap", "./configure", and "make" sequence. You may have to run "make distclean" or something if it doesn't build, I don't know. Archive here, apologies for no git.
November 9th 2022, 08:42 AM
pq_cthunik.gif
GOKUSSJ6
Peasant Male Poland steam
Everyone should get a pizza for free in each week. 
Dang, amazing job with this. Is there any plans in expanding it further, as well as switch from old and janky autoconf into CMake?
November 9th 2022, 12:10 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
This seems quite amazing!

I would be interested in windows release, since I'm mainly a windows user. I imagine RobJ would be too, but perhaps I shouldn't speak on his behalf haha.
November 9th 2022, 09:24 PM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
Gokussj: I looked into moving the build system to Meson, but the whole transition process from Autotools would be above my current skill level and inclination. Ideally, i'd want to remove the Gnulib integration at the same time, but that's probably its own nightmare so I'm hesitant for the time being.

I did also look into making a thing for rebinding the joystick buttons but haven't fully implemented it yet. The keyboard keys are pretty much hard-coded so I wouldn't want to touch those at this stage.

drone: I did manage to get an MSYS2 Mingw64 Windows build finished that I'll upload soon. Unfortunately, for whatever reason, the "software" renderer looks terrible on Windows compared to macOS and GNU/Linux, and the build crashes upon exit despite not doing so on any other system. I couldn't get a proper debugging environment set up on there to figure out what was wrong so I won't be able to diagnose Windows-specific issues if any arise. GCC on MSYS2 (and perhaps Arch) appears to have some quirks that don't present themselves elsewhere.
November 10th 2022, 02:37 AM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
Btw, one debug window suggestion I would have for future improvements, would be to have a list of the currently active scripts on screen. I imagine that would be very useful for dmod debugging.
November 10th 2022, 05:46 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
Windows build. Somehow I managed to get it so that Imgui looks as it does on other systems, but sound effects stutter terribly, and it still crashes upon exit. I also had to include a lot of dlls, so it's best if you unzip it to its own location and run it on the command line or perhaps with Martridge if it supports arbitrary paths and --refdir. Be warned!

I put an active script counter in the "ultimate cheat" window for this build, and will attempt an x64 AppImage and new source tarball in a bit.

Other potential additions at the moment include the ability to turn off those pink squares, as well as improve the DinkC Console window so it has basic command history and a submit button, and also flesh out the ultimate cheat window a bit more.
November 10th 2022, 01:59 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
Wow! You actually did it that fast?!

I got it to run by either copying the "dink" folder inside, or launching it with Martridge... Weird thing is, if i launch it normally without any command line parameters, it goes fullscreen and i can't click on anything, but if i launch the base dink game with Matridge it works fine even without debug mode enabled...

Martridge config example screenshot
PS: Ignore the duplicate dmods in matrtridge it seems to be a bug that i thought i fixed but uh, apparently i didn't in the version i launched?

The custom arguments option came in handy

Unfortunately, most dmods don't seem to render the menu / title screen correctly at all for me...
This is what happens if i launch Charlie's Legacy for example: screenshot

FB2 launches the menu correctly, but if i load anything, it seems none of the tiles get drawn:
screenshot of the menu
screenshot of the game
November 10th 2022, 07:12 PM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
The Dear Imgui syntax is very straightforward meaning scrip names are almost finished too. It looks like you forgot the -t flag. I haven't stubbed out 8-bit mode yet so it's still required for the time being. I also don't recommend launching in full-screen mode as it occasionally has performance issues that don't present themselves when starting windowed and then maximising.
November 11th 2022, 12:58 AM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
Oh! You are correct! That was it!

Edit: Oh, I found out why I couldn't click things fullscreen. It seems, due to the aspect ratio being different, the cursor positions get fugged. I think without the -t flag the cursor image wasn't rendering. The windows cursor position that interacts with the Dear Imgui elements is in one place, and the in-game cursor is in a different place. When you keep it in windowed mode at 4:3 it's fine.

But this is so weird... It probably has to do with how freedink itself handles cursor tracking... When i move the winodws cursor way to the right, the in-game cursor gets clamped to the right. You'd expect it to move left immediately as i move left, but no, I have to move the cursor about halfway on the screen until the in-game cursor starts moving left!

Edit2: I found a bug you might be interested in. If i put some Dear Imgui window behind the "Debug mode enabled" info overlay, and accidentally click on the overlay, it goes on top over the window and i can't click the window at all anymore. It seems it resolves itself if i toggle debug mode on and off though.

PS: I had another suggestion i forgot to mention, a hardness view toggle would probably be useful too. Something like alt-h, toggling drawing the hardness like in the editor.
November 11th 2022, 02:26 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
>how freedink itself handles cursor tracking

Yeah, the engine uses relative mouse positioning for mouse mode which I've messed around with, but I tend to use the keyboard or joystick there due to it being in use for roughly 3 seconds, after which you're using the keyboard or joystick anyway. Unless someone really wants to make a sequel to Agathain Sea Traders or Dink Mines using this, I won't change anything.

>i can't click the window at all anymore

The transparent info window can have its position changed to other corners of the screen by right-clicking it. In a worst-case scenario, you may have to edit imgui.ini manually with new screen coordinates.

>a hardness view toggle

Done! Will be in an upcoming release.
November 11th 2022, 03:32 AM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
>Done! Will be in an upcoming release.
Man, you work fast! How do we vote you into taking over the official freedink repo, lmao.

Yeoldetoast and Ghostknight, you two are the real Freedink MVPs this year!
November 11th 2022, 03:52 AM
peasantmp.gif
Skurn
Peasant Male Equatorial Guinea xbox steam duck bloop
can't flim flam the glim glam 
wait, yeah, why arent you
November 17th 2022, 08:32 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
At that point I may as well learn French fluently and take over Beuc's entire life

The next release may be a little while. Things are changing rapidly.
November 20th 2022, 02:51 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
I like what I'm seeing
November 22nd 2022, 08:42 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
0.2 update:
In addition to the aforementioned:
- Got rid of some windows and moved things into the menu bar
- 8-bit mode is now inaccessible
- Added sprite, variable, and script info viewers
- Moved the DinkC console into the floating info window and the log
- Added the option to pause while the console is active, and also display a warning
- The game itself is now viewable in a separate window (yo dawg)
- The main renderer can now be switched off too, along with the pink squares and some other things
- Expanded "Ultimate Cheat" and the log window a bit more
- Added a "map viewer" window indicating which screen you're on
- Added quick save/load (slot 1337)

Archive, plus Windows build. I also took the hint and looked at that FB2 map bug but it's out of my depth, unfortunately.
November 27th 2022, 09:10 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
Coming in 0.3:

- Added sysinfo window
- Expanded audio control window
- added a slow mode
- added controller rumble when hurt
- pressing Tab increases speed only in normal mode
- Added a speed menu to debug mode
- Added "play_mod_order(int order)" to DinkC allowing basic tracker module control. Requires SDL Mixer 2.6 and up.
- SoundFonts also seem to work now, at least on macOS.

I've also turned my interest to YeoldeDinkEdit, or Yedit for short, which will have the same sort of interface, as well as PNG support. So far I have managed to squash a few bugs relating to being unable to place sprites or tiles properly if you should happen to create your own MAP.DAT from scratch(er) with an empty file. Will probably get a release when it has enough features. Please list your current FreeDinkEdit gripes below if you should have any.

Screenshot 1
Screenshot 2
November 28th 2022, 04:07 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
I think a useful thing for a YeoldeDinkEdit, if possible, would be to (optionally) render adjacent screens so you can see how sprites align between screens. But that might be rather complicated to implement?... I don't suppose you can just call a screen rendering function to some canvas using just different screen ids, hah.
November 29th 2022, 04:27 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
>I don't suppose you can just call a screen rendering function to some canvas using just different screen ids, hah.

It was the first thing I tried! Only to find out that the backend renderer is designed for loading/displaying one screen at a time . For certain stuff I'm using the temporary buffers for the screen transition, and I may be able to hack something together with the minimap preview thing if I can eventually figure it out. The FreeDinkEdit source is basically the original DinkEdit with various SDL replacements for DirectDraw meaning it's mostly still a mess of nested if-statements and occasional use of "goto".
November 30th 2022, 11:55 AM
spike.gif
SlipDink
Peasant Male United States bloop
2nd generation. No easy way to be free. 
Why not work with making a new version of the more versatile Windinkeditplus2 instead of the original DinkEdit?
November 30th 2022, 03:30 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
@SlipDink
Oh, speaking of that, there is a slight hope that RW might release the source code for it. I managed to get in contact with him a few months ago but, he has to find it first, although he said he should still have it somewhere... Currently waiting for another reply.
November 30th 2022, 07:03 PM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
>Why not work with making a new version of the more versatile Windinkeditplus2

1. As has been mentioned above, the source isn't available.
2. Even if it was, I wouldn't bother. The WDE source is a mess in other ways, mainly due to being Windows-only.
3. Beuc attempted a LinDinkEdit port years ago which never reached a functional state.
4. My general dislike of WDE is well-known.
5. The minor things holding back FDE that would make a big difference such as sprite property editing and default nohit etc should be straightforward to implement.

Edit: 6. Now that RW has ported the rendering backend of WDE2+ to SDL2, it might be feasible to strip away all the Windows-specific MFC stuff and replace its functionality with ImGui.My brief investigations have yielded positive results in that regard, but I don't know how it would be in practice. My wheels are already in motion with Freedink/edit, however, and I don't really have the inclination to attempt such a thing.
December 12th 2022, 07:30 AM
custom_robj.png
Robj
Jester Male Australia
You feed the madness, and it feeds on you. 
Not sure why but all the sound effects stutter/lag when I use the windows build of yeoldedink. Music is fine, it's only sound effects. Probably a issue only on my end but I can't figure it out. FreeDink doesn't do it.
December 12th 2022, 09:18 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
Don't worry, it's a known issue in SDL Mixer on Windows at the moment! I've recompiled using a newer version of Mixer, and SFX sound as they should on my end once again, although some people are still reporting that the stuttering may be Windows 11-specific.

Changelog:
- As above plus,
- MP3 audio precedence for the one d-mod that uses it (Prelude)
- The bug mentioned in the WDE2+ thread has been rectified meaning hard.dat tiles for tile screen 41 will now load and overlay as expected

On the topic of AppImages, I can't generate them due to stuffing up the makefile. If any GNU/Linux users need assistance with compiling, don't hesitate to ask.

Yeoldedink 0.3 for Windows with included datadir for those who don't want to stuff around with --refdir
0.3 for Windows with just exe and dlls
Sores arechive for compiling yourself

This will probably be the final release unless someone recommends a specific feature, or there's a major bug somewhere that reveals itself tomorrow (again).
December 12th 2022, 01:44 PM
goblins.gif
drone1400
Peasant Male Romania
C# nerd 
I'll give it a whirl on the weekend and see if i run into any bugs...
December 15th 2022, 09:43 PM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
Speaking of bugs, I had another look at this one. The relevant lines are in game_engine.cpp in game_load_screen(), and are as follows:

int game_load_screen(int mapdat_num) {
	if (g_dmod.map.ts_loc_mem[mapdat_num] != NULL) {
           memcpy(&cur_ed_screen, g_dmod.map.ts_loc_mem[mapdat_num], sizeof(struct editor_screen));
        else if (load_screen_to(g_dmod.map.map_dat.c_str(), mapdat_num, &cur_ed_screen) < 0)


In terms of data:
- mapdat_num refers to the screen number in map.dat that is to be loaded
- g_dmod.map is the struct that holds Dink.dat (the screen index etc)
- cur_ed_screen is the map.dat screen data in memory that you end up seeing after a redraw

The most pertinent of what's in there is ts_loc_mem[769], which is an array of the same data type as cur_ed_screen, i.e. it holds map screens in RAM. It seems to only be used for the test suite and is never modified anywhere else, meaning that for normal use, the "else if" executes instead since all values in ts_loc_mem are empty. In FB2 and other d-mods with large amounts of screens where the author decided to use MapNuke, there's the eventual problem where DinkEdit makes more than 768 screens, as MapNuke doesn't actually remove anything, and only zeroes the reference in Dink.dat. In the case of FB2, it has 804 screens in its MAP.DAT.

For screens above 768, my assumption is it's going outside the bounds of ts_loc_mem and seeing if memory values above that are NULL, of which many wouldn't be, and then causes a segfault when it tries to memcpy 31280 bytes of something else it shouldn't into cur_ed_screen, hence why, as Scratcher says, it crashes even if MAP.DAT isn't there. What flummoxed me initially was that it was occasionally loading screens above 768, probably due to comparing to an address out of bounds that just happened to be zero and thus loading normally. The next release will have this rectified, probably by getting rid of the if/else if.
December 23rd 2022, 09:47 AM
peasantmb.gif
yeoldetoast
Peasant Australia steam
I've come to get my meat 
A little demonstration of some features in yeoldedinkedit. Apologies for the terrible audio.

I also had a look at this bug which I assume is related to a minor annoyance I was experiencing in which all text immediately displayed after a warp would appear white. If the map is faded down at all even during a warp, it will make the text white so as to be visible should the screen fade down completely. The fix is to make it not do so if it's in the process of fading up.