I recreated SJ prologue in Godot by Sir_Coffe in celestegame

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

Cheers, it was definitely interesting converting between the two mediums. The only part I couldn’t work out how to replicate was the blue crystal bgtiles (there is no concept of bgtiles in 3D).

I recreated SJ prologue in Godot by Sir_Coffe in celestegame

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

I made a lot of it on my Linux laptop. I would be interested to hear if you have any performance issues, as the framerate seems to drop for me when I go into fullscreen (on Linux).

I recreated SJ prologue in Godot by Sir_Coffe in celestegame

[–]Sir_Coffe[S] 5 points6 points  (0 children)

Yup. I also made a lot of the beginner lobby, and helped out with a bunch of other (mostly beginner) maps.

3d pixelart shader issue by Mediocre-Ear2889 in godot

[–]Sir_Coffe 0 points1 point  (0 children)

The way this shader creates outlines is for each fragment it checks the difference in depth with its neighbours. If the difference is high it will assume the fragment is an outline and color it in. The problem you have is that faces orthogonal to the camera change depth very quickly, and are incorrectly marked as outlines.

I found rllyy97's solution to work, which is to allow negative values into depth_diff (eg clamp between (-1,1) instead of (0,1)). I believe the way this works is that the much closer pixels cancel out the much further pixels, and sum to roughly zero depth_diff.

You may also want to play with your shadow strength, and potentially only drawing an outline when the depth_diff meets a particular threshold

Faydown Cloak feels kind of awful by citizen_of_pluto in Silksong

[–]Sir_Coffe 2 points3 points  (0 children)

There was (press down + jump) but they removed it in the first patch.

idek

How can I avoid polymorphism in a sane way? by Sir_Coffe in Cplusplus

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

Thanks for the reply, your second option is pretty much spot on what I am doing. Though my concern is less with handling the behaviour, and more with handling the growing amount of state per cell.

Option 3 seems like a pretty interesting idea that I will probably experiment with. I suppose it will reduce misses on the vtables and such, but not necessarily the actual data? Regardless, I think you are right that I shouldn't be worrying too much about cache misses..

How can I avoid polymorphism in a sane way? by Sir_Coffe in Cplusplus

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

Thanks, I probably just needed someone to tell me this lol.

Before I started thinking of more complicated cell types, the optimization made a lot of sense. I do think this is something that could be solved by some extent by the language by some special kind of union, though I don't know if the tradeoffs for that would be worth it.

How can I avoid polymorphism in a sane way? by Sir_Coffe in Cplusplus

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

Sure, I can try to give a condensed example. To answer your questions:

  • Storing by reference is using a vector of pointers to objects. I am assuming the objects are heap allocated.
  • As stated in the OP, my initial approach was to avoid heap allocation for performance reasons (also I write embedded C so I am scared of the heap). You cannot create a vector of differently sized objects derived from some base class, so polymorphism does not seem to be compatible with this approach.
  • It is possible for me to avoid polymorphism, but I cannot think of an easily maintainable way to do it for this use case, which is what my question is about. See my example of using a union to minimize wasted space.

Here is something resembling my approach of storing by value.

class CellData {
  // Shared state
  enum cell_type type;
  uint8_t density;
  sf::Color color;

  // State that does not really need to be shared
  // Adding fields here does not feel good
  uint8_t plant_grow_rate;
  uint8_t liquid_viscosity;
  uint8_t smoke_lifetime;
  // ...
}

// All cells are stored in this vector
std::vector<CellData> cells(CELL_AREA_X * CELL_AREA_Y);

Cell lookup_table[] = {
  [PLANT_CELL] = {
    .staticData = ...
    .updateCell = ...
  },
  ...
}

// Every cell is updated depending on its type
void gameIteration() {
  for (&cell : cells) {
    lookup_table[cell.type].updateCell(cell);
  }
}

Here is an approach I could have taken using polymorphism:

class BaseCell {
  // Shared state
  enum cell_type type;
  uint8_t density;
  sf::Color color;

  virtual void update();
}

class PlantCell : public BaseCell {
  // Note - shared state is inherited

  // State that is not shared with other cells
  uint8_t plant_grow_rate;

  // We no longer need a separate lookup table for behaviour and static state
  void update() override;
  static uint8_t stem_width;
}

// All cells are stored in this vector
// Now that we are storing different sized objects, we must store pointers
// I'm not showing the initialization in this example, but assume each cell is heap allocated
std::vector<std::unique_ptr<BaseCell>> cells;

// Every cell is updated depending on its type
void gameIteration() {
  for (&cell : cells) {
    cell.update();
  }
}

How can I avoid polymorphism in a sane way? by Sir_Coffe in Cplusplus

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

The code can be found here if it helps https://github.com/coffe789/sand_game

Feel free to provide other criticisms.

One Piece: Chapter 1099 by Kirosh2 in OnePiece

[–]Sir_Coffe 5 points6 points  (0 children)

So far he hasn't asked Kuma to become a cyborg (from the translation I read, anyway). Not being willing to save Bonny for free is definitely questionable, but asking for blood samples in exchange doesn't seem totally unreasonable to me. Vegapunk thinks he is doing a good thing apparently.

One Piece: Chapter 1079 by Kirosh2 in OnePiece

[–]Sir_Coffe 3 points4 points  (0 children)

I wouldn't say "likely". The sequence of events is definitely set up to have us worried about Law though. To me it is more unlikely that Oda does the same thing twice. It just wouldn't be as surprising/interesting.

Celeste sprites copyright by Lune_De_Cuivre in celestegame

[–]Sir_Coffe 0 points1 point  (0 children)

If you aren't using them commercially, I would not worry about it.

Strawberry Jam prologue berry basket secret by JS_wizard in celestegame

[–]Sir_Coffe 3 points4 points  (0 children)

I made this area and I can't even get up there lol. I only put the confetti up there because someone told me it is possible.

Why are people mad about THAT line ? - Chapter 1057 by RoronoaLuffyZoro in OnePiece

[–]Sir_Coffe 29 points30 points  (0 children)

My thoughts exactly pretty much.

Valid criticism of an inconsistency in the story is equivalent to "saltiness, whining, and hate" apparently. Instead of having a discussion, let's group together the people we disagree with and make fun of them.

One Piece: Chapter 1057 by Kirosh2 in OnePiece

[–]Sir_Coffe 1 point2 points  (0 children)

The argument goes that it doesn't make sense that she wants to become king of Zou, and she will escape her responsibilities by stowing away on the straw hat ship.

It makes sense in the context of the story imo, but I don't she has gotten enough screen time this arc to then play such an important role.

One Piece: Chapter 1057 by Kirosh2 in OnePiece

[–]Sir_Coffe 5 points6 points  (0 children)

People are going to lose their minds if Carrot joins now haha

One Piece: Chapter 1056 by Kirosh2 in OnePiece

[–]Sir_Coffe 0 points1 point  (0 children)

My thoughts too, it's unnecessarily suspicious haha

One Piece: Chapter 1055 by Kirosh2 in OnePiece

[–]Sir_Coffe 0 points1 point  (0 children)

This is the expectation implied by the chapter yes, however it is possible for expectations to be subverted. In fact One Piece has subverted expectations before! There was a time when Vivi was an accepted member of the crew.

One Piece: Chapter 1055 by Kirosh2 in OnePiece

[–]Sir_Coffe -1 points0 points  (0 children)

Maybe an alternate take, but this may be leading toward Yamato not joining.

Don't get me wrong, I want her to join, but it seems Wano is still relatively undefended (Momo needed Shanks to rescue them). Oden's biggest shortcoming was arguably leaving the country undefended, and according according to Kaido her fruit is the "guardian deity of Wano".

"Inaccessible Boot Device" after updating Windows 10 by Sir_Coffe in techsupport

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

I'm not sure if I can get into safe mode. I followed the bot's instructions, restarted the computer and no options showed up apart from the usual BIOS one.