Check out Half-Life Re-imagined competition results!
Check out Skewing textures in Hammer, our newest tutorial!
Say hello to akn, our newest member!

logo

Site Stuff

Reference

Maps

Community

ShoutBOX

Poll

Feeling Blue

What's your favourite shade of blue?

Azure

15

Cobalt

32

Turquoise

10

Cyan

11

Royal

9

Teal

3

Onliners

5 secs

UrbaNebula

22 secs

akn

5 mins

The Mad Carrot

11 mins

Screamernail

11 mins

Dr. Orange

21 mins

Windawz

28 mins

potatis_invalid

Affiliates

A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Half-Life Enhanced

<< ... 3 4 5 6 7 [8]

Forums > HL Engine Discussion

01 Sep 17, 13:13
By JeffMOD
avatar
Call 141.12
Parenting would be really useful to have - That's one of the main reasons people still use Spirit of Half-Life despite it being so buggy. HL:Enhanced having it would be a huge selling point.
10 Sep 17, 07:16
By Solokiller
avatar
Member
I looked into this a bit more, i'll have to disable the engine's code in SV_Physics to stop it from wasting a bunch of CPU cycles and calling functions at the wrong time.

I can't do this using normal methods so i'll have to write a platform-specific hack to overwrite the return address passed to StartFrame so that it returns to wherever SV_Physics was called from.
This is assembly stuff so it'll be difficult, but it's not impossible.

Fortunately both SV_Physics and StartFrame are functions taking no parameters and returning nothing so it's pretty simple.

Something like this would probably do the trick:
Quote:

void* pReturnAddress;

__asm
{
mov pReturnAddress, [ebp + 16]
mov [ebp + 8], pReturnAddress
}


Where ebp + 16 is the location on the stack containing the return address for SV_Physics and ebp + 8 is the location for StartFrame's return address. The actual offsets will need to be determined for all platforms but once that's done it should be pretty straightforward.

For future reference:
https://stackoverflow.com/questions/1317316
2/how-to-replace-the-return-address-on-th
e-stack-using-a-buffer-overflow-attack

https://stackoverflow.com/questions/1263021
3/modify-return-address-on-stack

http://insecure.org/stf/smashstack.html

I'm going to ask Alfred if they can add in a callback for custom physics but i can tell you right now that's highly unlikely, but i can at least try.

Also, there has been talk of XML exploits using custom entities (not the kind you're probably thinking about) that allows for exploits, this can be disabled in Xerces-C: https://www.owasp.org/index.php/XML_Externa
l_Entity_(XXE)_Prevention_Cheat_Sheet#lib
xerces-c


So when this gets implemented in HLE this will need to be disabled.

While this is unlikely to cause problems in HLE due to mostly server side XML files, it could still happen if a malicious server downloads such a file to clients, who then run it locally and end up with crashes and instabilities.
20 Sep 17, 21:33
By Solokiller
avatar
Member
I've added some feature tracking stuff to the wiki: https://github.com/SamVanheer/HLEnhanced/wi
ki/Game-integration


Should make things easier for when this all gets added. If i've missed anything, feel free to add it or let me know about it.
21 Sep 17, 13:54
By Shepard62700FR
avatar
Member
Download Solokiller's Model and Sprite viewers for Windows x64 (built in September 21th 2017) @ MediaFire.

Also included with the binaries are "Kratisto's MDL decompiler from Milkshape 3D" and "DoomMusic's StudioMDL that fixes the UV shifting problem with textures and other stuff".

If you want a 32 bits version and/or another host than MediaFire, just let me know.
21 Sep 17, 19:06
By Solokiller
avatar
Member
Thanks for providing this smile - :)

I've written down a bare bones description for a new feature i've come up with to add some flexibility: https://github.com/SamVanheer/HLEnhanced/wi
ki/Filter-system


Basically identical to Source's filtering system, only a bit more powerful due to not locking you into checking activators only. There will also be an option to add your own filters through scripting, once that stuff is implemented.

You'll notice that i refer to inputs a few times, that's because i'm planning to implement an I/O system using Angelscript.
I won't be able to integrate it into the map file itself due to various issues (no map editor support, no .map/.rmf support, no compiler support), but it will be possible to add this using Angelscript.
It'll be a bit clunky but at least we'll have it available.

Regular trigger support will eventually be reworked into calling a default input like Source does where it calls into Use(), converting the parameter value into the appropriate use type (as in trigger_relay's "Trigger State" keyvalue, most other entities will use toggle).

I might add a way to specify outputs using the XMLized version of map configs, basically like using Source's AddOutput input in usage where you manually specify the options. That should be easy to use, though it could end up messy.

As with most features this would require source code access to fully implement in map files, unless a separate IDE were to be made and the data embedded into the BSP file or somehow paired up (mapname.io file perhaps), but the only way to make it simple is full integration into the map editor. There's also the issue of save/restoring filters, especially if using custom entities.

The ultimate purpose of this is to have control over game events like so:
Quote:

player->trigger_multiple{targetname=door_tr
igger}(Trigger)->filter_multi->[filter_ha
s_item(Test, item_keycard)->filter_item_property(Test, item_keycard, color, red)]->[func_door(Open), trigger_multiple{targetname=door_trigger}(K
ill)]


This probably makes little sense so i'll walk through it:
Quote:

player triggers trigger_multiple named door_trigger
trigger_multiple trigger filter_multi to check if the player has an item called item_keycard and if that keycard has a property "color" with the value of "red"
If both match, open the red door and remove the trigger_multiple


filter_has_item and filter_item_property could be custom entities here.
22 Sep 17, 13:17
By foxtrop
avatar
Member
any chance we get the fullbright rendering for the textures on the models?
22 Sep 17, 13:42
By Solokiller
avatar
Member
That's an engine level feature, i'd have to completely re-implement model rendering to add that.
23 Sep 17, 07:10
By tschumann
avatar
Member
Quote:
That's an engine level feature, i'd have to completely re-implement model rendering to add that.


Too bad - the client-side stuff seemed to provide a lot of flexibility with regards to model rendering.
23 Sep 17, 07:47
By Solokiller
avatar
Member
It ultimately calls into the engine to do the actual rendering, and the fullbright flag isn't checked there. There is code that checks r_fullbright, but nothing for the per-texture flag.
23 Sep 17, 16:28
By SourceSkyBoxer
avatar
Member
Hello @SoloKiller,

I ask about Half-Life Enhanced since I play it. Nice work! It works like Sven Coop. I am sorry. I don't want call again because you hate your hostile ex team.

1. Can I write angel script for env_model? If yes than I will try.
2. Can I write angel script for env_sky ( like sky_camera from Source Engine ) If not than I would like you have to add feature OpenGL into Angelscript?
Is it correct or wrong? Link Does it support for Half-Life with angel script? If no than.... How do they add reflection of water with MapInit() from angel script? I am sorry for bad English.
23 Sep 17, 17:49
By Solokiller
avatar
Member
What do you mean by env_model?

And no, you can't implement an env_sky for multiple reasons.

The first is that it requires client side scripting to do anything graphical, which is a pain in the ass to implement because it's missing callbacks. I may be able to hack it in using memory patching similar to how AMX mod hooks into stuff like cvar change events, assuming it doesn't trigger VAC. I'll have to ask Alfred about that, assuming he responds at all.

The second is that you can't override the engine's skybox rendering, so you'd have to handle rendering entirely in the client dll. As with everything in this engine that's a lot of work and possibly even illegal since replicating that code is against the EULA.

The code you linked is from a utility library that doesn't show how it's integrated into programs, if used in HLEnhanced you'd still need additional scripting API support to actually use it.

Even then it still depends on engine level code for things like supported features, since OpenGL context creation requires a version to be set first, and that's impossible to do from the client since that all happens before client code executes.
Though the linked code seems to be immediate mode only - which should always be supported - if you want it to run well you'll need shaders, which requires a newer OpenGL version than what is guaranteed to be provided.
The SDL documentation for this doesn't say which OpenGL version is used by default, so i'm assuming it uses whatever the OS chooses by default, which can be anything depending on your video card, drivers, OS, etc.

Reflection isn't easy to add either because that usually works by rendering the entire scene for the reflected plane, which while possible still requires the use of things like render-to-texture support to store off the reflection for rendering in the main scene. With all the above problems solved this one should be perfectly possible though.

Perhaps i should write a book's worth of reasons why we need the engine open sourced and send it to Valve, i'm getting tired of this turning into "spend half your life rewriting half the engine into Half-GoldSource while breaking half the copyright laws".
23 Sep 17, 17:56
By James Luke
avatar
Member
I mean, PARANOIA works with the latest Half-Life version, just with some tweaks, an no skyboxes due to the depth-range setting from the hacked .dll. Look at ARRANGEMENT, albeit it’s all hacky, it works just fine. Just cross-platform and legality stands in the way.

env_model was a newer feature from SOHL which is essentially Source’s prop_static. It’s probably the easiest from the list to implement.

I think he misunderstands how AngelScript works and what it’s limitations are.

Also, you can do whatever you want, or you can submit a pull request if you think what you add makes HLEnhanced better.
23 Sep 17, 20:05
By SourceSkyBoxer
avatar
Member
@Solokiller
env_model is like prop_static or cycle like @James Luke explained..
So sad, I can not make render like reflection into Angelscriptz, Do I understand correctly?

But PARANOIA 's env_sky looks bad like Cry of Fear - Since it happens common behind background if you move near to sky wall like Garry Mod's bugged sky_camera.


That is why I really don't like PARANOIA's source because it uses only glaux.h and is incompatibility to newest version my display card ( December 2016 , AMD Radeon RX 480 )

I didn't make criminal because I hold carefully.
24 Sep 17, 00:19
By James Luke
avatar
Member
Oy, SSB, do we have to go over this again?

Source =\= GoldSource. What about that do you not understand?

Reflection requires some pretty advanced OpenGL stuffs ON TOP OF a rewritten OpenGL renderer. Also, env_sky wasn’t terrible, it was much better than the SOHL one. But Garry’s Mod implementation of env_sky (or its respective name) is completely different except for its core principle.

Also, what’s with this glaux.h stuff again? It also used the standard includes, if you graphics card is newer than 2008, it should work, you just have to modify the code to not use the .dll. If it isn’t, get a new graphics card, it’s about time.
24 Sep 17, 07:08
By Solokiller
avatar
Member
Using a custom opengl32.dll for stuff like this isn't an option for at least 2 reasons.

1: the engine removes it if it exists.
2: VAC may ban you if you use it on a VAC secure server. This has happened to MSC players using a bloom mod in the past.

We need engine level support to do it safely.
24 Sep 17, 11:12
By SourceSkyBoxer
avatar
Member
Yeah you're right. I want safe too. You know that I never use criminal engine.
24 Sep 17, 16:29
By Solokiller
avatar
Member
https://www.reddit.com/r/programming/comme
nts/725bbw/an_indepth_explanation_of_how_
a_10_year_old_bug/?st=j7yy7b5y&sh=34a8e6c
d


Useful for anybody wanting to learn how to reverse engineer stuff.
25 Sep 17, 00:37
By James Luke
avatar
Member
That video was a trip.
29 Sep 17, 16:14
By Solokiller
avatar
Member
https://www.reddit.com/r/cpp/comments/733s
51/cppcon_2017_herb_sutter_meta_thoughts_
on/?st=j860uiw7&sh=700119b5


This talk is about an advanced metaprogramming proposal for C++. It won't be available in mainstream compilers for half a decade at least, but it applies to game development in a big way. It would make save/restore, keyvalues, schedules, networking and a lot of other stuff a lot easier to implement.

Note that it's an advanced subject, so if you don't have much experience with C++ you probably won't make sense of it.
03 Nov 17, 16:19
By Solokiller
avatar
Member
I just committed a bunch of code cleanup changes to master.

It's mostly changing pev-> uses to use the CBaseEntity accessor methods, but i've also cleaned up some of the documentation for methods, usually when it was duplicated.
I've also done a small amount of refactoring to make the code a bit safer to use in some cases.

Most of this is preparation for work to be done later, i'll explain that when i'm sure i can actually do that stuff.

These changes make it harder to screw up by mistake, for instance some code would do pev->takedamage = 0 or pev->movetype = 4, making it hard to see what the code was actually doing, and making it easy to break things, for example by doing pev->movetype = 40 by mistake will shut the game down when the physics code gets to it with a message "SV_Physics: <classname> bad movetype 40".
Now you'd have to do SetMoveType( static_cast<MoveType>( 40 ) ) for this to compile, and sanity checks can be added to SetMoveType to catch these cases as they occur.

Right now i'm going to focus on figuring out if i can implement physics in game code, i've been looking around and it looks like i'll have to rely on a few hacks to do this.

Unfortunately the nature of these hacks will break Metamod support, since it involves rewriting stack data (specifically return addresses) and Metamod interferes with that.

Another hack will tie HLEnhanced to the current Steam version due to relying on the binary layout of internal data structures. I'll try to minimize the amount of code that uses these hacks, and allow for custom engines to provide the interface for it, but i doubt it will ever work under other engines.

On the plus side, once this is in place i'll be able to optimize the physics code a bit, implement custom handling for things like multiple think functions, implement parenting support and access data previously unavailable.

If i do the same on the client i may be able to implement late precaching support as well, but i wouldn't count on that being possible just yet.

I've also considered the possibility that engine commands like god, noclip and notarget can be implemented in game code by relying on a similar hack to modify the engine's list of commands. By removing these commands and adding them again from game code it will give control over those commands to modders, which can be quite useful.

I hope that once all of these things are taken care of i can move some data away from entvars_t and move it into CBaseEntity and derived classes. This will make the code that uses it more efficient and easier to understand.

In addition, i've also been thinking about making a program that can act as Ripent, using Angelscript to define transformations to convert entities. This could be used to convert maps to use newer entity APIs. It'll allow for reused entvars_t fields to be changed, which helps avoid confusion and prevents unsafe code from being written.

For example, func_train will happily accept any entity as a target to move towards, and will interpret its entvars_t fields as being used to indicate a path to follow. It will check the spawnflags for corner settings as well.

It will also continue to use paths that have been removed at runtime, meaning a specific edict could be used as a path, removed, and then reused as a completely different entity (e.g. Human Grunt spawned by monstermaker), causing it to read what is essentially garbage data as valid path data. Debugging this is difficult because edicts are only considered for reuse 0.5 seconds after being freed (unless the time is < 2, then it's instant), so it would be tough to notice such a bug.

By moving away from entvars_t, the func_train code will need to explicitly convert the entity to the right class to get the path data, preventing this from happening, and by using an EHANDLE to track the path it avoids the reuse issues.

Since so many changes are required, i'll also consider merging path_corner and path_track, since they are ultimately the same thing anyway.

This program will eventually be able to modify any map source file, BSP file and in-memory representation.
Unfortunately, this means that it can be used to take maps made for one mod and convert them to another mod. That's not intentional, but it's unavoidable when making the tool be able to convert maps from official singleplayer games.

Apologies for the info-dump, but i spent quite a bit of time doing this code cleanup and i've had time to come up with things to do next.
03 Nov 17, 19:43
By Solokiller
avatar
Member
One advantage that i didn't mention: i can override the engine's entity spawn handling and do it all in the server dll, which also lets me store off entity data for templates.

Think monstermaker, only every keyvalue can be set automatically without any special handling in monstermaker itself.

This also lets the modder choose whether the "Not In Deathmatch" flag has any effect.
03 Nov 17, 22:09
By 23-down
avatar
Member
Sounds as usual outstanding.. I just wish you would come to an end soon. smile - :)
So that I can start merging my mod(s) to your newer mega engine. grin - :D

Keep it coming great work.
03 Nov 17, 22:22
By Solokiller
avatar
Member
I'm hoping to get this done soon, then get back to Op4 & BS compatibility work.
I just finished doing some refactoring to prepare for this, now i can access the list of models, sounds, generic precaches, the entity data string, the number of entities that are currently allocated, the map name, the previous map name, and shared datagrams for networking.

I'll need the list of models for physics (BSP & Studio model collisions), as well as the entity data string for control over entity instantiation. I'll need to take a look at AMX's Detour code to figure out how to hook into ED_LoadFromFile, other than that my code should handle most of this stuff just fine.

Having direct access means i can check if a model has been precached before calling for it, which means i could manually implement Source's error.mdl without needing a duplicate list of models.

And like i said, if i did this on the client side as well i could add late precaching by manually entering the required entries in lists, but it's tough without proper access to the codebase. I'll need to figure out how to get the addresses for functions that load models.

EDIT: or maybe not: https://github.com/ValveSoftware/halflife/b
lob/master/common/r_studioint.h#L18


I'll have to figure out if i can keep the lists in sync though.
20 Nov 17, 22:45
By Solokiller
avatar
Member
I've been working on XML integration, it's almost done. I've also added a logging system that uses spdlog to have per-system log settings to make it easier to debug specific areas of the codebase.

The reason i'm posting is because i was reading the Steamworks documentation and found this:
Quote:

The Steamworks SDK is incompatible with some open source licenses, which may affect your ability to distribute open source software via Steam.

Keep in mind that according to the Steam Distribution Agreement you warrant and represent that you have all necessary rights to distribute the game via Steam. If your application contains third party open source code that is incompatible with the Steamworks SDK, then YOU MUST NOT DISTRIBUTE YOUR APPLICATION VIA STEAM.


https://partner.steamgames.com/doc/sdk/uplo
ading/distributing_opensource


Logically this means that open sourcing a Steamworks based engine would violate their own license agreement. So the only way to open source the engine would be to strip all of the Steamworks code, which would also remove any ownership checks and effectively turn it into Xash in terms of usage restrictions (i.e. none).

That still doesn't explain why they won't let modders license it though.
23 Nov 17, 14:48
By 23-down
avatar
Member
So how does this affect your work? Did you use vast chunks of Steamworks code in your code?
23 Nov 17, 15:40
By Solokiller
avatar
Member
It doesn't affect anything i've worked on, they allow mods to use it.
The Source SDK has Steamworks headers and libraries included and accesses it for things like scoreboard avatars. I think it only applies to engine logic, like authentication and such.

I haven't used any Steamworks code in HLEnhanced yet, but i was going to add it in eventually, i'll need it if i ever have to force VAC off on servers (for using client side memory patching, if that's needed).
<< ... 3 4 5 6 7 [8]

Forums > HL Engine Discussion

Login to Reply

You must be logged in to reply.