HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: player.ini  (Read 1086 times)

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
player.ini
« on: Oct 06, 17, 02:35:39 PM »

Thusfar, we have been storing and retrieving local player preferences in their Local Repository Cache via the client-side external functions SaveLocalRepositoryData() and LoadLocalRepositoryData() respectively.  However, that means that if we put out a new version of the LRC for download, their settings are wiped out.  We would prefer to store them in a text file but are unsure how.

I see there is a file in the install folder called player.ini which has lines in it as such:

[Graphics]
Fullscreen=1

It seems like that would be an ideal place to put user settings, but I don't know how or even if we can access it via HeroScript. I cannot find any reference to is in the HeroWiki.

Does anyone have any insight into this?

As a fallback, I can imagine we can write our own external functions to write to and read from a text file, but it would be nice if this was already available somehow.
« Last Edit: Oct 06, 17, 02:37:28 PM by FI-ScottZ »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: player.ini
« Reply #1 on: Oct 06, 17, 02:51:05 PM »

I have found there are these "Settings" functions:

http://hewiki.heroengine.com/wiki/Settings_functions

although there is no documentation on them, either in the wiki or the _ExternalFunctions script.  I guess I can use those, but I still would like to know where they get stored.

When I tested it out in HeroBlade, I did not see any file getting made or modified in the HeroBlade installation folder.
« Last Edit: Oct 06, 17, 02:53:03 PM by FI-ScottZ »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

GlorianLanTarini

  • General Accounts
  • *
  • Posts: 148
    • View Profile
Re: player.ini
« Reply #2 on: Oct 07, 17, 01:16:38 AM »

Hello, Scott.
How about this algorithm?

  • The client checks LRC for settings.
  • If settings exist - load and apply them, else call server.
  • Server check for user settings backup in system area which stores all users settings backups.
  • If sys_area has the backup - return it to the client, else - return None.
  • If the client received backup node - restore settings in LRC and apply them. If the client received None - this is first (or clean) installation - create settings from scratch, and set them to default values.
  • Send settings changes to the server for storing in sys_area every time when client apply new settings.

It is simple and effective. And I use something very similar for user language settings. Only, I don't call to the server if it can't find LRC settings, but take user OS language as default.

By the way, this algorithm allows the user to use same settings on different computers. And you can decide which settings are hardware-independent, and which are not. Excellent for key binding and player's macros (if you allow it).
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: player.ini
« Reply #3 on: Oct 08, 17, 09:34:28 PM »

Thanks for that idea, GlorianLanTarini.

But I was wanting to not have the settings affect the LRC at all. I found that the "Settings" external functions do not affect it, so that is what I went with, with good results.

Agreed, some settings would be good to store server side for migration to other computers. But this application is more for things that will often be specific to one's current hardware, like dealing with resolution, volumes, etc. Those things a user might want to be local to a particular pc setup and not used at every pc they log in with.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.