Game Developers of Kiwi Farms

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
Is there any reason the original would be preferable? It's always been my understanding that spamming if statements is considered bad practice, and I think my version improves readability too.
Yep, that does make more sense. That said, I have a few personal preferences for doing things that might improve it a bit:
Firstly, using Input.get_axis() for input. If you have Input.get_axis("left", "right), it returns 1 if you're holding right, -1 if holding left, and 0 if you're holding neither or both. It makes doing math-related stuff with movement a bit easier, but it might impact readability since you'd replace "left" with movement.x < 0 for example.
There's also a way to do animations that neatly handles all the edge cases, but it's a fair bit more complex and exclusive to Godot. Using the AnimationTree system you can do what your code does, and also strictly determine which animation to play if you're holding both Up and Right for example. This tutorial covers it, it was made during 3.2 but the code should (hopefully) still work for 4.0 and beyond.

I really wish I had a way to show my own projects to prove I'm not just Maldavius Figtree talking advice out of my ass, but I don't want to connect this account with any of my more personal ones cuz opsec.
 
  • Winner
Reactions: Oliver Onions
Is there any recommended approach to a state-driven 2D platformer controller in Unity? I'm just kind of kitbashing some different examples I've seen together, and could use a good reference to follow.
 
Is there any recommended approach to a state-driven 2D platformer controller in Unity? I'm just kind of kitbashing some different examples I've seen together, and could use a good reference to follow.
Don't know if it's the most elegant, but for something that's state-driven, since you're applying a state machine to organize player behavior and using exit conditions to transition the active state, what you can do is let the inputs of the player be considered for conditions as well.

Example: idle / run / jump
Idle goes into run with left/right input, and into jump with the jump button,
Run goes into jump with the jump button, and into idle after lack of left/right input or when left/right are both active,
etc.
 
I really wish I had a way to show my own projects to prove I'm not just Maldavius Figtree talking advice out of my ass, but I don't want to connect this account with any of my more personal ones cuz opsec.
I feel the same. I'm obviously not linking my irl Github portfolio to the Farms, so I dunno if I should make a separate account with this email or an itch.io account to host any games I finish.

In the Game Jam thread a lot of people said we should have web build versions of our submissions so nobody has to download sketchy executables, so it might be worth me knocking together a very basic React site just to host them, unless there are specific places you can do that? I dunno.
 
Is there any recommended approach to a state-driven 2D platformer controller in Unity? I'm just kind of kitbashing some different examples I've seen together, and could use a good reference to follow.
something like this?

otherwise:

I feel the same. I'm obviously not linking my irl Github portfolio to the Farms, so I dunno if I should make a separate account with this email or an itch.io account to host any games I finish.
I wouldn't worry too much, if it's extremely wrong there will be inevitably someone go AKSHUALLY, otherwise lots of roads lead to rome.
 
Nah, I'm talking about the character controller's actual logic, not just the animations. I worked it out, but thanks for the help.

I'm using a modified approach I borrowed from this course, with a character motor class controlling the actual movement itself inspired by this tutorial. I'm making another class to handle the player's input, so I can support splitscreen and the new input system.
 
  • Like
Reactions: Lords Greatsword

Trying to write a UI with SDL. I wonder if there is a guide how to do this shit with minimum spaghetti - amount of "if else" is starting to bother me. Maybe a renderer-agnostic library?
Last time I've seen a UI code was in a book "SDL Game development". But these niggers were deleting a game state while this state was still in a process of execution, I shit you not.
You can't even trust books with this kind of thing.
 
Cheers to all making, fiddling, and experimenting! You're doing great!

Wanted to share two exceptional developers which could serve to motivate/fascinate/inspire.
One is a high-functioning autist, (Archive)
the other is a hippie,
 
  • Informative
Reactions: Lords Greatsword
I've been looking for a while and decided to try and bite the bullet and make a game in Unity already after bouncing around some failed projects, I wanted any person's input.
My basic idea for starting was getting a grid based construction system up and running, since I barely was even able to do anything in this engine I decided to search around for some help online, I've seen barely anything that was up to date, the only thing that is up to date being a guy whos hardcoding his shaders and ignoring Unity's inbuilt grid tilemap system.
My base question being, if you were doing a grid based construction system that supported multiple floors, would a it be better to use Unity's grid and tilemap system or just make everything run off a C# script?
 
I've been looking for a while and decided to try and bite the bullet and make a game in Unity already after bouncing around some failed projects, I wanted any person's input.
My basic idea for starting was getting a grid based construction system up and running, since I barely was even able to do anything in this engine I decided to search around for some help online, I've seen barely anything that was up to date, the only thing that is up to date being a guy whos hardcoding his shaders and ignoring Unity's inbuilt grid tilemap system.
My base question being, if you were doing a grid based construction system that supported multiple floors, would a it be better to use Unity's grid and tilemap system or just make everything run off a C# script?
unity documentation is always up to date, subsystems can be iffy but the forums for it from the beta-phase has answers sometimes.
in general you can still use old stuff even if it's just for learning, then port/rewrite for new system later. one major point people often complain about is that unity has 2, sometimes 3 systems doing the same thing, but this it where that kind of "back-compatibility" is helpful.

it's a moot point since in the end it's user choice what to use and enable. and if you really need feature X there's usually no issue using an older version if necessary, and the editor is becoming more and more modular.

c# is probably faster and more transferable in general, but there's another way:
(not shilling the dude, but he has a lot of helpful videos out there without being a twat - afaik).
 
Trying to write a UI with SDL. I wonder if there is a guide how to do this shit with minimum spaghetti - amount of "if else" is starting to bother me. Maybe a renderer-agnostic library?
Last time I've seen a UI code was in a book "SDL Game development". But these niggers were deleting a game state while this state was still in a process of execution, I shit you not.
You can't even trust books with this kind of thing.
I would just do classic OOP style abstract WidgetInterface class containing onEnterHover/onExitHover methods. Then once mouseMotion event is emitted I would loop over all widgets in current context checking if mouse hovers over some widget, and if is different than previously hovered one(if there was one).
C++:
#include <SDL2/SDL.h>
#include <vector>

struct WidgetInterface {
  virtual ~WidgetInterface() = default;
  virtual void onEnterHover() = 0;
  virtual void onExitHover() = 0;
  virtual bool isInside(int x, int y) = 0;
};

struct CurrentContext {
  std::vector<WidgetInterface *> widgets;
  WidgetInterface *curHover = nullptr;

  void onMouseMotion(SDL_MouseMotionEvent event) {
    for (auto *widget : widgets) {
      if (widget->isInside(event.x, event.y)) {
        if (widget == curHover) {
          return;
        }
        if (curHover) {
          curHover->onExitHover();
        }
        widget->onEnterHover();
        curHover = widget;
        return;
      }
    }
    if (curHover) {
      curHover->onExitHover();
      curHover = nullptr;
    }
  }
};

After that you can add onPress/onClick/onRelease methods etc.
 
Back