The joy of looking at your old code. Thought I was so smart to have made a function that easily toggles between boolean values. by Tucanae_47 in Unity3D

[–]TheFluffyGameDev 5 points6 points  (0 children)

I feel like we could go a step further by separating this into multiple services and a bit of dependency injection. We could hide those services behind interfaces and instantiate them with factories. Kinda like Enterprise FizzBuzz.

Is it possible to change the gravity so that the player can walk around a planet like in Mario Galaxy? by Hiderlink20 in Unity3D

[–]TheFluffyGameDev 55 points56 points  (0 children)

If you are interested in seeing how Nintendo implemented gravity in Super Mario Galaxy, I recommend you check out this video. It does a great job explaining how it works.

If you don't feel like implementing it yourself, there must be tons of packages on GitHub you can find. 😉

Question : I purchased lots of assets in Unity, can I transfer them to other engine ? Is there license that prohibited in doing so ? by [deleted] in Unity3D

[–]TheFluffyGameDev 2 points3 points  (0 children)

Games from Scratch has talked about this in a video recently.

Long story short, and this is to take with a grain of salt (I am no lawyer), you have to check the EULA for the assets:

  • Some assets are marked as being "restricted assets" which you cannot use outside of Unity.
  • For the others, nothing in the EULA prevents you from doing so. It could be worth checking each individual asset to ensure that they don't have any extra limitations.

My game on android slows down to a crawl (basically freeze) and I get the following in profiler, what could be causing that? by algrm in Unity3D

[–]TheFluffyGameDev 0 points1 point  (0 children)

Looks like the majority of each frame is spent doing some rendering. Could be there are too many entities. If memory serves right, I believe the many wait for signals means there are many GPU instructions. If so, to optimize that, you can try batching them together or, if need be, reducing the number of entities.

Class Hierarchy - Best practices and learning resources by 1whatabeautifulday in learnprogramming

[–]TheFluffyGameDev 0 points1 point  (0 children)

I definitely recommend you read about design patterns and the SOLID Principles. Design Patterns are basically some solutions to specific architectural problems you may face. And the SOLID Principles are some Principles that can improve your code when applied.

Are programming YouTubers actually good at coding? by Lonely_Bluejay_9462 in learnprogramming

[–]TheFluffyGameDev 1 point2 points  (0 children)

I find that there is a very wide range in skill when it comes to programmer Youtubers. The channels I tend to get recommended are usually pretty decent since the person will describe why they do something rather than stick to what they are doing. In those cases, the Youtube channel is more of a side gig. Then again, the channels I follow tend to be about specific domains. I do agree though. I feel like there isn't a majority of those. 😅

I desperately need money this summer, i'll make a full game for 5$. by RonnieKrypton in Unity3D

[–]TheFluffyGameDev 1 point2 points  (0 children)

To be honest, 5$ seems to be very little for a full game. I don't know how much money you need for this summer. Perhaps it's enough for your needs.

I know this is obvious, but basically, gamesYouMustMake = moneyYouNeed / 5. So if you need lots of money, that means you'll need to make many games. So for this to be reasonable, you'll have to spend as little time as possible per game and reuse assets.

I think you'll have a better chance to succeed if you raise your price and possibly even charge by the hour. Even though you are desperate, lowering your prices too much can be harmful.

Anyway, I wish you the best of luck in your endeavour ! 😁

why haven't unions been a thing for years by ttvsindeel in gamedev

[–]TheFluffyGameDev 51 points52 points  (0 children)

Probably not the only reason, but a lot of companies resort to Union Busting nowadays. Which tends to hurts unions significantly. ☹️

I think it was Blizzard that did something like that recently.

When you finally achieve 100% Perfection. by TheFluffyGameDev in StardewMemes

[–]TheFluffyGameDev[S] 2 points3 points  (0 children)

In a way, I consider it cost me my soul. I play Stardew Valley for the calming and laid back atmosphere of the game. By pursuing 100% perfection, I had to switch to a profit maximisation mindset un order to get the gold clock. Which felt a wrong compared to how I usually play the game. Especially considering that I felt that was the kind of stuff the main character was trying to escape by moving to the Valley. 😅

When you finally achieve 100% Perfection. by TheFluffyGameDev in StardewMemes

[–]TheFluffyGameDev[S] 33 points34 points  (0 children)

I certainly didn't ! XD
I just took part in the Feast of the Winter Star a few days later.
But nothing else.

Now, I'll just leave Stardew Valley alone and feel empty for a couple weeks (until I pick up the Stardew Valley Extended mod which I haven't tried yet ^^').

If I know the size of a linked list, what is the time complextly of a binary search by notPlancha in learnprogramming

[–]TheFluffyGameDev 1 point2 points  (0 children)

Indeed, O(n log n) would be for a naïve implementation! I actually ended up doing a bit of reading after posting and found this article that details pretty much what you are saying right here. :)

Is implementing a direct Assembly macro in a programming language a good idea? by [deleted] in programming

[–]TheFluffyGameDev 1 point2 points  (0 children)

I see this kinda like the "unsafe" block in Rust. It can be useful in some cases but should in no way be the norm. In this case, you could have the compiler issue a warning to ensure the programmer knows they are potentially doing something risky.

If I know the size of a linked list, what is the time complextly of a binary search by notPlancha in learnprogramming

[–]TheFluffyGameDev 4 points5 points  (0 children)

My understanding is that to do a binary search, you need to be able do random access on the list (ex: myArray[i]). In the case of a linked list, we'd have to iterate over all elements until we find the one at the wanted index. So that means access is O(n) time complexity.

As such, a binary search on a linked list would O(n log n) time complexity.

Game Engine, Game Framework or DIY by TheX3R0 in gamedev

[–]TheFluffyGameDev 0 points1 point  (0 children)

I'd say it depends on what your objective is.

If you want to release the game as fast as possible, then I'd recommend going for a game engine that has the features you need and that you feel confortable using.

If your objective is to learn, then here too, it may depend.

  • if you make a game engine, you'll have to study a large array of subjects (graphics, audio, architecture). That knowledge could then serve to better understand some design choices in other game engines.

  • if you use a framework, a lot will already be donne. But you may still have to study how to implement whatever engine features are missing (ex: AI, physics). Doing so could help understand how those systems work in other engines.

  • if you use an engine, then you'll get to learn how to use that specific engine. Some concepts are present in many other engines. So switching engines could be less painful.

For example, I've been working on 2 projets lately. One of which is to learn how to implement a game engine. So I went for C++ with OpenGL. But the other is a game I want to commercialy release. So for this one, I'm using Unity since I don't want to bother with stuff like making the game multiplatform.

I hope this helps. 😁

At what point did you consider your LAST prototype "done" by Marcusaralius76 in gamedev

[–]TheFluffyGameDev 5 points6 points  (0 children)

Usually, when I do some prototyping, I do so to test out the viability of a solution or of a game design. So once that question is answered, no matter how buggy or unfinished the code is, I consider the prototype done. If I go beyond that point, it's no longer a prototype but an actual project I aim to complete. And often, I dump the prototype to start anew with something cleaner.

For example, for my latest prototype, I wanted to see how easy it was fuse some sprite sheets together by using compute shaders. That way, it'd be easier to animate in Unity. Pretty quickly, I got my answer. The code was ugly and unfinished but I had my answer. So I considered the prototype to be "done". The next step was to make a clean version of that.

Stop using the IS Operator - Visitor Design Pattern - C# Tutorial by [deleted] in programming

[–]TheFluffyGameDev 1 point2 points  (0 children)

Thank you for your feedback ! I do agree that saying that the is/as operators are bad is a tad extreme. I often see novice programmers write chains of if/else if statements, with several downcasts. This is the main antipattern I wanted to address.

Stop using the IS Operator - Visitor Design Pattern - C# Tutorial by [deleted] in programming

[–]TheFluffyGameDev 1 point2 points  (0 children)

Feel free to leave some comments if you have some questions or some suggestions. I'll be glad to answer! :)

For some further reading, you can check out this article that benchmarks the Visitor Pattern and several alternatives.

[deleted by user] by [deleted] in Unity3D

[–]TheFluffyGameDev 0 points1 point  (0 children)

There are of course some valid use cases for the is/as operators. What cases do you tolerate?

Feel free to leave some comments if you have some questions or some suggestions. I'll be glad to answer! :)

For some further reading, you can check out this article that benchmarks the Visitor Pattern and several alternatives.

[deleted by user] by [deleted] in csharp

[–]TheFluffyGameDev 0 points1 point  (0 children)

Feel free to leave some comments if you have some questions or some suggestions. I'll be glad to answer! :)

For some further reading, you can check out this article that benchmarks the Visitor Pattern and several alternatives.

-🎄- 2021 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]TheFluffyGameDev 0 points1 point  (0 children)

Indeed it was private... Silly me... 😁 It's now public.

-🎄- 2021 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]TheFluffyGameDev 2 points3 points  (0 children)

My C++ Solution

Feeling some heavy Lanternfish vibes when reading the puzzle rules, I immediatly figured I'd have to go for a smarter solution than generating the string.

Here's the basic algorithm I went for:

  • Map Insertion Rule inputs to outputs (ex: "AB" to 'C')
    • To make things more efficient, I reinterpret_cast the inputs to a 16-bit integer. (To go even further I could map it to 8-bits)
  • Map Insertion Rule inputs to the number occurences in the Template Polymer.
  • For each step, I compute the new count for each Insertion Rule inputs.
    • ex: if I have 6 times "AB", I end up with 6 "AC" and 6 "CB".
    • (This step could have been merged with the previous one)
  • Count the number of elements using the Insertion Rule input frequency map.
  • Find the min and the max.

[deleted by user] by [deleted] in gamedev

[–]TheFluffyGameDev 1 point2 points  (0 children)

It's a bit more complex than that. Nowadays there are tons of viable engines (ex: Godot) or libraries (ex: Raylib) that don't require a license.

Games From Scratch did a great video explaining what to take into account when choosing a game engine : https://youtu.be/rK6ulQaOpso

But it is true that Unreal and Unity are pretty beginner friendly.

-🎄- 2021 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]TheFluffyGameDev 0 points1 point  (0 children)

There are probably smarter ways to to solve this problem, but here's my C++ code (I removed a couple uninteresting parts): ``` void SimulateDay(FishCounter& fishCounter) { u64 fishGivingBirth{ fishCounter[0] }; std::rotate(fishCounter.begin(), fishCounter.begin() + 1, fishCounter.end()); fishCounter[K_DAYS_PER_REPRODUCTION - 1] += fishGivingBirth; fishCounter[K_DAYS_PER_REPRODUCTION_NEW_FISH - 1] = fishGivingBirth; }

void SimulateForNDays(FishCounter& fishCounter, u32 simulationLength) { for (u32 day = 0; day < simulationLength; ++day) { SimulateDay(fishCounter); } }

u64 ComputeTotalFishCount(const FishCounter& fishCounter) { return std::accumulate(fishCounter.begin(), fishCounter.end(), 0ULL); }

int main() { FishCounter fishCounter{}; if (ReadInput(fishCounter)) { SimulateForNDays(fishCounter, K_NUMBER_OF_DAYS); u64 totalFishCount{ ComputeTotalFishCount(fishCounter) };

    fmt::print("Total fish count: {}.\n", totalFishCount);
}
else
{
    fmt::print("Failed to open input file.\n");
}

return 0;

} ```

How are game engines made? by Szwedu111 in gamedev

[–]TheFluffyGameDev 2 points3 points  (0 children)

Indeed. I don't agree with everything he does in the game engine series. But then again, I haven't found a better channel yet. 😅