Graphics Enhancement Pack

Discussion in 'Modding Discussion' started by Clownacy, Apr 10, 2017.

  1. Apr 10, 2017
    Clownacy
    Senior Member
    "Wahoo! Upgrade!"
    Join Date: Jan 13, 2016
    Location:
    Posts: 54
    Anyone who hangs around the Discord chat might know that, for a while now, I've been working on a widescreen mod for Freeware Cave Story. It, and the rest of my Cave Story shenanigans, have fallen into a bit of a development hell, and I figure I've kept the folks that are interested waiting long enough, so here's what I have so far:



    Alternate video showing 16:9

    The aspect ratio is actually user-configurable, using my Mod Loader's new support for mod settings: the video above is 21:9, but with the edit of one txt file, you can make it, not just 16:9, but any ratio you want.

    In this mod's settings is the option to enable black bars, to cover the empty space outside the boundaries of smaller rooms, which are made visible by this mod. You can turn this off, but it makes the Best Ending look downright silly.

    Unfortunately, the mod is not yet perfect: on an engine level, the only thing on my to-do list is the credits, which are in a sub-par state (edit: fixed now) - the remaining problems lie in the script and map files. This is where you folks come in...

    If, for whatever reason, I don't get around to fixing these myself, you can open a Pull Request on the project's GitHub page, and submit fixes yourself. Most of the issues are characters despawning during cutscenes while still on-screen. I may populate the Issues section of the GitHub page with ones that I remember, so they can be publicly ticked-off as they're fixed.

    But that's not all: while rooting around the game's drawing system, I was able to make a few more changes, which make this more than just a widescreen mod:



    Thanks to a strange property of the engine, where it upscales every image it loads, I was able to add configurable sprite sheet scaling. This doesn't just mean double-resolution sprite sheets, but triple, quadruple, and more! With this, an artist could very well make a 1080p Cave Story mod.

    Now, you might be wondering how you'd be able to play such a high-resolution mod, when the game only displays at 480p maximum. Well, the third feature of this Graphics Enhancement Pack is a window size override, so not only can such mods be enjoyed at their intended resolution, but owners of 4K monitors and the like can actually see the game for once. This overrides only the 640x480 option of the DoConfig program, so be sure your copy of the game is set to that, before trying this feature out.

    With all that out of the way, here are the parameters for the mod's settings.txt file:
    Code:
    ; Makes the game run at 60FPS instead of 50, just like the prototype versions
    ; of the game, and Cave Story+.
    60fps = true
    
    ; This is the horizontal component of the aspect ratio.
    ; In 16:9, this would be 16.
    aspect_ratio_x = 16
    
    ; This is the vertical component of the aspect ratio.
    ; In 16:9, this would be 9.
    aspect_ratio_y = 9
    
    ; When this is enabled, the game draws black bars over the out-of-bounds parts
    ; of the screen when in a small room.
    ; Without this, some places look silly, including one of the endings.
    black_bars = true
    
    ; This disables the black bars specifically in the Ironhead boss fight.
    ; This should be useful for mods that repurpose the Ironhead boss room
    ; for something else.
    disable_ironhead_black_bars = false
    
    ; This controls the size of the game window in windowed mode.
    ; At 4:3, 1 is 320x240, 2 is 640x480, 3 is 960x720, etc.
    ; This improves font smoothness in fullscreen, and enables higher resolution
    ; output when combined with remove_sprite_alignment and a high sprite_resolution
    window_upscale = 2
    
    ; This controls the resolution of the game's sprites.
    ; 1 is normal, 2 doubles the resolution, 3 triples it, etc.
    ; For reference, normal Cave Story is 1, Cave Story+'s "New" graphics are 2.
    sprite_resolution = 1
    
    ; This removes a stylistic choice in the original game where all sprites have their
    ; pixels locked to a low-resolution grid, forcing an accurate 320x240 aesthetic,
    ; even when playing in fullscreen on a HD monitor.
    ; That doesn't work so well when using higher-resolution sprites, as they'll seem to
    ; just stutter as they move. It also makes camera movements look kind of stiff.
    remove_sprite_alignment = true
    
    ; This replaces the game's normal fullscreen with a borderless-windowed implementation.
    borderless_fullscreen = false
    
    ; Enables V-Sync, but only in exclusive fullscreen mode (borderless_fullscreen must be off).
    ; Normally, at 60FPS, the game's frame output is pretty unstable, with dropped frames all
    ; over the place. With V-Sync, it's much better.
    ; Note that this will not work if your monitor is not 60Hz.
    fullscreen_vsync = true
    
    ; This forces fullscreen to only display at a multiple of the original resolution,
    ; preventing blurring, but potentially reducing the size of the screen.
    fullscreen_integer_scaling = false
    
    ; With this, the game will automatically detect the aspect ratio of your monitor,
    ; allowing it to fill as much as possible.
    fullscreen_auto_aspect_ratio = true
    
    ; This lets the game detect the most it can upscale the game to fit your monitor.
    ; See window_upscale.
    fullscreen_auto_window_upscale = true
    
    This mod comes with the DLL Mod Loader, so download links and instructions can be found here.
     
    Last edited: Jul 20, 2018
  2. Apr 11, 2017
    zxin
    Perfectionist
    "I'm sorry Mario, but your princess is in another castle."
    Join Date: Dec 26, 2014
    Location:
    Posts: 1248
    Age: 108
    Did you just... I can finally make my 4x res mod? YES!
    Is this compatible with NICE?
     
  3. Apr 11, 2017
    Clownacy
    Senior Member
    "Wahoo! Upgrade!"
    Join Date: Jan 13, 2016
    Location:
    Posts: 54
    I've never tested it. You wouldn't happen to a have a link to where I can find this 'NICE'?
     
  4. Apr 11, 2017
    zxin
    Perfectionist
    "I'm sorry Mario, but your princess is in another castle."
    Join Date: Dec 26, 2014
    Location:
    Posts: 1248
    Age: 108
  5. Apr 11, 2017
    Clownacy
    Senior Member
    "Wahoo! Upgrade!"
    Join Date: Jan 13, 2016
    Location:
    Posts: 54
    A few things are broken. It looks like the file redirection built into the mod loader breaks the audio on the XP splash screen at the beginning, and increasing the game's internal sprite resolution causes both of the images at the start and the end of the demo to shrink.

    That last one is fixable though: open initdraw.lua in the data folder, and change the line 'doukutsu.poke32u(0x48f914, 1)' so that '1' is replaced with the number you set sprite_resolution to in graphics_enhancement's settings file.
     
  6. Apr 11, 2017
    zxin
    Perfectionist
    "I'm sorry Mario, but your princess is in another castle."
    Join Date: Dec 26, 2014
    Location:
    Posts: 1248
    Age: 108
    Cool.
    When you change the screen resolution the information saved to window.rect is wrong. I suggest a way to toggle a modified window.rect writing system, or a way to disable writing to window.rect.
     
  7. Apr 11, 2017
    Miccs
    The Sunset Curse
    "All your forum are belong to us!"
    Join Date: Jul 20, 2015
    Location: Under sea level or something
    Posts: 583
    Age: 19
    Wouldn't that make it easier for new ambitious modders to use cs+ graphics in their mod?
     
  8. Apr 11, 2017
    Noxid
    In my body, in my head
    "Life begins and ends with Nu."
    Join Date: Aug 28, 2009
    Location: The Purple Zone
    Posts: 5941
    It's still against the rules
     
  9. Apr 11, 2017
    zxin
    Perfectionist
    "I'm sorry Mario, but your princess is in another castle."
    Join Date: Dec 26, 2014
    Location:
    Posts: 1248
    Age: 108
    Yes, and now it's easier for them to break the rules.
     
  10. Apr 11, 2017
    Miccs
    The Sunset Curse
    "All your forum are belong to us!"
    Join Date: Jul 20, 2015
    Location: Under sea level or something
    Posts: 583
    Age: 19
    That's exactly the issue, if new members start using this to make mods with cs+ graphics, it'd be quite an issue.
    It'd be better if it were only available for people who wouldn't use those, but having control over that isn't easy either.
     
  11. Apr 11, 2017
    Noxid
    In my body, in my head
    "Life begins and ends with Nu."
    Join Date: Aug 28, 2009
    Location: The Purple Zone
    Posts: 5941
    well then I guess we should just disallow this altogether to save everyone time
     
  12. Apr 11, 2017
    Parkraft123
    Forever 12
    "Big Joe Tire and Battery Restaurant! Opening Soon! Eat at Big Joes!"
    Join Date: May 24, 2013
    Location:
    Posts: 541
    Age: 17
    Legal concerns aside, damn this is really impressive. Cave Story looks amazing in 21:9!
     
  13. Apr 11, 2017
    HaydenStudios
    Okay I give up... for now
    "That dog!"
    Join Date: Dec 31, 2011
    Location: United States
    Posts: 1701
    Age: 21
    This is very impressive, it will be interesting to see if people ever end up coming up with some 4x resolution sprites to put in this. Four years ago, this was just a pipe dream.

    I had a feeling that sooner or later someone else would come along with their own 2x resolution hack. In regards to whether or not this is legal, there's nothing illegal about this. Even though it may instigate some people into wanting to break the rules, Clownacy is free to distribute this mod as long as he's not distributing NICALiS' graphics. When Noxid and GIR made the original 2x resolution hack, they restricted access to it simply because they felt that was the best thing to do, not because of any threats from NICALiS (correct me if I'm wrong). Clownacy is under no obligation to follow suit with how he grants access to this hack, unless the moderation team were to suddenly rewrite the rules of these forums, which I find unlikely.
     
  14. Apr 11, 2017
    Miccs
    The Sunset Curse
    "All your forum are belong to us!"
    Join Date: Jul 20, 2015
    Location: Under sea level or something
    Posts: 583
    Age: 19
    The responsibility of usage of CS+ graphics is still for the individual modder, a good-timed warning somewhere along the way of installing should work well against the issue.
    ...Or at least, mostly
     
  15. Apr 12, 2017
    BLink
    Ready to Live; Ready to Conquer
    "Bleep, Bloop, Bleep, Bloop"
    Join Date: Apr 5, 2013
    Location: In my mind and of my body.
    Posts: 1506
    Age: 21
    If we can get NICE/PEONS, TSC+, and Xin's 0x1000 entity hack into this that would be amazing.

    Also we should call it "chocolate CS" (you know instead of vanilla) and have it be the new base everyone should make mods off of.

    Edit: oh so this plays ogg files as well; at least for music, if they would work for sfx as well then we can have the features of NICE and PEONS at the same time (minus lua support via NICE)
     
    Last edited: Apr 12, 2017
  16. Apr 14, 2017
    X-Calibar
    gigantic immortal dog...?
    "That dog!"
    Join Date: Apr 18, 2006
    Location: Forever wandering the tower...!
    Posts: 1641
    This is very cool.
    Did a quick resize and photoshop filter to test 4k cave story :)
    [​IMG]
    I reduced the size of the screenshot and cropped, but it was originally...
    Code:
    aspect_ratio_x 16
    aspect_ratio_y 10
    window_upscale 13
    sprite_resolution 10
    black_bars false
    Maybe I'll edit it in a video for fun later~
     
  17. Apr 17, 2017
    Shaggester
    Neophyte Member
    "Fresh from the Bakery"
    Join Date: Sep 17, 2016
    Location: In the swooce
    Posts: 9
    Age: 16
    Kinda late to the party, but thanks for releasing this for us modders! This is huge.
     
  18. Apr 23, 2017
    whatthepin
    Senior Member
    "Master using it, and you can have this!"
    Join Date: Dec 24, 2013
    Location: H
    Posts: 72
    Age: 18
    Is there a way to run this mod in fullscreen? If there is, I will love you immensely.
     
    Last edited: Apr 24, 2017
  19. Jun 27, 2017
    Lulink
    Junior Member
    "Fresh from the Bakery"
    Join Date: Dec 7, 2014
    Location:
    Posts: 10
    Yeah it kinda sucks that 3x is too small and 4x is too large for my screen... I have a 1920x1080 screen.
    The mod itself is really impressive, congrats!
     
  20. Jun 27, 2017
    Clownacy
    Senior Member
    "Wahoo! Upgrade!"
    Join Date: Jan 13, 2016
    Location:
    Posts: 54
    Not to be a tease, but I do have an experimental Borderless Fullscreen implementation in the works. I have a video of it in-use here.



    Not only does it make it easier to change between windows while playing - as you'd expect from borderless-fullscreen - but it even fixes the blurry filtering you'd see in the original fullscreen mode. That might vary depending on the PC running it though; I've only tested it on this machine.