com_hunkmegs

Get support for anything JK2 related, find tutorials for in-game and modding topics, and post any suggestions for the site here.
Post Reply
Tsubasa
Posts: 18
Joined: 17 Feb 2016, 00:22

com_hunkmegs

Post by Tsubasa »

There's something I wish to understand about this command and I'm hoping you guys can help me with this.

As I understand it, "com_hunkmegs" tells JK2 how much RAM, in megabytes, to allocate at launch. I've allocated 2048 in the past without issue (a friend even ran it with 4096 as the setting), but lately JK2 has felt rather strict for everyone and will only allocate ~1024. I'm looking at how much RAM I'm using during normal operation and it's sitting at ~2.8GB; the normal limit for 32-bit software is somewhere just short of 3.25, I believe, so my first guess is that JK2 simply can't find much more than 1GB that's empty (since I can allocate that much, I assume some of my used RAM is somewhere only 64-bit can access).

All that said, I've run a few separate instances JK2 without issue (thanks to JK2MV); one dedicated set to 512 and three clients on 1024. Do these instances use the same allocated space or am I missing something? It seems the highest value I can use is 1193.

My friends wanted me to bring this up asap because it looks like 1024 might be too limiting for us now that we're using JK2MV. Specifically, some of us started trying to use custom skins based on community-made JKA models and one such model has proven to be an issue, HapSlash's Anakin Skywalker. The model doesn't load textures on all of the used surfaces if the viewer is running the server from their client and/or the server is on a map larger than ffa_bespin (the model works fine when both circumstances are remedied). It's use is also the only common factor in a number random crashes my friends and I have experienced recently.

Any feedback on this would be appreciated.
User avatar
ouned
Administrator
Posts: 596
Joined: 23 Feb 2015, 13:03
Location: Gliese581c

Re: com_hunkmegs

Post by ouned »

you wot?
com_hunkmegs 4096? lol
JK2 is targeting 64MB and goes up to like 100MB of hunk memory in some rare cases.
That's why JK2MV's default value is 128. Everything above 256 is just wasted.

Dedicated servers need even less memory, the default was 32 in standard JK2...

I guess the issues you are experiencing with JKA models aren't directly related to com_hunkmegs.
Can you upload them?

tl;dr: I don't think your issues are the lack of RAM
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: com_hunkmegs

Post by Daggolin »

As far as I know when jk2 allocates the memory it determines the amount to allocate by multiplying the com_hunkmegs value by "* 1024 * 1024" (cause com_hunkmegs gives the amount of MB and the game allocates bytes). However too big values cause an integer-overflow, so you end up with a negative number (when trying to allocate 2048 MB the game shows an error saying it can't allocate "-2048" MB). If you try bigger values (like 4100) the overflow brings you back into the positive amount of memory to allocate. However those aren't really allocated.
Tsubasa
Posts: 18
Joined: 17 Feb 2016, 00:22

Re: com_hunkmegs

Post by Tsubasa »

@ouned: Here are the skin and the model it's based on:

https://jkhub.org/files/file/752-kyrios ... e-edition/
https://jkhub.org/files/file/1120-hs-anakin-skywalker/

When I started using the Kyrios skin, the first thing I saw was a missing hips texture on the default skin; the 'team' skins were missing their face textures. I then messed with the skins by combining head_a1, lower_a2 and torso_f1 into a single file, but while that setup works fine in JKA, the face often loses its texture in JK2. A friend of mine uses a personal skin based on the same model; he couldn't see his face texture right away the first time he connected to my server (I think because I was using the same model at the time), but it showed up fine after he bumped up his hunkmegs.

@Daggolin: Interesting, though I'm not entirely sold just yet. I've launched JK2 successfully many times with a setting of 2048, it never failed me in the past. That said, I'm pretty sure I was running WinXP Home Edition the last time it worked; I never tried higher than 1024 when I moved to Win7x64 because I opted to go with conventional wisdom, which I thought was a quarter of the available system RAM (after googling the matter, turns out it was half). Now I'm on Win10x64 and most of my friends are on Win7x64, and it seems no one on these OS' can run the game with more than 1GB as the value.
Kevin
Administrator
Posts: 393
Joined: 07 Jun 2015, 08:36

Re: com_hunkmegs

Post by Kevin »

Even though it might not cause issues for you, JK2 will usually never use more than 128 (Or 256 max on bad optimized maps), as Ouned said, so it is useless to set it that high :)
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: com_hunkmegs

Post by Daggolin »

Which version of jk2mv are you using? JK2MV 1.1 doesn't support the "head_a1", "lower_a1", ... feature of jka, yet. If you have issues using jka skins on jk2mv I suggest you try one of the latest development builds (https://jk2mv.org/builds). There have been a lot of changes since JK2MV 1.1. ;)

As you said you have issues running jk2mv with more than 1024 hunkmegs I tried it out myself and I was able to use 2047 as value. :/
Tsubasa
Posts: 18
Joined: 17 Feb 2016, 00:22

Re: com_hunkmegs

Post by Tsubasa »

About the skin, what I meant was that I had merged those files into one so I could use a specific look in JK2. I took the three specified files and merged them into a new model_default.skin file.

The hunkmeg thing is something I'm experiencing with and without the MV, so I don't believe it has anything to do with what might be going on (hence why I posted this in Help/Suggestions). Thinking about it though, 2047 could've been the value I used back when I was on XP. If that's the case, I probably just generalized it as 2GB because it reminds me of why '31' and '255' are caps for other game-related things.
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: com_hunkmegs

Post by Daggolin »

It would still be nice to know your exact jk2mv version, as well as seeing a screenshot or two of the issue.
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: com_hunkmegs

Post by fau »

Code: Select all

extern int s_hunkTotal;
(…)
cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS, CVAR_LATCH | CVAR_ARCHIVE | CVAR_GLOBAL );
(…)
s_hunkTotal = cv->integer * 1024 * 1024;
(…)
s_hunkData = (unsigned char *)calloc( s_hunkTotal + 31, 1 );
s_hunkTotal is a signed integer. On most 32 and 64 bit compilers it's a 32-bit signed variable, with max positive value 2^31 - 1, after that it wraps to negative numbers.

Setting com_hunkmegs up to 2047 should work fine and it does on my system. Go slightly over that and it will try (an fail) to allocate negative ammounts of memory. If you can't allocate more than "1193" then it's your OS/compiler limit. Set com_hunkmegs 4300 for a nice placebo boost.

Posting all these because you seem curious.
You won't make anyone raise the limit unless you present a reproducible bug caused by it.
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: com_hunkmegs

Post by Daggolin »

I just tried that hs_anakin on ffa_dmf_v2, using jk2mv 1.1-47 (https://jk2mv.org/builds), com_hunkmegs 128.

The models worked just fine. I only got warnings when I tried "/model jedi_anakin/|head_a1|torso_a1|lower_a1", cause it seems that a buffer hits exactly 64 characters (which is the maximum that fits in). It worked anyway.
Tsubasa
Posts: 18
Joined: 17 Feb 2016, 00:22

Re: com_hunkmegs

Post by Tsubasa »

The version I'm using is still 1.1.

@ouned: Shortly after that post I was using 1192 as the setting for a little bit, but it failed once later in the day; closed a folder I previously had open and it launched successfully afterward which leads me to believe I didn't have that much available at the time. I've switched from using the package installer to the portable x64 variant and 2047 seems to work fine on that one (will do repeat tests as I go). Thanks for the info.

@Daggolin: I just tried using the model on all of the default maps and I'm having consistent texture issues on ffa_deathstar and ffa_imperial while connected to a dedicated server. I'm also having consistent issues on every map I try when I host a server from client. Tested both 1024 and 128 as the setting, used /model hs_anakin and kyrios, and the server version was 1.04.

Since a few posts ago, I'm pretty convinced that the model issue is near-completely unrelated to RAM. The only significant difference between my recent tests and the time my friend signed on using the same model is that I've been alone while he signed in with additional players already there (and I happened to be using the same model at that moment). That's also when the crashes I mentioned became somewhat abundant; everyone had installed the two skins in question and suddenly some of us would crash randomly while performing normal actions (like opening the player menu, initiating a duel, or using /model to change models/skins).

Edit: Tried launching both the installer package and the portable x64 variants with 2047 as the setting. The former consistently fails while the latter consistently works, so I'm pretty certain at this point my earlier 'cap' of 1193 was just a matter of how much of the first 3.25GB was being used (the lowest amount of RAM my system has used thus far is 2.6GB while awake but mostly idle).
Kevin
Administrator
Posts: 393
Joined: 07 Jun 2015, 08:36

Re: com_hunkmegs

Post by Kevin »

Tsubasa wrote:The version I'm using is still 1.1.
Try one of the latest development builds, as Daggolin suggested :D
Daggolin wrote:I just tried that hs_anakin on ffa_dmf_v2, using jk2mv 1.1-47 (https://jk2mv.org/builds), com_hunkmegs 128.

The models worked just fine. I only got warnings when I tried "/model jedi_anakin/|head_a1|torso_a1|lower_a1", cause it seems that a buffer hits exactly 64 characters (which is the maximum that fits in). It worked anyway.
Tsubasa
Posts: 18
Joined: 17 Feb 2016, 00:22

Re: com_hunkmegs

Post by Tsubasa »

Just tried the portable x64 variant of 1.1-48 and it looks like the missing texture issue has been resolved somewhere along the way. I ran a client-hosted server and loaded ffa_bespin, ffa_deathstar, ffa_imperial and every custom map in my folder; not one texture on that JA model failed to show.
church
Posts: 9
Joined: 03 Oct 2015, 15:13

Re: com_hunkmegs

Post by church »

I see that you guys are referencing DMF_v2 on this forum... I have been trying to play it on 1.02a but it doesn't work. I remember this being an issue from even when the map was first released. There was something that needed to be removed / added from the actual file to make it work. Does anyone remember??? It was really simple...
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: com_hunkmegs

Post by Daggolin »

I suggest installing patch 1.04 and jk2mv (https://jk2mv.org) instead of modifying the pk3 of ffa_dmf_v2. JK2MV lets you play all versions of jk2 (1.02, 1.03 and 1.04) and it brings lots of bug fixes and other security improvements. It should be running far more stable that jk2mp 1.02 and I have actually played ffa_dmf_v2 with current versions of JK2MV.

JK2MV also lets you downloads maps directly from servers running JK2MV (if those servers allow it). You would simply get a menu like this asking you if you want to download the map: Image
Post Reply
Created by Matti from StylesFactory.pl and Warlords of Draenor (modified by jk2.info)
Powered by phpBB® Forum Software © phpBB Limited