Windows 10 - compatibility mode

I am just starting beta testing on a major project and it seems I have to run in Windows 7/8 compatibility mode to get acceptable performance on Windows 10. Is this a known restriction?

When I run the compatibility troubleshooter, it says the program is not compatible and suggests other settings.

A combination of 7 or 8 compatibility with 256 colour mode seems to work on the machines I have available to test on. 

Latest build:

https://www.dropbox.com/s/06dtsdmz7mn4a0v/setup.exe?dl=0

Any news on this? I have a provisional release date for Steam Early Access on 13th August and this is quite a key issue that I need to resolve one way or the other. 

The game makes liberal use of SQLite and openSSL.

I suspect this is an OpenGL driver performance problem on your machine.  You reducing the color quality of the window to 256 color proves it.

We have tested Corona built Win32 apps fullscreen on Windows 10 and the performance has been very good.  But like I said above, performance depends on how good your OpenGL driver is.

For example, I have a Windows 10 laptop where the performance the performance is great when running fullscreen on the laptop’s primary monitor, but the performance is laggy when running fullscreen on the secondary monitor.  There isn’t much we can do about that.  Especially since we’ve proved that the enterFrame are happening on that secondary monitor on-time.  The OpenGL driver was simply rendering late onscreen.  The only way to resolve something like this on our end is to eventually add Direct3D support to Corona in the future.  Direct3D is what Microsoft uses to render the desktop, and if it performs well, then it would perform well in a Direct3D game too.  However, Direct3D support is not something Corona Labs plans to do in the near future.

But that said, I wouldn’t worry too much about it.  There is currently one Corona made Windows game (“Royal Heroes” from Elite Games) that has been on Steam since February.  I’ve kept tabs on that game and it’s been doing fine.  The only noteworthy issues I’ve seen is people who’ve updated their older PC to Windows 10 can lose OpenGL driver support since the GPU manufacture might not provide updated drivers.

I like to check things out when people upload or provide demos etc. I myself have begun experimenting with Win32 desktop and have my own issues I am dealing with. Nothing like you’re describing though. 

Anyway I downloaded your game to test it on my work computer (win10) to see what I experience. I am unsure what your app does at specific times but there are issues that do not change (for me) even with compatibility mode and/or downgrading the color setting.

Startup: On startup the “loading…” portion takes about 3-5 minutes, which seems excessive. I am not sure what it is doing but it is very slow.

Main Menu: Clicking new game and leaving the default options attempts to create the game. A “creating database” portion appears and again takes a long time, 2-3 minutes, before I get a progress bar.

Progress Bar: This I honestly lost track. After 5 minutes and not half-way through the bar I began doing other things. I came back 15 minutes later and it was stuck at 98%. I did see a partial error on the bottom left that said something was nil. It was mostly cut off so can’t provide more information on that.

I am unsure what could be going on with your game. If I build my current project for win32 it runs without performance issues at all on this work computer (my win32 issues are cosmetic in nature). I notice you said your using SQL and OpenSSL, which I do not use either in my projects. Perhaps the problem lies there for the performance issues I see.

So there you have it. I was just offering my experience with your game. Not exactly good news but I get the feeling it’s not OpenGL but something else your game is doing. My projects on this same machine run without performance drops.

To give you some confidence regarding how well Corona built Win32 apps perform, try giving @ponywolf’s desktop apps a go.

   https://ponywolf.itch.io

Just as a note, Josh didn’t develop that game. He was just using it as an example of games that run on desktop. You should certainly forward your notes to the actual developer, Elite Games. Below is their forum profile if you’d like to send them a PM.

https://forums.coronalabs.com/user/306053-efgamesnet/

I think you may be confused with my post. My response was to Nick (which I am of the impression it is his game in the OP). I only mentioned OpenGL in my post because Josh said it was a possibility that was his issue. On my machine, my projects perform fine, the original posted game, does not. 

I am not sure who Elite Games are or how they relate to Nick or Joshua’s posts. If I am confused, I apologize!


OK I re-read Joshua’s post. He mentioned Elite Games game already on Steam. I get it. Sorry we both got confused. I was originally posting to Nick, but did not quote and you thought I was posting about Elite Games. Gotcha. 

GQbdruK.gif

Thanks for the feedback guys. The game absolutely flies on my Macbook Pro and Macbook Air, both in the Simulator and OSX builds. It also works fine on Windows virtual machines on both these.

It’s just so random, on a £150 netbook running Windows 10 performance is ok, then on a quad-core machine it can crawl as Anderoth describes. 

The “Loading…” message on startup should show for less than half a second, ‘Creating Database’ the same. All the loading portion is doing is looking up to a lua table and finding between 18 and 92 records, and then drawing the menu. The creating database bit is loading around 20-30,000 records into a lua table from a 250,000 record indexed SQLite table. 

A new game should take between 30 seconds and 2 minutes to create depending on the year chosen. 

When on a machine that’s running it slowly, I look at CPU usage, and it’s not high - around 10-15%. So it’s not like it’s running at full pelt and just can’t keep up, something else is holding it back. Disk speed could be an issue as the game dynamically saves progress.

Looks like I’m going to have to measure every block of code and see where the bottlenecks occur on slower systems.

Is your PC using a traditional hard drive and not a solid state drive?  Perhaps that’s the difference between your Mac and PC… and it may be a disk I/O performance issue.  (Although you setting the color quality to 256 should not be factor here.)

SQLite tends to open/close the file per transaction.  So, if you’re doing a lot of SQL queries/transaction on startup, then you’ll want to reduce the number of transaction to improve disk I/O performance.

For INSERTS, UPDATES, and DELETEs… it’s best to do all of those queries as a single transaction via “BEGIN TRANSACTION” and “END TRANSACTION”.

For SELECTs, depending on your table design, you can significantly improve performance by loading all rows from a table into memory and then pick & choose the rows you want from memory.  Now, this only makes sense if you can guarantee that this table will not be super huge, but this is a technique enterprise software makers do since querying from RAM is faster than from disk.

Oh and in case you don’t already know, the best way to measure performance in Lua is like this…

local startTime = system.getTimer() -- Do something... print("Duration: " .. tostring(system.getTimer() - startTime) .. " ms")

Our Lua system.getTimer() is accurate to 0.1 milliseconds on Windows because it takes advantage of Microsoft’s high precision QueryPerformanceCounter() native Win32 API.

Ok, I’ve discovered something strange. I found a machine where the hanging occurs, which has up-to-date OpenGL drivers on Windows 7.

If I run the app through Corona Simulator, it performs fine on this machine. If I then build it, and run from the ‘Corona Built Apps’ folder, it runs fine.

However, as soon as I move the files to c:/program files (x86) or c:/program files, either manually, or via a installer file, performance drops significantly, to something in the order of 5-10% of normal performance.

Does Windows treat programs that run from these locations differently?

Had a couple of other testers confirm this issue - installing outside of program files vastly improves performance. 

I tested this for Nick also and found it runs fine outside the standard program files folder. I also found that setting it to “run as admin”, it runs fine even when inside the program files folder. 

I have tried my app installed in the program files folder and it performs normally. However again I am not using SQL or OpenSSL. My only access to anything is standard loading of assets and saving a small settings file. Not sure exactly everything you’re exe is doing, Nick. I see there is a zip plugin dll, so you are also using compression somewhere. Something your exe is doing or using is making Windows require elevated security to run properly. I don’t think anything standard in Corona SDK will cause these problems.

That’s all I got. Though I don’t know much about Win32 programming. :smiley:

Thanks for your feedback! The zip plugin is in there but the functionality is disabled at the moment. My publisher is apparently in discussions with microsoft about certification so hopefully I won’t have to stump up £100+ myself :slight_smile:

The only thing I can think of is perhaps your app is trying to write to the “system.ResourceDirectory”?

On Windows Vista and newer OS versions, the “Program Files” directory is read-only and handled specially.  If your app attempts to write to this directory, Windows will instead write to a hidden mirrored “C:\Users\<UserName\AppData\Local\VirtualStore” directory instead.  This will definitely cause a performance hit and should be avoided.  The idea is that apps should never write to their own installation directory since it can cause install/uninstall/upgrade issues with install programs.  So, when you run your app under “Program Files”, check to see if your app is adding any files under this “VirtualStore” directory.

Thanks, I’ll look into that. Although I don’t directly write to any of the SQL databases in resourceDirectory, I guess opening them will attempt to make temporary changes to the file unless I specify read only. 

Okay.  I think I may know what’s going on here.

I’ve confirmed that opening a SQLite database file in a read-only directory (such as Program Files) does cause a 2 second hang.  The reason is due to a limitation of the Lua SQLite3 API.  It’s sqlite3.open() function will always attempt to open the database file with read/write permissions, which causes a 2 second hang on Windows if the file is not writable, it’ll fallback to opening the database file as read-only.  The limitation here is that the Lua SQLite3 API does not offer a read-only option.

So, as a quick solution, I would suggest that you copy your database file from your system.ResourceDirectory to your system.DocumentsDirectory.  Not ideal, but that’ll solve the performance issue that you’re seeing.  The following link shows you how to copy a file from one directory to another in Lua.

   https://docs.coronalabs.com/daily/guide/data/readWriteFiles/index.html#copying-files-to-subfolders

Thanks Joshua. I’m already copying a few files across that do get edited, so I’ll just copy the whole lot across on Windows.

I’ll implement it tomorrow morning and let you know if that solves the problem completely.

Feel free to change the thread heading if you can, as this might be useful for people and it didn’t turn out to be a Windows 10 problem.

I can confirm that copying all SQL files to be accessed for read only purposes by the app into documentsDirectory allows the game to run perfectly from Program Files :slight_smile:

Thanks everyone!