Page 1 of 2

[MOD] Retro-Frame

Posted: Sat Jan 27, 2024 8:04 pm
by DunnyOfPenwick
2024_01_27_13_46_28.jpg
2024_01_27_13_46_28.jpg (205.97 KiB) Viewed 1203 times
Hey all, just dropped the Retro-Frame UI mod over on Nexus.
The source code is available on Github.

This mod:
  • moves HUD info to the unused edges of the screen
  • Adds hotkey functionality, including custom actions supplied by other mods
  • adds an error log indicator and display
There is the capability for other mods to add custom hotkey handlers.
This feature, coupled with the error log viewer, is particularly useful for testing mods.
You could create a testing mod and register custom hotkey handlers to create enemies, modify character status, etc., then activate your mod whenever you want to test other mods you are developing.
Here is some explanatory sample code for a test mod:

Code: Select all

        void Start()
        {
            Debug.Log("Start(): MyTestingMod");

            Mod retroFrame = ModManager.Instance.GetMod("Retro-Frame");
            const string registerHotkey = "registerCustomHotkeyHandler";

            retroFrame.MessageReceiver(registerHotkey, ("Disease", Texture2D.redTexture), Inflict);
            retroFrame.MessageReceiver(registerHotkey, ("Poison", Texture2D.redTexture), Inflict);
            retroFrame.MessageReceiver(registerHotkey, ("Vampirism", Texture2D.redTexture), Inflict);
            retroFrame.MessageReceiver(registerHotkey, ("Lycanthrope", Texture2D.redTexture), Inflict);
            retroFrame.MessageReceiver(registerHotkey, ("Mage", Texture2D.redTexture), CreateEnemy);
            retroFrame.MessageReceiver(registerHotkey, ("Skeleton", Texture2D.redTexture), CreateEnemy);

            Debug.Log("Finished Start(): MyTestingMod");
        }

        
        void Inflict(string description, object hotkeyIndex)
        {
            PlayerEntity player = GameManager.Instance.PlayerEntity;
            EntityEffectBundle bundle;

            switch (description.ToLower())
            {
                case "poison":
                    FormulaHelper.InflictPoison(player, player, DaggerfallWorkshop.Game.Items.Poisons.Moonseed, true);
                    break;
                case "disease":
                    FormulaHelper.InflictDisease(player, player, new Diseases[] { Diseases.BloodRot });
                    break;
                case "vampirism":
                    bundle = GameManager.Instance.PlayerEffectManager.CreateVampirismDisease();
                    GameManager.Instance.PlayerEffectManager.AssignBundle(bundle, AssignBundleFlags.SpecialInfection);
                    break;
                case "lycanthrope":
                    bundle = GameManager.Instance.PlayerEffectManager.CreateLycanthropyDisease(LycanthropyTypes.Werewolf);
                    GameManager.Instance.PlayerEffectManager.AssignBundle(bundle, AssignBundleFlags.SpecialInfection);
                    break;
                default:
                    break;
            }
        }




        void CreateEnemy(string description, object hotkeyIndex)
        {
            MobileTypes mobileType;

            switch (description.ToLower())
            {
                case "mage":
                    mobileType = MobileTypes.Mage;
                    break;
                case "skeleton":
                    mobileType = MobileTypes.SkeletalWarrior;
                    break;
                default:
                    mobileType = MobileTypes.Rat;
                    break;
            }
            Transform parent = GameObjectHelper.GetBestParent();

            Vector3 location = GameManager.Instance.PlayerObject.transform.position;
            location += GameManager.Instance.PlayerObject.transform.forward * 2;

            string name = mobileType.ToString();

            GameObject go = GameObjectHelper.InstantiatePrefab(DaggerfallUnity.Instance.Option_EnemyPrefab.gameObject, name, parent, location);
            SetupDemoEnemy setupEnemy = go.GetComponent<SetupDemoEnemy>();

            setupEnemy.ApplyEnemySettings(mobileType, MobileReactions.Hostile, MobileGender.Female, 0, false);

            GameManager.Instance.RaiseOnEnemySpawnEvent(go);

            DaggerfallEntityBehaviour behaviour = setupEnemy.GetComponent<DaggerfallEntityBehaviour>();
            EnemyEntity enemy = behaviour.Entity as EnemyEntity;
            DaggerfallUI.AddHUDText($"Spawned {enemy.Name}({name})");

            DaggerfallEnemy dfEnemy = behaviour.GetComponent<DaggerfallEnemy>();
            dfEnemy.LoadID = DaggerfallUnity.NextUID;

        }

Update: Added the ability for other mods to grab and modify the content panel. See the github Readme for details.

Re: [MOD] Retro-Frame

Posted: Sat Jan 27, 2024 8:10 pm
by Magicono43
Looks neat, me personally I'm usually content with the more minimalistic HUD options, but I think this is definitely a improvement over the vanilla "Big" HUD placement.

Re: [MOD] Retro-Frame

Posted: Sun Jan 28, 2024 9:30 pm
by King of Worms
Magicono43 wrote: Sat Jan 27, 2024 8:10 pm Looks neat, me personally I'm usually content with the more minimalistic HUD options, but I think this is definitely a improvement over the vanilla "Big" HUD placement.
Its all about that 4:3 aspect ratio :) IMO this is quite a clever mod. Its the ultimate way to play DFU in retro mode, 4:3 aspect, same as the original was, and than using the free space on the monitor, to show the hud on the sides.

It also has the charm of the old HUDs of RPGs like Ultima Underworld etc. I really like this' :geek:

Re: [MOD] Retro-Frame

Posted: Mon Jan 29, 2024 3:34 am
by DunnyOfPenwick
It seemed like the natural way to implement an old 4:3 game in a newer widescreen format.
That's why I used the phrase 'As Julianos decreed', meaning 'as logic dictates'.

I've done limited testing with DREAM at this point. I did notice a technical issue when using concealment spells.
My code copies and creates alternate versions of character portrait in the upper left frame when shadow/chameleon is used. In Dream the character portrait gets replaced by a grey rectangle. I haven't looked into it but I'm guessing there's a mechanism preventing me from grabbing texture pixels?

Re: [MOD] Retro-Frame

Posted: Mon Jan 29, 2024 10:07 am
by Ralzar
Is this compatible with setting DFU in Retro Mode?

And if so, is it possible to get a Ultr Wide version of it? I play in 16:9 retro mode and would love to use the black bare on the ides for something :D

Re: [MOD] Retro-Frame

Posted: Mon Jan 29, 2024 1:33 pm
by DunnyOfPenwick
I'm planning on dropping an update in the coming week.
I'll be adding the capability for other mods to retrieve the fullscreen overlay panel using a messaging callback.
You'll be able to manipulate the UI content however you want.

Re: [MOD] Retro-Frame

Posted: Tue Jan 30, 2024 5:25 am
by DunnyOfPenwick
Update dropped.
Check the Readme on the github for details about changing the overlay panel.

Re: [MOD] Retro-Frame

Posted: Tue Jan 30, 2024 6:46 am
by jayhova
I don't have a retro-nostalgia fetish when it comes to Daggerfall or really any game. I dream about all games being even better while I'm playing them. Daggerfall certainly was no exception to this. DF was buggy when it came out and was not really finished.

All that being said, I really like this mod. The UI is a weird fusion of 90s nostalgia enabled via a modern game interface and hardware. It's a bit like running a Daggerfall emulator in Daggerfall Unity

Re: [MOD] Retro-Frame

Posted: Tue Jan 30, 2024 1:17 pm
by DunnyOfPenwick
My main goal was to make use of the wasted space on the sides. I just added some more code to allow access to the content panel, so other modders can add updated graphics if they wish.

Re: [MOD] Retro-Frame

Posted: Wed Feb 07, 2024 10:05 am
by MrFlibble
I definitely love the look! What a clever way to reimagine the HUD! Reminds me of those party-based RPGs like Wizardry and stuff. Great job!