<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: breadnone</title>
    <description>The latest articles on DEV Community by breadnone (@breadnone).</description>
    <link>https://dev.to/breadnone</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F441110%2F5db23ffe-0196-419f-a88e-26324d7935ec.png</url>
      <title>DEV Community: breadnone</title>
      <link>https://dev.to/breadnone</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/breadnone"/>
    <language>en</language>
    <item>
      <title>Zero Allocation Tweening Library for Unity3D</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Tue, 20 Feb 2024 16:13:52 +0000</pubDate>
      <link>https://dev.to/breadnone/zero-allocation-tweening-library-for-unity3d-2g3c</link>
      <guid>https://dev.to/breadnone/zero-allocation-tweening-library-for-unity3d-2g3c</guid>
      <description>&lt;p&gt;If you've been doing gamedev or webdev, it's 100% guaranteed you'll need to interpolate somethings in your project, and it can be a repetitive and boring tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Tweening?&lt;/strong&gt;&lt;br&gt;
Basically it's just a bunch of numerical interpolation functions we use on primitive types(in c#) or numbers. They're not some sort of hidden magic or anything and there's so little to do in terms of optimization. So how interpolation be usefule? or at least looking more appealing? The most certain answer is "easing function". &lt;br&gt;
&lt;code&gt;public static float EaseInOutQuint(float val)&lt;br&gt;
        {&lt;br&gt;
            return val &amp;lt; 0.5001f ? 16f * val * val * val * val * val : clamp1(1f - pow(-2f * val + 2f, 5) * 0.5f);&lt;br&gt;
        }&lt;/code&gt;&lt;br&gt;
You may heard of it before and they're not out of ordinary either other than just a pretty simple maths with different shapes. as a matter of fact, if you've heard about "easing functions" before, you'll be surprised that for decades they all look the same in terms of the formulas used.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03szvfd7tgi1rh9kc8ho.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03szvfd7tgi1rh9kc8ho.png" alt="source : easings.net" width="800" height="619"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is STween?&lt;br&gt;
Well, long story short, it was due to a heart broken. No, seriously, the awesome tweening library I've been using for years has been abandoned by the creator for almost 7 years now, so I said, I'll invest some time to make my own, that's when STween born.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr04afrv9wojqcrsk3qeu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr04afrv9wojqcrsk3qeu.gif" alt="Lotta tweens!" width="600" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zero Allocation Tweening?&lt;br&gt;
Well yes, sort of. Here's the deal, if you have an option to allocate ahead of time AND only that time the allocation occurs and won't for the rest of the game or project your're working on would you take it? if you ask me, then heck yeah!&lt;br&gt;
That said, under the hood it's just an object pooling and weakReferences as a fallback scenario whenever there's not enough resources can be taken from the pool, even if that fails for example, the worst you can get is by allocating 128 bytes and that's it.&lt;/p&gt;

&lt;p&gt;But why 128 bytes? why not? it's 6x smaller than the much popular nextdoor neighbor that you might be using right now ;). Again, that's for the worst case scenario which is super duper rare unless you're tweening hundreds of them at once then that might occur.&lt;/p&gt;

&lt;p&gt;Enough said, here use it in your game and don't worry it's MIT :)&lt;br&gt;
&lt;a href="https://github.com/breadnone/STween"&gt;https://github.com/breadnone/STween&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>UIToolkit Generate Custom Shapes With Vector API</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Sun, 30 Apr 2023 12:51:39 +0000</pubDate>
      <link>https://dev.to/breadnone/uitoolkit-generate-custom-shapes-with-vector-api-1nip</link>
      <guid>https://dev.to/breadnone/uitoolkit-generate-custom-shapes-with-vector-api-1nip</guid>
      <description>&lt;p&gt;The new vector API for UIToolkit is based on the Mesh API as part of the UI library, basically it's a wrapper on top of the mesh api used in UIToolkit to generate custom meshes.&lt;/p&gt;

&lt;p&gt;Vector api is a decent api in UIToolkit to generate custom meshes without having the same verbosity as mesh api. If you're familiar with SkiaSharp, vector api is very similar to that, syntax wise.&lt;/p&gt;

&lt;p&gt;So I've decided to explore the api a little bit and try to make a custom mesh generator with it, sounds like a cool pet project that can be done pretty quick on my weekend.&lt;/p&gt;

&lt;p&gt;1st we would need to make our own custom class derived from VisualElement for our MeshGenerationContext to contain all Painter2D properties.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ///&amp;lt;summary&amp;gt;Class to contain vector api.&amp;lt;/summary&amp;gt;
    public class UTKMesh : VisualElement
    {
        ///&amp;lt;summary&amp;gt;Vector coordinates used to paint via Paint2D.&amp;lt;/summary&amp;gt;
        public List&amp;lt;Vector2&amp;gt; paths { get; set; }
        public MeshGenerationContext utkContext{get;set;}

        public UTKMesh(List&amp;lt;Vector3&amp;gt; paths)
        {
            this.paths = paths;
            generateVisualContent += OnGenerateVisualContent;
        }

        void OnGenerateVisualContent(MeshGenerationContext mgc)
        {
            utkContext = mgc;
            this.DrawLinePath();
        }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;DrawLinePath()&lt;/code&gt; method is a static helper that will create the path based on the local position of a container which is the parent that will contain the generated context.&lt;/p&gt;

&lt;p&gt;So here's, a little example how we can connect between multiple position based on the vector api doc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var paint2d = new Paint2D();
paint2d.BeginPath();
paint2d.LineTo(new Vector2(100, 100));
paint2d.LineTo(new Vector2(200, 200));
paint2d.LineTo(new Vector2(150, 150));
paint2d.ClosePath();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LineTo method is what we're using to create paths based on Vector2 position to another point in our parent container space. Pretty neat!&lt;/p&gt;

&lt;p&gt;Now let's not do that manually, but instead we want to make a chain of connecting lines in a loop, this way we can create as many lines we want to draw, also we already defined our path List in our custom class so now all we have to do is to create a loop to connect them. Also assuming that we already added all local position to that List.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            for (int i = 0; i &amp;lt; paths.Count; i++)
            {
                paint2d.LineTo(paths[i]);
            }

            paint2d.ClosePath();            
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if we want to fill it with a color, then we can add another Fill and that's all.&lt;/p&gt;

&lt;p&gt;Well, that's obviously wasn't all about, we can do curves, or bezierCurves and even Quadratic curves which will be too long to write all of them here. &lt;/p&gt;

&lt;p&gt;So just grab the code here and look it for your self :)&lt;/p&gt;

&lt;p&gt;(Custom Shape Generator For UIToolkit)[&lt;a href="https://github.com/breadnone/UTKShapeGen-Custom-Shapes-Editor-For-UIToolkit"&gt;https://github.com/breadnone/UTKShapeGen-Custom-Shapes-Editor-For-UIToolkit&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;~Cheers&lt;/p&gt;

</description>
    </item>
    <item>
      <title>UIToolkit Fluent Extension</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Fri, 21 Apr 2023 15:07:04 +0000</pubDate>
      <link>https://dev.to/breadnone/uitoolkit-fluent-extension-4c1n</link>
      <guid>https://dev.to/breadnone/uitoolkit-fluent-extension-4c1n</guid>
      <description>&lt;p&gt;Working with Unity's new ui system is fun, but both USS and UXML can be a bit pain to work with due to how they can make our project bloats with these files. Especially when you only need simple stuff to be done for your custom editors.&lt;/p&gt;

&lt;p&gt;Finally, decided to make my own fluent extension for it, so I can make simple stuff with just inline codes (c#). I said it for simple stuff due to it's not suitable for big projects or when you're working in a team of uiux designers. The power of UIToolkit lies in how flexible the ui system is in terms of templating and quick prototyping, not to mention how it doesn't not affected by domain reloading when working with uss/uxml. Those are sweet but pain at the same time if for example you're planning to do simple thing such as changing background colors, parenting or reorganizing the hierarchy etc. &lt;/p&gt;

&lt;p&gt;Imagine if you can do it like Linq syntax in c#, for example : &lt;code&gt;visualElement.BackgroundColor(Color.yellow).Top(10);&lt;/code&gt; with a single method chaining we can do multiple things in one go, in this case changing the background color and anchoring, that's a win in so many simple cases when you only need simple styling to your UIs.&lt;/p&gt;

&lt;p&gt;Another benefit is that it helps reduce boilerplate codes when using inline styles in UIToolkit, tho it can turn pretty ugly when you need other than styling with fluent api, for example : &lt;code&gt;parent.Size(100, 200).Color(Color.clear).AddChild(childElement);&lt;/code&gt; that example makes the purpose of the code slightly not as clear due to parenting at the end of the method chain. &lt;/p&gt;

&lt;p&gt;If you're planning to give it a try, visit my git repo for this fluent extension&lt;br&gt;
&lt;a href="https://github.com/breadnone/UTK-Fluent-extension-for-UIToolkit"&gt;UTK Fluent extension&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;it comes with tons of custom controls :) feel free to give it a start otherwise, all good!&lt;/p&gt;

&lt;p&gt;~cheers&lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>uiux</category>
      <category>fluent</category>
      <category>api</category>
    </item>
    <item>
      <title>Making a Slide Down Jigsaw Puzzle Game</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Sat, 25 Dec 2021 08:13:42 +0000</pubDate>
      <link>https://dev.to/breadnone/making-a-slide-down-jigsaw-puzzle-game-49f1</link>
      <guid>https://dev.to/breadnone/making-a-slide-down-jigsaw-puzzle-game-49f1</guid>
      <description>&lt;p&gt;I've been a fan of puzzle games ever since I'm a little kid, and the good thing with puzzles, even as an adult we can still play it and still feeling the same excitement as we were a little kid.&lt;/p&gt;

&lt;p&gt;With mobile market flooded with all kind of puzzle games, finding some that are unique can be quite challenging. There are two types of puzzle nerds, one that want to solve complex puzzles no matter how long it takes for them to solve it, while the other one is more like a casual type, where all they want is to just killing some time and not being stressed or think hard while playing it. The later is where the idea of slide down jigsaw puzzle game came from. A simple, easy to play, one handed operation and that's all about it.&lt;/p&gt;

&lt;p&gt;You can play the game for free with your android phone:&lt;br&gt;
&lt;a href="https://play.google.com/store/apps/details?id=com.Breadnone.JigSawMeCat"&gt;Jigsaw Me Cat&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For years I've been what so called a solo-indie-developer. Juggling from one programming language into another is like a routine for each game I'd like to develop, just for the sake of developing games for hobbies and once the game done, bragging off in front of friends or relatives sorta feels like an achievement. The idea to publish my game came from 3 years ago, after reading some successful stories regarding indie games.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>puzzle</category>
      <category>indiegame</category>
      <category>android</category>
    </item>
    <item>
      <title>The art of lazy painting</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Wed, 29 Jul 2020 03:22:05 +0000</pubDate>
      <link>https://dev.to/breadnone/the-art-of-lazy-painting-4j53</link>
      <guid>https://dev.to/breadnone/the-art-of-lazy-painting-4j53</guid>
      <description>&lt;p&gt;Still remember back in the day when a piece of wacom display tablet priced like a diamond? Well, I do, like it was yesterday.&lt;/p&gt;

&lt;p&gt;When all my friends were busy learning 3D (this was late 90s by the way) I said to myself "I will never, ever ever, use 3D as long as I'm breathing!" while hugging, smooching with my precious display tablet. I swallowed my own spits by saying that as 3D has been part of my day to day kinda "thing". Still, the tiny voice inside my head despise thinks that 3D is a complete "CHEAT".&lt;/p&gt;

&lt;p&gt;All those hard works, studying about shadows, lights, perspectives, colors and whatnot, seems wasted. At least that's what I thought. As a graphic designer, whether I like it or not, I had to learn the witchcraft anyway, and that's how 3D has been part of my day to day life. What can I say, shit happens.&lt;/p&gt;

&lt;p&gt;What used to be minutes defining how the shadows/lights work in certain condition or how it impacts certain colors, suddenly become a second "BUT" that's not completely acceptable without further tweaking especially when you are naturally born 2D believer. Painting over 3D is not new, as a matter of fact it's been around since home computers were able to render a still image even though it took days/weeks for complex scenes back then (trust me, I've been there, this is one of the reason why I hate 3D).&lt;/p&gt;

&lt;p&gt;As a solo indie developer, paint-over technique would not be categorized as an easy task. One, you must make your own 3D models, dealing with all the bits and bops so it would get the result you want. Two, you must paint-over (obviously!duh!) and get the final render you're looking for. Three, THE CODE ffs!...&lt;br&gt;
Then one would say "why don't you put more efforts on the 3D then forget about the paint-over thingy?", and I was like "Bruh! Are you serious". Seriously, I got asked so many times regarding that and the answer is as stated above.&lt;/p&gt;

&lt;p&gt;Then some smartasses would come to my face and say "make a team, find people, let them help" and I was like, " #ThrowMyPhoneOutDaWindow #KickMyDogInTheNuts #SlapMyFatNeighbor #SayMyPrayerToHitler&lt;/p&gt;

&lt;p&gt;Aight, that's all&lt;/p&gt;

&lt;p&gt;~Cheers&lt;/p&gt;

</description>
      <category>visualnovel</category>
      <category>datingsim</category>
      <category>indiedev</category>
      <category>solodeveloper</category>
    </item>
    <item>
      <title>The dilemma of an artist with a computer degree, who loves to write stuffs and makes narrative games with a broken english</title>
      <dc:creator>breadnone</dc:creator>
      <pubDate>Tue, 28 Jul 2020 21:25:29 +0000</pubDate>
      <link>https://dev.to/breadnone/the-dilemma-of-an-artist-with-a-computer-degree-who-loves-to-write-stuffs-and-makes-narrative-games-with-a-broken-english-1654</link>
      <guid>https://dev.to/breadnone/the-dilemma-of-an-artist-with-a-computer-degree-who-loves-to-write-stuffs-and-makes-narrative-games-with-a-broken-english-1654</guid>
      <description>&lt;p&gt;The title says it all. Think about your own word here.&lt;/p&gt;

</description>
      <category>visualnovel</category>
      <category>narrativegame</category>
      <category>datingsim</category>
    </item>
  </channel>
</rss>
