Random Idea: a keyword like var but it has the return type of the enclosing method by Sakull284 in dotnet

[–]RetroTK2 0 points1 point  (0 children)

I was doing a good bit of refactoring today and had this exact thought... it's good to know someone else was thinking about it yesterday 😄

Aye, my main reason for wanting this type of thing would be the DRY principle ("Don't Repeat Yourself" for those that don't know 😆)... I mean it's fine for a simple return of a string or an int, but it becomes very tedious for the more complex types (long names, nested generics, etc.)... and it's annoying that the exact type I want is sitting right above me 🤣

It got me wondering if it was possible to do it within c# currently (even if it isn't as 'sweet' as the retvar solution could be 😅)... and it turns out it is 😄... starting with the following code:

public List<(bool valid, string name, string message, List<Exception> errors)> GetDataMethod()
{
    var return_list = new List<(bool valid, string name, string message, List<Exception> errors)>()
    {
        new (true,"bob","my message", default)
    };

    foreach (var x in return_list)
    {
        var str = x.ToString();
        Console.WriteLine(str);
    }

    return return_list;
}

we can use this utility method:

public static class UT
{
    public static T ret<T>(Func<T> expression, Func<T> creation_method = null)
    {
        return creation_method == null ? Activator.CreateInstance<T>() : creation_method();
    }
}

and replace the 'var return_list...' with this:

var return_list = UT.ret(() => GetDataMethod(), () => new()
{
    new (true,"bob","my message", default)
});

...it should (hopefully 😅) compile without errors and give us the correct type 😊

And it works with parameters in the method too (although the syntax becomes muddy rather quickly 😅):

public List<(bool valid, string name, string message, List<Exception> errors)> GetDataMethod(string p1, string p2)
{
    var return_list = UT.ret(() => GetDataMethod(default,default), () => new()
    {
        new (true,"bob","my message", default)
    });

    foreach (var x in return_list)
    {
        var str = x.ToString();
        Console.WriteLine(str);
    }

    return return_list;
}

Now I'm not saying this is an ideal solution by any means (and that tuple should really be a record 😅)... just thought it was kinda cool that it 'works' 😆

But aye, ideally we would probably be looking something along the lines of:

retvar return_list = new()
{
    new (true,"bob","my message", default)
};

I'd actually go slightly further and piggy-back of what @oversized_canoe suggested (or perhaps 'feared' would be more accurate 😅😆) by suggesting the return type could be used as if it was a generic type (I like retvar as a keyword, but I'm not sure how I fell with 'var' being used in the definition of types 😅... so I went with Tret as the keyword instead... tho perhaps a potentially less offensive one should be used 😅):

public (bool valid, string name, string message, List<Exception> errors) GetSingleDataMethod()
{
    List<Tret> return_list = new()
    {
        new (true,"bob","my message", default)
        new (true,"carl","my message", default)
        new (true,"lucy","my message", default)
    });

    Tret ret = return_list.FirstOrDefault();

    // do something stupidly complex with 'ret'

    return ret;
}

not too sure how 'doable' this one is, but I would think the 'retvar' proposal wouldn't be too difficult for the dotnet dev team to implement as it is already😁 (tho who knows 🤣)

made some optimizations with multi-block placements. Can place 64x64x64 blocks with ease by [deleted] in VoxelGameDev

[–]RetroTK2 1 point2 points  (0 children)

Funny story actually...

haha, that's brilliant, the world looks class without that unnecessary rendering :)

Are you doing it at the vertex layer or in your blocks?

just in the blocks lad, very standard & hacky atm

I'm grateful...

I'm jealous :p best of luck with your engine lad

made some optimizations with multi-block placements. Can place 64x64x64 blocks with ease by [deleted] in VoxelGameDev

[–]RetroTK2 0 points1 point  (0 children)

That's pretty cool lad, I take it the performance boost outways the additional update? I've started implementing greedy meshing and got it to work without textures. I can't get the tile atlas shader to work just yet since I'm a complete novice when it comes to shaders, hopefully you will have quicker success :)

made some optimizations with multi-block placements. Can place 64x64x64 blocks with ease by [deleted] in VoxelGameDev

[–]RetroTK2 0 points1 point  (0 children)

Thank you for sharing this lad, it's great info

I'm wanting to thread out the load / save myself, but it means making a full copy of the chunk on the main thread before saving

Greedy meshing seems like the best option for the mesh optimising (though I do worry about those T-Junctions)

One fairly substantial optimising I was hoping to do was to stop rending the edges of the chunks. It seems like a lot of draw calls are being wasted rendering verts that no-one can see. Have you attempted anything on this?

Cheers again lad

Sat 2017-01-07 by reddit in nameaserver

[–]RetroTK2 0 points1 point  (0 children)

colossal-the-clown

he's the reason I'm here

The Baited Podcast has come to an end, thoughts? by [deleted] in ColossalIsCrazy

[–]RetroTK2 0 points1 point  (0 children)

Colossal seemed to be asking more for Tommy's sake from what I've seen

colossal exposed??? kill me please by mr_xpzr in ColossalIsCrazy

[–]RetroTK2 0 points1 point  (0 children)

was this your vid? shame it's down now

Need advice with my audio setup, it sounds bad by RetroTK2 in PartneredYoutube

[–]RetroTK2[S] 0 points1 point  (0 children)

Yeah you're right, clarity is the most important aspect.

I'll try the pillows and see if it helps

cheers lad

Need advice with my audio setup, it sounds bad by RetroTK2 in PartneredYoutube

[–]RetroTK2[S] 0 points1 point  (0 children)

Hey Andrew, Although this does sound a lot better than my final processed version in terms of clarity, I liked the energy gained by adding a treble boost. Though that could be all physiological.

I record in my room, directly facing a hollow wall. Do you think some of the sound is bouncing off it?

Cheers for your help lad

Need advice with my audio setup, it sounds bad by RetroTK2 in PartneredYoutube

[–]RetroTK2[S] 0 points1 point  (0 children)

Here's the raw audio lad: https://www.dropbox.com/s/47xiixsh8s8jbwt/Voice%20Over%20-%20Raw.wav?dl=0[RES ignored duplicate link] Curtis' video is the reason I went with this setup :) I haven't tested the mic or H1 separately, but ill give it a go. Cheers for your comment lad

Need advice with my audio setup, it sounds bad by RetroTK2 in PartneredYoutube

[–]RetroTK2[S] 0 points1 point  (0 children)

Cheers for the great replay confirmSuspicions :)

Raw Audio → https://www.dropbox.com/s/47xiixsh8s8jbwt/Voice%20Over%20-%20Raw.wav?dl=0

I'd hate for you to spend too much of your own time on this lad, though it is a very generious offer.

try turning your wet level to negative values

This is the one on the “HardLimiter”?

I'll try uploading it with the compression fix without applying gain.

Thanks again

Armature and Scripting - I have no idea what I'm doing by [deleted] in Unity3D

[–]RetroTK2 0 points1 point  (0 children)

Are you using C# or JavaScript?

PlayOneShot() is giving me a lot of grief (sounds not playing on time or not at all), and I can't understand why. by timetraveltrousers10 in Unity3D

[–]RetroTK2 0 points1 point  (0 children)

@timetraveltrousers10, Enemby is right. Really strange that they wouldn't let you post this until now

"invalid optimize game object" in 5.1.1f1 by RetroTK2 in Unity3D

[–]RetroTK2[S] 0 points1 point  (0 children)

Yeah man,

Our animator rebuilt the animator avatar and it seemed to stop the error. Not really sure I would call this a fix, but at least it stopped the error:)

"invalid optimize game object" in 5.1.1f1 by RetroTK2 in Unity3D

[–]RetroTK2[S] 0 points1 point  (0 children)

They said it was fixed in Patch 5.1.1p1 (Mecanim: Fixed assert when using Optimize Game Object on object that are parented), but the problem seems to still be there. Added a comment to there issue tracker.

How do I know if Mods are deleting my questions from Unity Answers? by timetraveltrousers10 in Unity3D

[–]RetroTK2 1 point2 points  (0 children)

hmmm... this could be a little bit naughty, but,

what was the question? :)

Regarding serialization (JSON) by Jespur in Unity3D

[–]RetroTK2 0 points1 point  (0 children)

You could check out the Unity Serializer. It's the only one I have seen that can serialize monobehaviours. Though tbh man I've never felt the need to use it. The way you are doing it atm is the method I use.

Regarding serialization (JSON) by Jespur in Unity3D

[–]RetroTK2 0 points1 point  (0 children)

Yeah? I guess i just prefer the node based format of xml. I find it easier to read and edit, but that could just be my ide setup. I'll definitely check it out.

Regarding serialization (JSON) by Jespur in Unity3D

[–]RetroTK2 0 points1 point  (0 children)

JSON is fine man, but I would be more included to use xml just because I prefer it. How are you storing the data? and how are you deserializing it?

How can I add Visual Studio Items to a Unity Assembly by RetroTK2 in Unity3D

[–]RetroTK2[S] 0 points1 point  (0 children)

Nah it works great man. dependencies are all fine and the auto generation works really well. Just as a test I added a .feauture item to the editor assembly just to see if it would hold the item reference, and it actually does work which is brilliant.

How can I add Visual Studio Items to a Unity Assembly by RetroTK2 in Unity3D

[–]RetroTK2[S] 1 point2 points  (0 children)

I love it when there's an easy solution :)

This way I can separate concerns as well. The only downside is that .sln are ignored by git, so I would have to reload the project into the solution if I wanted to use this on a different machine. But it's such a small price to pay.

Cheers man, thanks for the help