Jump to content

Gijs-Jan

Development Team
  • Posts

    336
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by Gijs-Jan

  1. Damage localization works by determining what part of the body got hit according to this table: 

    (First is Chance to Hit -> Location,  Second is Location -> Modifier on Damage)
     

    /// <summary>
    /// Provides the hitchance table for locational damage, per https://trello.com/c/aYcOD0N3/303-locational-damage
    /// Used in <see cref="SingleTargetDamage"/>.
    /// </summary>
    public static readonly OddmentTable<DamageLocation> DAMAGE_LOCATION_HIT_CHANCE = new OddmentTable<DamageLocation> {
        {15f, DamageLocation.Head()},
        {15f, DamageLocation.Neck()},
        {40f, DamageLocation.Body()},
        {4f, DamageLocation.LeftArm()},
        {4f, DamageLocation.RightArm()},
        {4f, DamageLocation.LeftLeg()},
        {4f, DamageLocation.RightLeg()},
        {14f, DamageLocation.Graze()},
    };
    
    /// <summary>
    /// Provides the modifiers to locational damage, per https://trello.com/c/aYcOD0N3/303-locational-damage
    /// Used in <see cref="SingleTargetDamage"/>.
    /// </summary>
    public static readonly Dictionary<DamageLocation, float> DAMAGE_LOCATION_MODIFIER =
        new Dictionary<DamageLocation, float> {
            {DamageLocation.Head(), 1.5f},
            {DamageLocation.Neck(), 1.25f},
            {DamageLocation.Body(), 1},
            {DamageLocation.LeftArm(), 0.75f},
            {DamageLocation.RightArm(), 0.75f},
            {DamageLocation.LeftLeg(), 0.75f},
            {DamageLocation.RightLeg(), 0.75f},
            {DamageLocation.Graze(), 0.5f}
        };
  2. I hadn't encountered that before in Unity games, but I suppose it makes sense. Wouldn't that make it easier to upgrade though?

    Yes, it does in general, however the issue is mostly in the third party plugins we use that also then need to be upgraded. Personally I would like to upgrade, even if just for the tooling and speedups that Unity now has. The problem is mostly that we simply don't have the budget at the moment and given the length of development the focus is and was on finishing the game. 

    About the hooks: if I want to have code execute every time the game uses a specific method I'd need to patch that method, and I haven't found many hooks in that native C# part. For instance, I would like to execute something when the strategy screen is loaded, but there is not something like an event I can subscribe to (or is there?)

    The core of our game is an ECS framework I developed that you will find under the Artitas namespace. The `World` class in this namespace is the general entry point to managing an ECS instance. This framework has two aspects: high level communication through messages inheriting from `IEvent`, which any `System` can listen to by annotating methods with `Subscriber`  - and low-level event handling based on changes to entities through `Family`.  In general we setup mechanics in `System`s, with each System listening to certain events and setting up various Family-s to respond to events. A System can listen to any event, define its priority, and if needed stop event propagation.

    To get an overview of compositions of entities we use, look into the classes that end in `Archetypes`.

    tl;dr: look at the inheritance of `IEvent` for all the high level communication you can hook into.

    A `World` can have `System`s registered and unregistered at runtime - the main way in which we want to support modding.

    The core entry point of the game is `XenonautsMain`, with `StrategyScreen` & `GroundCombatScreen` being the core entry points for each section of the game. In those Screen classes you'll find the setup of the World and its Systems.

    Executing Harmony.PatchAll gave a System.MissingMethodException about System.Reflection.PropertyInfo.op_Inequality. But for some reason I was being quite dumb and was building against .NET Framework 4.8 instead of 3.5 (Harmony luckily still supports that), so changing the build target actually solved it :)  

    Yeah, that'll be it :D. I'd love to be able to upgrade :')

    • Like 1
  3. Xenonauts 2 uses Unity predominantly as a rendering and authoring engine - most of the logic is actually unobfuscated, native C# (not inheriting from Monobehaviour) and all the hooks that the programmers have are exposed to modders.
    It did not make much sense to go with a scene-based approach because most content is not static - Ground Combat is fully generated at runtime, there are no separate Scenes.
    It's mostly UI or visual aspects which use Monobehaviour based inheritance, the rest is full native C#.

    I will provide an outline with an example once we are further along how to create proper mods using injection, which to my recollection does work but it has been some time since I last tested it.
    Can you be more detailed in what issues you ran into getting Harmony to work? 

    At the moment we are completely focused on the early access release though, so I can't commit any resources to helping you out, but if you can provide the information then I have it available when I will.

  4. On 10/13/2022 at 6:21 PM, Solver said:

    (For the tech team I guess) - is there something unexpected going on like using LINQ to log stuff over collections of game entities, or even reflection anywhere? Asking because we also log a fair bit in Old World but the perf impact of that is negligible, and we made several unpleasant discoveries with just how much LINQ murders perf in Unity.

    It's purely a result of extremely excessive logging (with I/O) we're doing during loading because we're trying to pin down a multithreaded bug inside Unity Engine when it comes to loading from asset bundles. Besides that, the level creation process hasn't been optimized yet because the structure of the level was very much still being changed (even now). 
    The primary problem with LINQ in Unity is the memory allocation & subsequent GC that's just terribly slow - a good resource with regards to that (and allocationless LINQ libraries): https://www.sebaslab.com/zero-allocation-code-in-unity/.

    With Old Worlds I hope that you're on 2021 LTS so you can at least use C# 9 & Span, sadly we're stuck on an old version of Unity :D

  5. Support for runtime code-centric mods has been built in from the start. The game has been programmed from a "hook" perspective and I will make sure we release documentation on how this works once we fully release. 

    I've also already looked into Harmony / other runtime patchers in the past to check compatibility and we're explicitly keeping things in C# (as opposed to IL2CPP) to provide mod support for this.
    My plan is to release a public example project that shows how to use it. 

    • Like 3
  6. While not something you can easily set in settings, it is something that should be straightforward to mod in!

    Because what would "more aliens" mean? In certain missions +4 might be ok, but in others that might overwhelm. It would require a rebalancing of the game that goes way beyond a simple setting you can adjust

  7. This is definitely not as intended - and we recently stumbled onto a bug with how items got assigned through the loadouts that touched on the MARS.
    That seemed to be related to soldiers coming back from missions being the cause somehow.

    It seems you've got a good understanding of when it happens - do you maybe have a set of steps to replicate it?
    If I simply boot up the game and add in limited items, the loadouts work as intended in that trying to apply a loadout that you don't have the items for will lead to soldiers without items.

  8. 10 hours ago, squeezechart said:

    I try to load a savegame and if there is no reaction (load percentage stands still) I klick on the loading window until it becomes "white".

    Wndows 10 tells me that xenonauts2.exe does not respond and I can either wait or terminate the app.

    Then I choose terminate. About 30 sec. later a bluescreen comes. Windows collects data (crash report?) and restarts.

    It is not possible to call task manager or to start further apps before the bluescreen comes.

    It'll be quite the thing to debug, but could you give me the info on what failed and what stopcode was given the next time it occurs?

    image.png.ca77e7887a23c7c58be75b7ec75cb762.png

    See the red outlined parts.

  9. On 3/22/2021 at 5:36 PM, maxm222 said:

    Yeah, sure, I knew all that, of course, no big whoop, I didn't have a cow, man, I didn't think the empire would fall.

    It just that [blushes], since I hadn't seen it again, I thought it was fixed in the last iteration and that someone might not know that it had snuck back in.  I guess I just forgot: "don't sweat the little stuff."  Gotta go back and work the steps.

    :)

    If you come across this issue again, can you upload the GC auto save & the save on strategy that was made prior to going to the crash site?

  10. Hi,

    We haven't looked at the visuals of shooting in GC for quite a bit and because a lot of new assets got introduced need to give it another pass - so likely this is a temporary change.

    Having said that, it would really help us fix the issue if you could provide some details on the specific issues you have with it.
    Is it mechanical (Do you feel they miss more, hit more, etc) or visual (it looks bad)?

    What specifically felt or looked bad and do you maybe have screenshots or recordings of it? (or maybe a save game?)

    What was the last version you played prior to this version?

  11. On 10/8/2019 at 12:23 PM, Solver said:

    Alright. I can say that simply 

    
    python -m json.tool save.json > save-pretty.json

    works well on saves to get them into a readable format (quadrupling the file size!) for some quick edits. If those prove difficult to load, I should be able to get it back into the ugly format with another Python one-liner.

    Yeah, and given the file-size problem we have already (until I get to the optimization), you can understand why I really didn't want to have it pretty-print by default! :')

  12. 29 minutes ago, Solver said:

    I'm on Linux, and vim can deal with the save files, but it doesn't make that very convenient.

    If you're not going to pretty-print, why not just compress the whole thing? With data like what you have, a quick compression is sure to yield at least a 90% ratio. Yes, you could say it's not then human-editable save files, but frankly I would say the current ones aren't anyway. When you need a special editor or plugins to open the file properly, it means at least some level of tech skill is necessary, and in that case you might as well ask the users to decompress the file first.

    If I change a save file so it's prettified, should I expect the game to load it properly still?

    It's simply a matter of time and manpower but definitely planned - it's just not a priority at the moment. 
    You are right in the quick win w.r.t. compression, although we need to do that on part of the file so we can support the Save/Load elements' partial loading. There's a bunch of other optimizations planned as well to do with aliasing the common patterns, etc.

    I assumed Windows because I didn't think that on Linux you would have issue pretty-print formatting it efficiently. 
    It might be that the Save/Load Element will give issue as it's only partially loading files and scanning for (extremely simple) terminator patterns, but the underlying load system has no issue with formatted JSON.

  13. 23 hours ago, Solver said:

    One small request for the tech team. Would it be possible to change the JSON serialization for saved games to a pretty-printed format with linebreaks? Currently it's just one ginormous line, which means that many editors have trouble working with the file, and it's also harder to manually edit stuff due to it not being pretty-printed.

    The problem is that the file is already gigantic (relatively speaking) and pretty printing increases the size even more given how / what we serialize. 
    (The pretty print doesn't really concern itself with speed either. For the size we've got an optimization pass planned)
     
    If you're Windows based I suggest taking a look at Notepad++ with a JSON formatting plugin which works well even with very large files. (https://github.com/sunjw/jstoolnpphttps://sourceforge.net/projects/jsminnpp/ or https://sourceforge.net/projects/nppjsonviewer/)

  14. Most of the current high-CPU usage (when everything is "idling") is coming from the dynamic batching that Unity is doing as most meshes haven't been statically batched. Given that we're in a destructible environment that's rather hard to do and we want to wait until late in development where we better know which usecases we can easily batch, and which ones we cannot.

    Having said that - High CPU temperature is mostly because the machine is simply using what's asked from it.
    I can "optimize" the game (to give more FPS), but I'll always ask the hardware to give it's fullest potential.
    In a game you tend not to want to leave performance on the table... 

    A framelimiter does mitigate this if FPS is high enough for you and I'll add it as a task for the settings screen for Chris to review.

×
×
  • Create New...