Forum posts

Posted 1 year ago2022-08-12 16:41:05 UTC
in allocblock full Post #346775
Compile with the -chart parameter and you'll see exactly how much AllocBlock you're using.
You can do so by entering the Expert compile dialog and adding -chart after the last " there (make sure you selected $bsp_exe first!):
"$bspdir/$file" -chart"$bspdir/$file" -chart
(notice that there's a space too)

Also make sure your map has no leaks. Then we can start talking.

AllocBlock will get full depending on the number of surfaces in your map, and their texture scales (in the texture application tool). If you have a low texture scale like this:
User posted image
DON'T DO THAT on large surfaces. For small things like signs, it is acceptable, but please don't use it on floors, walls and stuff like that. Use a regular, normal texture scale of 1.0 on those. In some places, you might wanna use 2.0 or 4.0 (like canyons/cliffs). Smaller texture scale means AllocBlock will get filled faster.

If that still doesn't help, you can try increasing the texture scale on ceilings and some walls, and start removing some details. More polygons/faces means more AllocBlock will get filled too.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2022-08-11 12:03:08 UTC
in Make level change triggers work in multiplayer? Post #346771
In triggers.cpp, roughly around line 1460, you'll see this:
void CChangeLevel :: ChangeLevelNow( CBaseEntity *pActivator )
{
    edict_t    *pentLandmark;
    LEVELLIST    levels[16];

    ASSERT(!FStrEq(m_szMapName, ""));

    // Don't work in deathmatch
    if ( g_pGameRules->IsDeathmatch() )
        return;

    // Some people are firing these multiple times in a frame, disable
    if ( gpGlobals->time == pev->dmgtime )
        return;

    pev->dmgtime = gpGlobals->time;
Simply removing these will NOT actually do it:
// Don't work in deathmatch
if ( g_pGameRules->IsDeathmatch() )
    return;
Instead, you should modify it like this:
// Yes, work in deathmatch
if ( g_pGameRules->IsDeathmatch() )
{
    CHANGE_LEVEL( m_szMapName, nullptr );
    return;
}
In singleplayer, it changes the level with regards to a landmark, equivalent to calling the changelevel2 console command.
This doesn't work in multiplayer, so for that, we pass nullptr to the landmark parameter, which is the same as using the changelevel console command. This means your player(s) will spawn at info_player_deathmatch points in the next map and won't actually carry over smoothly.

You can't do a smooth singleplayer-style transition in multiplayer, if that's what you're looking for.
Admer456 Admer456If it ain't broken, don't fox it!
By the way, while investigating this issue I did a test and found out that func_wall entities do not cast shadows on the world, while func_detail did. Is this behavior expected? I thought they were mostly the same.
Brush entities (except func_detail) get ignored by HLRAD, unless you set ZHLT Lightflags to something like "Opaque + concave fix".
The 2D views still struggle when too many elements are rendered, though.
Maybe J.A.C.K. could render it a tad faster.
Admer456 Admer456If it ain't broken, don't fox it!
One simple cube brush has 6 vertices. A room made out of 6 brushes will end up having 6 vertices, as the BSP compilers will strip out the unseen faces (assuming there are no leaks), also assuming that it is 240x240x240 units or smaller.

The limit for brushes (individual brushes) is 32768. Their faces will get culled away and only the faces that are visible in-game will remain, so you don't see the backfaces if you noclip. This counts all sorts of brushes, non-entity and entity brushes alike.

The limit for brush models (solid entities etc.) is 512. If you have too many, for example, unique func_walls, you're gonna run out of brush models. A brush model is really just a group of brushes associated with an entity.

The vertex limit is also 32768, and if you have 50k faces, it's not hard to reach, esp. if a lot of these faces intersect, creating cuts on the underlying surfaces, thus creating new pairs of vertices too. Vertex count is calculated only after BSP filling and BSP splitting. (or maybe during it)

I specifically mentioned 240 units in the beginning, because every 240x240 texture pixels, there will be a new face too. If you have a very large surface, you'll get quads every 240x240 units, if the texture scale is 1.0. That also contributes to the number of vertices. If texture scale is 0.5, those cuts will happen every 120x120 units and so on.
Admer456 Admer456If it ain't broken, don't fox it!
I mean yeah, LeafThread is part of VIS, so that's VIS. LeafThread specifically tries to "connect" the boundaries of each VIS room to another, basically determining visibility.
Admer456 Admer456If it ain't broken, don't fox it!
I am seeing some pretty rocky shapes around here:
User posted image
You might wanna convert those to func_detail. I am guessing VIS is the phase that takes the most time? In which case, yeah, you should definitely use func_detail.

Whenever you have a non-entity brush, you should be aware that it essentially subdivides the space around it. So if you have an 8-sided cylinder in a room, it'll subdivide that room's space into 8 separate "rooms", which makes sense to the compilers, even though the player (and the mapper) perceives it as a single room. This causes the compilation to take a looot longer than really necessary.

I'll provide some illustrations soon.

Edit:
Here's one map with func_detail and func_wall:
User posted image
And here it is without them:
User posted image
Another example:
User posted image
User posted image
The map compiles pretty fast on my i5-8400, maybe all within 5 minutes.

Anything that shouldn't contribute to visibility calculations (i.e. details) should be func_detail or func_wall, depending on certain things. But generally it's func_detail.
Admer456 Admer456If it ain't broken, don't fox it!
"Ambiguous leafnode content" is merely a warning. It's basically the compiler saying "Hmm, I can't figure out if whatever's in front of this surface is solid or air, this mapper really made some funky geometry". It'll help greatly if you post some screenshots of the map.
Admer456 Admer456If it ain't broken, don't fox it!
You should write a tutorial about it here on the TWHL Wiki!
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2022-05-31 21:12:34 UTC
in Map have low fps, which not have any leaks Post #346584
Hmm, what's your graphics card?
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2022-05-31 15:55:37 UTC
in Map have low fps, which not have any leaks Post #346581
Based on the compile log, your map doesn't have too many polygons, but your low framerate might potentially be because of dynamic lights. Have you placed any lights in the map that have an Appearance? (e.g. flickering, candle, fade etc.)
Admer456 Admer456If it ain't broken, don't fox it!
Are disappearing things entities like func_wall? Chances are, you're hitting the 256 visible entity limit, though... this shouldn't really be true any more cuz' I've seen one of Trempler's maps having over 2000 visible ents lol

But anyway, make sure to turn on developer 2 and check the console for anything like "Max entities in visible packet list". If you're hitting that, it means it's time to start reducing the entities in your map.

Also please post more high-res screenshots, with the affected brushes centered in the 2D views.

Edit: I've just read, yeah, the disappearing ents are item_generic. You're most likely running into that limit, or their origin is potentially inside a brush. Double-check the latter.
Admer456 Admer456If it ain't broken, don't fox it!
You have a leak, you gotta fix that first. Read a little bit about leaks in these couple of guides:

https://twhl.info/wiki/page/Tutorial%3A_How_to_fix_those_leaks
https://twhl.info/wiki/page/Tutorial%3A_Pointfiles

In short, follow the line from the reddest point to the bluest one, until you encounter either one of these 2:
1) the line is going through a gap into empty space outside the map (seal the gap)
2) the line is going through a brush itself:
  • the brush is either invalid (fix it)
  • or it's part of a brush entity (turn it into world, or put brushes behind it)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2022-05-03 19:30:05 UTC
in Programming video tutorials Post #346490
Phew, finally, we got another one:
Vector maths
Also forgot to post this one:
Enhancing existing entities
Admer456 Admer456If it ain't broken, don't fox it!
Yep.
User posted image
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-04-18 17:59:13 UTC
in Env_beam sparks not appearing on func_train Post #346452
You're welcome :3
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-04-18 13:22:53 UTC
in Env_beam sparks not appearing on func_train Post #346450
Chances are, the train's origin is inside the wires themselves as it's moving, so the sparks don't appear at all. Have you tried making a beam where it sparks in the air?

If you have and it didn't work, then take into consideration that the rate of sparking depends on the "Life" and "Strike again time" properties. This is how it works according to the code in the Half-Life SDK:
if ( m_life != 0 )
{
    if ( pev->spawnflags & SF_BEAM_RANDOM )
        pev->nextthink = gpGlobals->time + m_life + RANDOM_FLOAT( 0, m_restrike );
    else
        pev->nextthink = gpGlobals->time + m_life + m_restrike;
}
(m_life = "Life", m_restrike = "Strike again time")
Meaning if you set Life to 0 (or not set it at all), it'll never automatically spark.

If you set "Life" to some positive value, that means the beam will be turned on for a while, then off. When it gets back on again, depends on the "Strike again time".

If you wanna avoid the flickering that'd happen because of that, my guess is that you could set "Life" to some negative value, like -0.1 and "Strike again time" to something like 0.2. That way, you'll get 0.1 seconds between each spark.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-04-16 11:26:38 UTC
in arkanos2 - hldm map Post #346440
Very nice! I like the details & lighting.
Having it in the TWHL Map Vault would also be pretty cool.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-03-13 14:18:07 UTC
in Patched a leak but level still at fullbright? Post #346340
Potentially, you might have a very very bright light, or you don't have any lights, or you aren't running HLRAD, or you're opening the map before HLRAD finishes.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-03-06 15:49:45 UTC
in Help with custom weapons. Post #346324
You can start by reading here: Weapons Programming - High-Level Overview
Existing weapons are typically located in the dlls folder in the SDK, here's the crowbar for example:
https://github.com/ValveSoftware/halflife/blob/master/dlls/crowbar.cpp

Do keep in mind that implementing new weapons will require a bit of C++ programming experience.
Admer456 Admer456If it ain't broken, don't fox it!
Oh my. This is wonderful.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-02-13 13:42:35 UTC
in Post Your Photos Post #346281
It's interesting that you both think of locations from HL2, cuz' Bosnia is relatively pretty darn close to Bulgaria. It would make for a good HL3 setting lol.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-02-12 15:07:46 UTC
in making a monster entity with its unique model Post #346277
In a nutshell, you'll need to make a custom mod and learn some programming. You can refer to the post above for more details.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-02-08 19:42:56 UTC
in Post Your Photos Post #346269
inhales
It's been 8 months since my last photos. Time for a slew of new ones. I'll also put nicknames which my cousins and I came up with for certain places and events.
March 2021 - "Spear Dojo"March 2021 - "Spear Dojo"
Recently, we threw spears around here. We'd basically hang some sorta target on the branches and throw spears at it.
August 2021 - "Sunset after the rain: Angle 1"August 2021 - "Sunset after the rain: Angle 1"
August 2021 - "Sunset after the rain: Angle 2"August 2021 - "Sunset after the rain: Angle 2"
August 2021 - "Sunset after the rain: Angle 3"August 2021 - "Sunset after the rain: Angle 3"
January 2022 - "Hill of Good Hope"January 2022 - "Hill of Good Hope"
If there's a Cape of Good Hope, there's a Hill of Good Hope. Context: we almost fell down there.
May 2021 - "The busiest road in Ošanjići"May 2021 - "The busiest road in Ošanjići"
On average, 3 whole cars per hour.
January 2022 - "The stealth area"January 2022 - "The stealth area"
Often, we'd hide around here, telling our parents we're not away from home, even though we actually kinda are.
January 2022 - "Hill of Good Hope, another angle"January 2022 - "Hill of Good Hope, another angle"
I've actually shown how this looks in May. Here it is again for comparison:
User posted image
December 2021 - "A foggy Mostar morning"December 2021 - "A foggy Mostar morning"
That's about it for now. See y'all in 6 months.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-02-02 20:37:34 UTC
in Half-Life Updated (custom SDK) Post #346246
Go to multiplay_gamerules.cpp, around line 500, look for CHalfLifeMultiplay::FPlayerCanTakeDamage.
//=========================================================
//=========================================================
bool CHalfLifeMultiplay::FPlayerCanTakeDamage(CBasePlayer* pPlayer, CBaseEntity* pAttacker)
{
    return true;
}
Simply replace return true; with this:
return !pAttacker->IsPlayer();
This will affect the deathmatch gamemode.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2022-01-23 12:19:52 UTC
in Quake (alias) models in Half-Life Post #346224
Take a look at this maybe:
https://valvedev.info/tools/raven/

It's got alias model rendering stuff.
Admer456 Admer456If it ain't broken, don't fox it!
That's because the tutorial was originally written for Sven Co-op, and Svengine (modified GoldSRC) has higher limits.
Admer456 Admer456If it ain't broken, don't fox it!
That happens because the server isn't transmitting those entities to the client. func_detail merges with worldspawn in the end, so it's visible along with world brushes.

There is a function in client.cpp in hldll that allows you to control which entities get sent to the clients, something like AddToFullPack. You'll need to additionally determine if the env_sky can see the other entities, and if so, transmit them. At least I think.

Be careful though, because you can only transmit a maximum of 256 entities.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-27 14:18:12 UTC
in game crashes if i shoot a tracer Post #346169
What HL SDK did you use? I am guessing halflife-updated as a base.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-27 10:11:59 UTC
in game crashes if i shoot a tracer Post #346166
Try compiling the SDK without any view bobbing changes, and make sure you're running the latest version of Half-Life on Steam, and make sure you placed the DLLs into a mod folder in the right places. Which exact steps did you take while following that tutorial?
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-26 23:20:05 UTC
in game crashes if i shoot a tracer Post #346164
Did ya compile both the client DLL and the game DLL? (hl_cdll and hldll projects)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-26 18:34:09 UTC
in Programming video tutorials Post #346161
College and exams messed up my schedule a bit, but, I finished a new video this evening:
Finally getting to the more fun stuff. :walter:
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-17 19:19:55 UTC
in Changing a texture's palette Post #346126
I am guessing you've already managed to export the texture as a BMP or PNG file and it's 8-bit (indexed). If you haven't and don't know what the latter means, I'll explain. But anyway, let's say you're using GIMP and you got your texture with its palette.

In GIMP, you'll go to Windows -> Dockable Dialogs -> Colormap.
You will see something like this:
User posted image
On the left side, you can clearly see the palette and its 256 colours. From then onward, changing the palette is quite simple. You can right-click on one of these colours and click "Edit Color".

There's just one problem: if you want to change multiple colours, like, all the blue ones into red, it's gonna be tedious because you'll have to modify every colour that looks like the one you wanna replace (there are multiple blues in my case, and multiple greens, kinda hard to put my finger on the line there). For that, you can use fresco's suggestion. Once you import the texture into your image editor, you switch the mode to RGB, which will get rid of the 256-colour palette and let you do whatever you want.

If you want to change colours that way, you can select an area, and go to Color -> Hue-Saturation, and play with the hue setting:
User posted image
There is no easy way TBH. It all depends on what exactly you wanna do, and some types of edits will be simpler than others. You gotta practice to get the results you need, maybe for a couple of months or something. There will be pain and frustration along the way, but it's worth it IMO.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-12-01 19:29:43 UTC
in Half-Life Updated (custom SDK) Post #346093
I stopped using the VS2017 project files last year. I haven't seen anybody use them lately.
On that note: to use the CMake version of Half-Life Updated you currently have to build the INSTALL target to deploy the libraries, which might be a bit cumbersome and annoying.
Not a problem for me, though I imagine it'd be a bit confusing/frustrating to beginners.
Admer456 Admer456If it ain't broken, don't fox it!
Note:
The ? symbol is an inline if.
This line here:
result = condition ? a : b;
...is the same as:
if ( condition )
   result = a;
else
   result = b;
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-11-05 13:40:21 UTC
in One of my first maps Post #346033
You could, and perhaps should, upload this to the TWHL Map Vault:
https://twhl.info/vault/create
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-11-02 13:53:42 UTC
in Programming video tutorials Post #346029
The channel's focus is HL modding and game development with a Quake-style workflow. I don't think running marathons is something I'd know how to make tutorials about... I mean, the longest I've ever run without stopping was, like, 300 metres? Definitely not marathon material.

On a serious note, Marathon is a bit out of my interest zone, so I doubt I'll be making videos about it anytime soon. Same goes for Doom 1/2 etc.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-28 19:26:28 UTC
in Programming video tutorials Post #346020
Miraculously, I was able to finish a video this month, despite college.
Finding other entities
Yep, it's about UTIL_FindEntityByTargetname.
Admer456 Admer456If it ain't broken, don't fox it!
This post was made on a thread that has been deleted.
Posted 2 years ago2021-10-26 18:23:54 UTC
in Setting Player view direction (c++) Post #346010
I'm asking cuz' VectorAdd should work fine with vectors.
#define VectorAdd(a,b,c) \
{ \
   (c)[0]=(a)[0]+(b)[0]; \
   (c)[1]=(a)[1]+(b)[1]; \
   (c)[2]=(a)[2]+(b)[2]; \
}
Since the Vector class has the operator [ ], you can access its XYZ components with [0], [1] and [2] respectively, thus, VectorAdd will work perfectly fine.
Vector myVector = Vector( 20, 40, 50 );
// Alternatively: Vector myVector{ 20, 40, 50 };
VectorAdd( pparams->viewangles, myVector, pparams->viewangles );
The only reason you'd use * and (float*)& might be due to something like this:
void MyFunction( Vector* someParam )
{
   someParam->z += 20.0f;
}
...
Vector myVector{ 0, 0, 0 };
MyFunction( &myVector );
But I'd rather not do that. I'd rather pass the vector by reference instead of passing a pointer to it:
void MyFunction( Vector& someParam )
{
   someParam.z += 20.0f;
}
...
Vector myVector{ 0, 0, 0 };
MyFunction( myVector );
That way, you don't need to use pointer syntax. ^^
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-26 16:33:51 UTC
in Setting Player view direction (c++) Post #346008
"unfamiliar with C++"
It's less about knowing the language, more about knowing HL SDK. I think it's an okay solution, given the messy nature of the SDK.
view.cpp itself has a lot of "C-style" code, so I wouldn't even call it C++.

But, semantics and philosophy aside, I'm glad you got the desired effect.

Edit: Though i'm curious why you're doing *ev_permpunchangle and (float*)&ev_permpunchangle. You're not using a pointer to ev_permpunchangle, are you? The code would be cleaner if you did it differently, such as using a reference in the function parameters (Vector&) or something like that.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-26 10:01:22 UTC
in Setting Player view direction (c++) Post #346006
I think it's more or less the result of the client fighting the server. Client is like "Hey, I'm looking at this angle", and the server is like "No no, you're looking at THIS angle".

If you really wanna modify the view angles, you're way, waaaaay better off doing it on the clientside (hl_cdll project). What is it specifically that you want to achieve? I'm guessing some kinda custom recoil, but I could be wrong.

Edit: oh right, permanent view adjustments. So it's gonna be like punchangle, except it doesn't fall back to the original angles.
That's gonna be a bit more involved, but it's still doable on the clientside, thanks to something called weapon events. You'll find them in ev_hldm.cpp.

I'd provide some example code, but it's been a while so I don't remember how to force update view angles on the client. :|
Either way, you might also wanna take a look at view.cpp (don't be frightened by the messy code; V_CalcRefdef is the function you might wanna look at)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-26 07:09:12 UTC
in Setting Player view direction (c++) Post #346004
You gotta set m_pPlayer->pev->fixangle to 1 if you wanna force view angles with pev->v_angle.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-24 22:21:40 UTC
in Programming video tutorials Post #345996
It's a fox.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-24 12:07:12 UTC
in Programming video tutorials Post #345993
A fellow Resolver! <3
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-23 19:04:38 UTC
in Programming video tutorials Post #345989
TBH there's hardly any documentation for anything in the SDK, apart from some archives.

In other news, there's a new video in progress and I more or less finished editing it. ;3
User posted image
It's gonna be about string_t and UTIL_FindEntityByTargetname.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-20 18:01:09 UTC
in Programming video tutorials Post #345982
Yeah, I suppose I could jam it somewhere in here:
User posted image
Or, maybe better, that could be part of HL SDK Extras. We'll see!
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-16 14:23:49 UTC
in Programming video tutorials Post #345976
Well, I do have plans for a Source series, once the GoldSRC one is more or less finished.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-10-01 08:06:16 UTC
in Programming video tutorials Post #345965
Custom keyvalues and save-restore. ^^
Part 2.3
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-09-22 09:27:33 UTC
in Hello All! Post #345950
Welcome back! It looks like de_bedroom is on TWHL as well. :)
Admer456 Admer456If it ain't broken, don't fox it!