Page 1 of 5

Hugor request/improvement - for RealNC

Posted: Sun May 26, 2013 6:10 pm
by Ice Cream Jonsey
EDIT: Latest versions of Hugor:

http://www.joltcountry.com/downloads/hu ... indows.zip
http://www.joltcountry.com/downloads/hu ... -linux.zip
http://www.joltcountry.com/downloads/hu ... or-mac.zip

___

Hey Nikos --

Question for you. I copied my work in progress (Cyberganked) to a new laptop. I did not "install" Hugor, I just used the copy that I rename cyberganked.exe.

When I started it up, it did not start in full screen. It started in a window that was a square. I hate to guess what it started out as. 800x800 maybe?

The problem is that Cyberganked is not really designed for a window that small. I could (and should!) recognize a small window and tell the user to make it bigger. I will do that, now that I think about it. But is there any way for:

1) Hugor to default in full screen mode the first time it opens
2) Hugor to default to full windowed mode the first time it opens
3) Hugor to read a text file with what length and width it should open to?

I'm curious as to your take on it. I forsee a lot of people buying this game when it's done and I would hate for their first experience to have a screwed-up picture.

Posted: Mon May 27, 2013 5:00 am
by RealNC
That's a "no" to all three questions. The introduction of an *.ini file where the game can override default settings is actually in my TODO list. Something like:

Code: Select all

[geometry]
startFullscreen = true
fullscreenWidth = 1000
marginSize = 8
(etc...)
It should probably also keep these settings separate from the generic ones (changing a setting in a game that comes with an ini file should not affect other games, and vice versa.)

Posted: Mon May 27, 2013 8:49 am
by Ice Cream Jonsey
Cool. As I get closer to releasing this, I'll get Hugor's code running and if you haven't added functionality for that, I'll do it.

Posted: Tue May 28, 2013 12:05 pm
by RealNC
I've implemented initial support for this. It's here:

http://foss.aegean.gr/~realnc/hugor/tes ... -05-28.zip

The ini file has to be named "hugor.ini" and it's case sensitive (important for Linux.) It currently has the following format:

Code: Select all

[Display]
; Application name.
; If this is set, authorName must also be set.
appName = My Game

; Author/organization name.
; If this is set, appName must also be set.
authorName = My Name

; Start in fullscreen mode.
fullscreen = true

; Maximum display width in fullscreen mode.
; The value is in pixels.
fullscreenWidth = 900

; Hide the menu bar.
hideMenuBar = true
The key names are not case sensitive. One thing to watch out for is that appName and authorName are used for saving preferences (that's the registry on Windows). This makes any changes the user makes to the various configuration dialog settings exclusive to this game. So if you change those keys, you will be creating new Windows registry entries each time. Also note that both of those keys must be either set or not set (because both are needed for constructing a valid registry key.) You can also use double-quotes for those string values.

More keys can be added to hugor.ini. Maybe font sizes? What else? We can go crazy here with ideas (unless they're too much work to implement :-P)

Posted: Tue May 28, 2013 2:28 pm
by Roody_Yogurt
I haven't looked at it yet, and I'm sure it works great. I just wanted to note, though, that when I was envisioning this, I thought the *.ini file that Hugor looks for would share the name of the game file, especially since I figured this kind of game-optimization would be used a lot when hugor.exe is also named after the game file.

Posted: Tue May 28, 2013 2:54 pm
by RealNC
The problem is that this approach is already taken by Gargoyle, so we'd have a conflict. You're shipping a "nextday.ini" yourself in "The Next Day", for example.

A solution might be an underscore suffix. (Like "mygame_hugor.ini", but that makes even less sense than just "hugor.ini".)

Posted: Tue May 28, 2013 3:09 pm
by Roody_Yogurt
Ah, yes, that is a good point. On one hand, I think Hugor's configuration file system is more important than Gargoyle's; in the past, I have used Gargoyle's .ini system to weakly enforce color schemes for some of Robb's games or, as in the case of The Next Day, to make sure the screen was wide enough (in retrospect, I should have just made the game complain if the screen isn't wide enough... and I'll probably do that in a future release now). Given what Hugor can do for the presentation of a game, I would say it's a bigger priority.

Still, I can understand the hesitance towards overlapping .ini usage. Maybe Hugor's current approach will be fine.

Posted: Tue May 28, 2013 5:17 pm
by Ice Cream Jonsey
RealNC wrote:I've implemented initial support for this. It's here:
Gonna download this right now and try it out!
More keys can be added to hugor.ini. Maybe font sizes? What else? We can go crazy here with ideas (unless they're too much work to implement :-P)
Ah yes, could we please! Font sizes for proportional and fixed is pretty important for me as the graphics in my games require the fonts to be of certain sizes so that they would look correct.

I can't thank you enough, Nikos, I really appreciate this.

Posted: Wed May 29, 2013 2:35 am
by RealNC
Roody_Yogurt wrote:Ah, yes, that is a good point. On one hand, I think Hugor's configuration file system is more important than Gargoyle's
The worst part is that we can't have a combined ini file. For example adding a "[Hugor]" section to a Gargoyle *.ini. That won't work because Gargoyle's "ini" files aren't actually ini files. They use a custom format that's incompatible with standard ini-file parsers. It would have been more appropriate for them to have a ".cfg" suffix rather than ".ini".

Also, we can't really ignore Gargoyle and try to claim "gamename.ini" for ourselves, because that would leave authors with no way to provide both Hugor and Gargoyle configuration files at the same time (many people do prefer Gargoyle, especially for text-only games.) And it would confuse Gargoyle anyway if it tries to load a "gamename.ini" that's actually intended for Hugor.

However, one way around the issue would be to drop the ".ini" suffix and go for something else. Maybe *we* could pick the ".cfg" suffix instead?

Posted: Wed May 29, 2013 10:35 am
by Roody_Yogurt
RealNC wrote:However, one way around the issue would be to drop the ".ini" suffix and go for something else. Maybe *we* could pick the ".cfg" suffix instead?
Yeah, that'd be reasonable. Another alternative would be to use an extension like ".hugor" or something. I also looked up ".hgr" but that is used by some Apple II graphics format (while I'm not really worried about Hugor clashing with Apple II, "hgr" seems reasonably generic enough that other stuff out there probably uses it, too).

Posted: Wed May 29, 2013 12:51 pm
by RealNC
I've uploaded a new dev snapshot:

http://foss.aegean.gr/~realnc/hugor/tes ... -05-29.zip

Instead of "hugor.ini", it now looks for "<basename>.cfg". The defaults specified in the cfg file only have an effect if the user didn't already run the game at least once. So if any changes to the standard preferences dialog are made, those will be kept. This only applies to cfg entries that are configurable in the preferences dialog.

Another change is the use of the appName string instead of "Hugor" in the title bars of the preferences and quit confirmation dialogs.

Oh, and "hideMenuBar" is now working correctly.

I've also added more options to the cfg. The new format is:

Code: Select all

&#91;Identity&#93;
; Application name.
; If this is set, authorName must also be set.
appName = My Game

; Author/organization name.
; If this is set, appName must also be set.
authorName = My Name


&#91;Display&#93;
; Start in fullscreen mode.
; true or false.
fullscreen = false

; Maximum display width in fullscreen mode.
; The value is in pixels.
fullscreenWidth = 900

; Hide the menu bar.
; true or false.
hideMenuBar = true

; Left/right margin in pixels.
marginSize = 40

; Size of proportional-width font.
; The value specifies a point size, not pixels.
propFontSize = 13

; Size of fixed-width font.
; The value specifies a point size, not pixels.
fixedFontSize = 4

; Use a bilinear filter when scaling images.
; true or false.
imageSmoothing = true


&#91;Media&#93;
; Pause audio when application loses desktop focus.
; true or false.
backgroundPauseAudio = true

Posted: Wed May 29, 2013 2:42 pm
by Roody_Yogurt
I gave it a try. It's looking good. Under Windows 7, though, I'm finding that changes to the .cfg file aren't being recognized unless you alter the appName/authorName fields (creating a new registry entry). Hmm, that gives me an idea...

(goes and runs Hugor as administrator, just to make sure that isn't affecting the registry-writing)

Hmmm, no, the problem is still there.

Posted: Wed May 29, 2013 3:47 pm
by RealNC
Roody_Yogurt wrote:I gave it a try. It's looking good. Under Windows 7, though, I'm finding that changes to the .cfg file aren't being recognized unless you alter the appName/authorName fields (creating a new registry entry).
As mentioned in the post, settings already present in the registry will override those from the cfg. Otherwise the user's preferences would get lost between restarts.

Unless you meant something else entirely...

Posted: Wed May 29, 2013 4:15 pm
by Roody_Yogurt
Ok, I missed where you said that was the intended behavior, but I disagree with it being the best behavior. I think it'd be better if the player could continue to tweak the .cfg file until the environment is exactly like how he or she wants.

Ok, I guess I get what you're saying, that even though that, having run it once, I can't change the settings from the .cfg, changes made within Hugor after the fact are kept in that game's registry setting.

Hmm, no, that doesn't seem to be the case, having tested it now, so yeah, I think it'd be better if .cfg info overrode the registry settings.

Posted: Wed May 29, 2013 4:22 pm
by Roody_Yogurt
Ok, the problem was that both when I used the default .cfg template (where appName was MyGame) and my edited one where I just commented out that and authorName, my changes were recognized once and then were ignored from then on.

Having edited appName and authorName to use quoted strings like recommended earlier in the thread has fixed the problem. Now changes between versions of my .cfg file are being recognized.

Posted: Wed May 29, 2013 4:32 pm
by Roody_Yogurt
Also, just want to say that starting a game instantly in fullscreen is so badass.

Posted: Wed May 29, 2013 4:34 pm
by RealNC
Yes, if appName and authorName are not defined, then the general Hugor registry settings are used. So for the game to have its own settings, appName/authorName are mandatory.

Posted: Mon Feb 02, 2015 12:24 am
by Ice Cream Jonsey
So it looks like there's been 33 commits since the last release on Github for version 1.0.

Nikos, would it be possible to create a new release with all the changes since then? 1.01 perhaps?

I'm going to try to make one-click download solutions for my games for Mac, Linux and Windows, but it looks like IF Wiki is pointing people to a version which doesn't have .cfg support among other things.

(I think 2015 is the year I try to get absolutely everything updated for Hugo. It's killing me that I don't have the latest compilers for Linux and Mac on the IF Archive, but I'll deal with that ASAP.)

Posted: Mon Feb 02, 2015 12:28 am
by RealNC
Yeah, I'm way behind on that stuff (got a programming job, so I guess you know how that works out for hobby programming projects :-P)

I'll try and put something together soon.

Posted: Mon Feb 02, 2015 2:28 pm
by Ice Cream Jonsey
I can attempt to make releases as I have a Mac and Mint machine. I am just worried that I'm using a different library someplace than expected and I essentially ruin everything for everyone, of all-time.