How to change the window size of Cave Story+


I'd like to play Cave Story in a small-ish window taking up about 1/4-1/2 of my screen. In the options I set it to window, and the screen scaling to "sharp" which appears to give me the approximate play size I want. Only one problem: the window is still taking up the whole screen, just now it's blank borders. I'd like to remove these border areas.

How can I change the window size of Cave Story+?

Best Answer

I know this post is three years old, but in case someone else ends up here who is looking for an answer, please see my post on the Steam forums.

I took some time to copy/paste my original thread from the Steam forums and format it for stack exchange:

The default window size of Cave Story+ is way too big (in my opinion), and even though it can be manually resized by clicking and dragging, I'd rather not mess with that.

Disclaimer: I'm working with a monitor resolution of 2560x1440, so this may or may not work well for users on lower resolutions (e.g., 1920x1080). However, you can experiment with the x/y values of the window size, and also setting the game to "stretch" instead of "sharp" to see if that makes any difference.

To that end, I have been working on figuring out a way to have the window automatically resize to specified parameters. I believe that I have a couple decent solutions; you can choose between AutoHotkey and NirCmd methods (I prefer AutoHotkey because it seems to work better with process names when defining window sizes).

With AutoHotkey (easiest method)

  1. Download my pre-compiled AutoHotkey executable
  2. Place Cave Story+ (Window Mode).exe in steamapps\common\Cave Story+ directory

  3. Skip to the bottom section, "To add as a Non-Steam game"

With AutoHotkey (manual method)

  1. Download/install AutoHotkey
  2. Start Cave Story+ and access the game options menu

  3. Change Screen Type to Window

  4. Change Screen Scaling to Sharp

  5. Close Cave Story+

  6. Navigate to the Cave Story+ directory in steamapps\common

  7. Right-click / New / AutoHotkey Script called "Cave Story+ (Window Mode)" (without quotes)

  8. Open the script in notepad and paste the following:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    Run, steam://rungameid/200900
    Sleep, 3000
    WinMove, ahk_exe CaveStory+.exe, , 0, 0, 1296, 955
    WinWait, ahk_exe CaveStory+.exe
    CenterWindow("ahk_exe CaveStory+.exe")
        WinGetPos,,, Width, Height, %WinTitle%
        WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)
  9. Save the script

  10. Either run the script directly (or create a shortcut to it), or, you can add it as a Non-Steam game (see below)


  1. Start Cave Story+ and access the game options menu

  2. Change Screen Type to Window

  3. Change Screen Scaling to Sharp

  4. Close Cave Story+

  5. Navigate to the Cave Story+ directory in steamapps\common

  6. Right-click / New / Text Document called "Cave Story+ window mode" (without quotes)

  7. Open the text file and paste the following:

    nircmd win hide ititle cmd.exe
    start steam://rungameid/200900
    nircmd wait 3000
    nircmd win setsize process CaveStory+.exe 0 0 1296 955
    nircmd win center ititle Cave Story+
  8. Save the document as a batch file (File / Save As then add .bat at the end of the file name; e.g.: Cave Story+ window mode.bat

  9. Download NirCmd (scroll to the bottom of the page)
  10. Unzip nircmd.exe into the Cave Story+ folder (you only need the one file, nircmd.exe)

To add as a Non-Steam game (launch from within Steam)

  1. Open Steam, go to the Library

  2. Click "+ ADD A GAME..." at the bottom-left of the screen

  3. Choose "Add a Non-Steam Game..."

  4. Click "Browse"

  5. Navigate to the Cave Story+ folder and choose Cave Story+ (Window Mode).exe (if using my pre-compiled executable), or CaveStory+.exe if using AutoHotkey manual method or NirCmd method

  6. Click "Add Selected Programs"

If you are using my pre-compiled executable, you are done at this point. You should be able to launch Cave Story+ (Window Mode) from your Steam library. If using one of the other two methods, continue on:

  1. In the Library, right-click on the duplicate CaveStory+ entry (will have the space removed) and choose "Properties".

  2. Change the name to something meaningful, like "Cave Story+ (Windowed)" or something similar

  3. Click "Change"

  4. Change File Type to "All Files (.)"

  5. Choose "Cave Story+ window mode.ahk" if using AutoHotkey, or "Cave Story+ window mode.bat" if using NirCMD (note: you can also compile the AutoHotkey script you made so that you have .exe instead of .ahk, but this doesn't really matter)

  6. Click "Open"

  7. Click "Close"

Now you can launch Cave Story+ from your Steam library with a custom window size. To change the window size, edit the batch file you created and change the two numbers at the end of this line:

    nircmd win setsize process CaveStory+.exe 0 0 **1296 955**

1296 represents x size whereas 955 represents y size. Cave Story+ runs at an odd aspect ratio of 1.296, so keep that in mind if you change the window size, as different aspect ratios will result in black bars on the image. Other window sizes of this aspect ratio include:

656 503 1296 955 1616 1184

Using these numbers will give you an image without black borders, but you can experiment with different resolutions if you want.

Also, if for some reason the game window is not resizing properly, try increasing the 3000 value (in either the AHK or NirCmd scripts) to 4000 or 5000:

    Sleep, **3000**
    nircmd wait **3000**

To automatically center windows using SDL environment variable

This is something you can do which will make the process of centering the window a little bit smoother. My scripts will automatically center the window, but adding this environment variable will ever-so-slightly speed up the process. It will affect all windows using SDL (not just Cave Story+) as it involves adding an environment variable. The easiest way to do this is as follows:

  1. Create a new text document

  2. Open it and paste the following:

    REM Defines environment variable to center SDL windows if undefined
    if defined SDL_VIDEO_CENTERED (
    ) else (
        setx SDL_VIDEO_CENTERED 1
  3. Save this document as a .bat file (batch file)

  4. Double-click the file and run it. It will automatically set the environment variable.

If you were using the AutoHotkey manual method, you can remove this portion from the script:

    CenterWindow("ahk_exe CaveStory+.exe")

        WinGetPos,,, Width, Height, %WinTitle%
WinMove, %WinTitle%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2)

If using NirCmd, remove this line:

    nircmd win center ititle Cave Story+

Well, there you have it. This method may work with other games, as well, but I've only tested with this one so far. Hope this helps someone.