Author Topic: Save game in Windows 7  (Read 4476 times)

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Save game in Windows 7
« on: 2010-09-26, 07:05:36 PM »
Hi guys!

Long time since I posted a message for an error!

One of my alpha version testers is on windows 7.  And when the tester gets to a save point the game crashes.  On XP, the game saves in (for example):
Code: [Select]
C:\Documents and Settings\Vincent\Application Data\Scrolling Game Development Kit\LokRevival\1.0.0.0\1.sav
I don't have windows 7.  But my tester tells me that suck a path doesn't exist in windows 7.  "Documents and Settings" is like "Documents" only.  Can someone with windows 7 take a look at this?  Since I don't have win7, I can't test it.  And my alpha tester being in Slovakia, it makes a hell of a ride to get there and test it!  :crazy:

Thanks a lot!  ;D
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: Save game in Windows 7
« Reply #1 on: 2010-09-26, 08:47:40 PM »
I believe windows 7/vista use C:\Users\Administrator\AppData instead.

Why not save to the games directory?

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #2 on: 2010-09-27, 07:23:51 AM »
Hi Jam0864!

Well I'm using the built in sgdk2 save and load features.  I guess it was designed that way because it's the most clean location to save app data files.  Maybe there's a notion of rights for the application to save data in a precise folder.  I guess the system usually agrees that an app saves stuff in app data, but that might not be the case in the game folder.  Honestly I don't know.

But yeah, at first my idea would be to change the save/load feature to save in the game folder (or a subfolder called "savegame" or something)

Maybe durnurd or bluemonkmn could enlighten us? :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #3 on: 2010-09-27, 12:51:44 PM »
I looked in Microsoft .NET framework online docs and it seems that the method "System.Windows.Forms.Application.UserAppDataPath" used to save and load games does not support Windows 7.  The most recent version of windows supported by .NET FW 2.0 is Vista.  It seems, even .NET FW 3.5 does not support W7 actually, we would need .NET FW 4.0 for it to function properly...

Unless some else has another idea, I'm gonna change save and load features to use the local game folder.

Thanks! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Save game in Windows 7
« Reply #4 on: 2010-09-27, 05:31:43 PM »
Lucky for you, I recently got Windows 7 at work and at home, and have started using it as my primary OS.  (I am in the process of compiling and testing SGDK2 on Windows 7 for the first time, but haven't spent much time on it lately.  Still don't know how well games work in 64-bit Windows 7, but hopefully later tonight.)

I created a very simple application on Windows 7 using Visual C# 2010 Express, and made it target .NET 2.0.  When I call Application.UserAppDataPath, I get the value "C:\Users\Ben\AppData\Roaming\Microsoft\WindowsFormsApplication1\1.0.0.0".  Also, I have learned that even applications that *do* look in C:\Documents and Settings\ will find what they are looking for on Windows 7 (even though the directory doesn't exist) because it simulates the path for backwards compatibility, it seems.  If you type the address into the address bar of Windows Explorer in Windows 7, it will show you a "fake" listing of files from another directory (like the one I listed above).

But that should not be an issue because I can't even make UserAppDataPath return Documents and Settings on .NET 2.0 on my system.  Where did you see that it is not supported in Windows 7?


bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Save game in Windows 7
« Reply #5 on: 2010-09-27, 05:46:43 PM »
I just ran a test (no substantial modifications to SGDK2 code, just a few updates that I have made un-related to Windows 7 I think), and I had no problem saving and loading games using my CleanGame project.  It appears the file went into:
C:\Users\Ben\AppData\Roaming\Scrolling Game Development Kit\CleanGame\1.0.0.0

Perhaps your tester is running in an environment with very limited permissions?

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #6 on: 2010-09-27, 06:20:29 PM »
Hi bluemonkmn!

I found this page:
Code: [Select]
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.userappdatapath%28v=VS.80%29.aspx
That tells what is this function does in the .NET FW 2.0 and the list of supported OS:
Code: [Select]
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Maybe you have .Net FW 4.0 installed and the call to this function takes the 4.0 version and it works because of that?  I don't know, I didn't get to see the error and I'm still waiting for a screenshot of the error.  All I know is my tester got the error while saving and I don't see why it crashes other than this.

I'll keep searching. 

Thanks! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Save game in Windows 7
« Reply #7 on: 2010-09-27, 08:46:05 PM »
1. I was looking at this page http://msdn.microsoft.com/en-us/library/system.windows.forms.application.userappdatapath.aspx, which says it is available in all versions of windows and all versions of .NET.  I think you are looking at old .NET documentation that was created before Windows 7 existed.

2. In my test program, I targeted .NET 2.0.  And I think SGDK2 will use the same version of the framework no matter which OS the games are compiled on.  So I don't think the problem results from targeting a different version of the framework.

Hopefully you can get more help from your tester, or find another tester who experiences the same problem.  If you need help writing test programs, let me know.

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #8 on: 2010-09-28, 07:04:50 PM »
Hi bluemonkmn!

Thanks for doing all these tests for me! :)  It's really appreciated! :)
I guess the problem is the security.  I asked my tester to allow the game to run with admin rights (I heard it's possible in win7).  Maybe that will solve the problem.   I'll keep you informed.

Thanks again! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #9 on: 2010-09-29, 12:58:42 PM »
Well I'll be damned!  It's been a while since I did tech support and I lost the habit: it shows.  :-[

Meaning that it ain't a bug at all: my tester simply didn't know how to save the game properly!  Now that I explained how to do it, it started working.  "Never take for granted the way your app works: always explain everything."  :P

I'm very sorry bluemonkmn to have you make some tests for nothing.  My humble apologies!   :-[

The good news: everything works just fine on win 7 just like bluemonkmn said.

Thanks everyone!  I'll be more perceptive next time. :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Save game in Windows 7
« Reply #10 on: 2010-09-29, 09:03:11 PM »
No worries.  I completely understand how that happens.  I was testing SGDK2 under Windows 7 anyway, so it was no big deal.  Now I see there's a problem in the rule editors because it does not properly load the SGDK2Tmp.dll file.  So I do have something to work on, when I get a moment.  Glad you worked out your problem -- I guess your beta testing is doing its job -- pointing out where further instruction is necessary :).

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 612
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Save game in Windows 7
« Reply #11 on: 2010-09-29, 09:15:15 PM »
Great!  I'm glad you're not angry. :)

Thanks again!
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com