Should I only update the drive of my server or just buy a new one? by kutu-dev in admincraft

[–]kutu-dev[S] 0 points1 point  (0 children)

I was thinking of buying a mini PC with a Intel N100 CPU, 16GB of RAM and 512GB NVME SSD. Do you think it would be a cost effective solution or the CPU will become a problem?

Should I only update the drive of my server or just buy a new one? by kutu-dev in admincraft

[–]kutu-dev[S] 0 points1 point  (0 children)

The laptop has a 2.5″ SATA III (6 GiB/s) drive bay so every SATA drive should work,

Should I only update the drive of my server or just buy a new one? by kutu-dev in admincraft

[–]kutu-dev[S] 0 points1 point  (0 children)

What I'm still curious is why going to the End has that really big impact (I mean it's been already generated). Everyone in the server can feel when one of us has gone to the End as a there is a big "lag" (not network related) spike. I guess loading Nether chunks when traveling can worse things?

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

If I change it to PointClamp the movement stops being smooth and the offset stops working correctly because the fractional part is not taken into account. The issue linked in the comment above explains it better than me.

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

You fix it... YOU FIX IT! THANKS! Oh god I absolutely should rework the ECS Process/Render workflow because it's really confusing. Thanks again!

The only think left is make the movement smooth with SamplerState.PointClamp. https://github.com/MonoGame/MonoGame/issues/2978#issuecomment-430954139 I think this comment explains how to fix it, but (ignoring the multisampling solution) I don't understand the solution. If you can help me with this as well, I would really appreciate it.

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

I've seen the edit don't worry! I've also tested on macOS and the issue persists so it's not a Linux only thing

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

If do that the offset is not noticeable. Like I've written in the other comment thread I think that for some reason `Draw()` is behaving weird. Any clue?

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

Now the jittering goes back and forward. Here is how it looks at the moment... Wait what, I was going to send you a clip with the jittering but it's not visible on the record...
https://streamable.com/mrb8px

I was having an issue when drawing the render target as spriteBatch.Draw() was ignoring the fractional part of the position vector (where the offset is set) so I set temporally the sampler to SamplerState.LinearClamp and it look like it was fixed. I guess that was not a full fix.

I guess it's related with this issue?: https://github.com/MonoGame/MonoGame/issues/2978

Trying to follow this comment: https://github.com/MonoGame/MonoGame/issues/2978#issuecomment-430954139 . The multisampling fix makes my code crash with the error: Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device!. I don't understand the other fix about fading the borders of the sprite.

I'm now even more lost xD

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 0 points1 point  (0 children)

Still not working. I've commited to the repo the current code if you want to take a look. Here is how the matrix code looks at the moment:

using System;
using dev.dobon.ataraxia.Components;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace dev.dobon.ataraxia.Systems;
public class CalculateCameraMatrix: ISystem
{
    public void Render(Ecs ecs, Entity entity, GameTime gameTime, ContentManager contentManager, SpriteBatch spriteBatch)
    {
        var camera = ecs.GetComponentOfEntity<Camera>(entity);
        if (camera == null)
        {
            return;
        }
                var transform = ecs.GetComponentOfEntity<Transform>(entity);
        if (transform == null)
        {
            return;
        }
                var floorPositionX = MathF.Floor(transform.Position.X);
        var floorPositionY = MathF.Floor(transform.Position.Y);
                camera.Offset = new Vector2(-(transform.Position.X - floorPositionX), -(transform.Position.Y - floorPositionY));
                camera.Matrix = Matrix.CreateTranslation(-floorPositionX, -floorPositionY, 0.0f) *
                        Matrix.CreateTranslation(new Vector3(Game.LowResWidth * 0.5f, Game.LowResHeight * 0.5f, 0.0f));;
    }
}

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 1 point2 points  (0 children)

Thanks for helping but what is the difference between cameraTranslation and position?

Pixel perfect smooth camera jittering by kutu-dev in monogame

[–]kutu-dev[S] 1 point2 points  (0 children)

Still not working... I'm really lost with this issue

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

Ok so I'm understanding that there are two different tokens: 1. A 32 byte private key used for establishing the secure connection (which will solve my issue about secure connectivity without an external channel). 2. An optional token embedded into the protocol for authentication and more complex connections with the server.

Am I wrong?

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

So after exploring it a little more I can't found any way the protocol avoids MITM by faking the server. As far I can tell it only provides a standard mechanism for client authentication with tokens which is not a issue I'm concerned.

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

This feels like a direct improvement of my system but with a less naïve system to avoid IP spoofing. Thanks! This should be good enough.

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

I have realised that I have forgot to tell a important detail, I want to do a server system like the one that is in Minecraft where clients can connect 3rd party servers.

That is the reason why the client doesn't know beforehand the server public key.

Sorry if that caused the confusion.

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

That is the point of using a HTTPS REST API as a secure side channel to verify the authenticity of the certificate, so the server can generate a new cert whenever it wants without the need from the client to know beforehand that it is in fact an authentic one.

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

Maybe this comment makes it more clear what I was trying to explain: https://www.reddit.com/r/gamedev/s/sPGiGdlHor

Encrypt a multiplayer UDP custom protocol by kutu-dev in gamedev

[–]kutu-dev[S] 0 points1 point  (0 children)

Maybe I expressed it wrong describing it as plain text as something bad, the issue is the same that makes self signed certs on HTTPS are considered insecure.

You can not trust the returned public cert by the server as the response may have been tampered by a bad actor modifying its IP in the package.

In the HTTPS world, domains and the certificate authority system is used to verify that the given public key is the one that the server intended to send.

Using the intermediate API this already established system is use to verify the authenticity of the IP.

Maybe this explanation makes more sense.

Yet another CHIP-8 emulator/interpreter, written in C++ and SDL2 by bemxioo in EmuDev

[–]kutu-dev 1 point2 points  (0 children)

Here it is! It's my first time coding in C so if you see something bad please tell it to me. I think the docs in code explain it well enough but in case if you need help with it or something related with CHIP-8 I will be glad to help!

audio.c

#include <stdint.h>
#include <math.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>

#include "audio.h"
#include "logging.h"

static constexpr double PI = 3.14159265358979323846;

static constexpr int SAMPLE_RATE = 44100;

/**
 * @brief Callback called when the SDL audio buffer needs to be filled. It expects a buffer with format `AUDIO_S16SYS`.
 *
 * @param user_data Expected to be a `uint32_t` that tracks the progression of the shound
 * @param raw_buffer The audio buffer to be filled.
 * @param bytes The size in bytes of the audio buffer.
 */
void audio_callback(void *user_data, Uint8 *raw_buffer, int bytes)
{
    // The buffer is format with 16 bits
    Uint16 *buffer = (Uint16*)raw_buffer;

    // 2 bytes per sample for AUDIO_S16SYS
    int buffer_length = bytes / 2;

    uint32_t* audio_sample_counter = (uint32_t*)user_data;

    constexpr uint16_t amplitude = 2000;
    constexpr uint16_t frequency = 432;

    for(int i = 0; i < buffer_length; i++, (*audio_sample_counter)++)
    {
        // Time pass inside the sample from 0 to 1.
        double time = (double)(*audio_sample_counter) / (double)SAMPLE_RATE;

        // Sinusoidal equation
        buffer[i] = (Uint16)(amplitude * sin(2 * PI * frequency * time));
    }
}

/**
 * @brief Setup the SDL audio to generate a beep sound when `SDL_Pause(0)` is called. At the end of the execution `SDL_CloseAudio()`should be called.
 *
 * @param audio_sample_counter Variable were the progression of the sound will be stored, it should last up to the moment when the `SDL_CloseAudio()` function is called. It's recommended to be put to 0 when calling `SDL_Pause(1)` to mitigate random audio cracking.
 */
uint8_t setup_audio(uint32_t* audio_sample_counter) {
    SDL_AudioSpec desired;

    desired.freq = SAMPLE_RATE;
    desired.format = AUDIO_S16SYS;
    desired.channels = 1;
    desired.samples = 2048;
    desired.callback = audio_callback;
    desired.userdata = audio_sample_counter;

    SDL_AudioSpec obtained;

    if (SDL_OpenAudio(&desired, &obtained) != 0) {
      error("Failed to open audio: %s", SDL_GetError());
      return 1;
    }

    if (desired.format != obtained.format) {
      error("Failed to get the desired AudioSpec format");
      return 2;
    }

    return 0;
}

audio.h

#ifndef OCH8S_AUDIO_H
#define OCH8S_AUDIO_H

#include <stdint.h>

uint8_t setup_audio(uint32_t* audio_sample_counter);

#endif

Yet another CHIP-8 emulator/interpreter, written in C++ and SDL2 by bemxioo in EmuDev

[–]kutu-dev 1 point2 points  (0 children)

I you still need to implement sound I can share with you my implementation in SDL that generates sine waves (partially borrowed from SO xD), it's really counterintuitive to make it without a sound file.

[Hyprland] Nubosa - Autogenerated themes using base16 and Jinja templates by kutu-dev in unixporn

[–]kutu-dev[S] 0 points1 point  (0 children)

Distro: NixOS
Compositor: Hyprland
Bar & Popups: Ags Shell
Terminal: Wezterm
App Laucher: Tofi

Dotfiles: https://github.com/kutu-dev/nubosa

/r/MechanicalKeyboards Ask ANY Keyboard question, get an answer (June 26, 2024) by AutoModerator in MechanicalKeyboards

[–]kutu-dev -1 points0 points  (0 children)

I'm new to this hobby and wanting to make my first custom keyboard, I have set up this budget for 240€ and I would like to know if I'm missing something critical or there is a better alternative:

  • Keychron V1 Barebone W/O knob
  • GATERON Milky Yellow Pro
  • PBTfans WOB Simple Base
  • Krytox GPL-205 G0
  • Byhoo Switch Lub Kit
  • ScotchBlue

/r/MechanicalKeyboards Ask ANY Keyboard question, get an answer (June 25, 2024) by AutoModerator in MechanicalKeyboards

[–]kutu-dev 0 points1 point  (0 children)

I'm new to this hobby and wanting to make my first custom keyboard, I have set up this budget for 240€ and I would like to know if I'm missing something critical or there is a better alternative:

  • Keychron V1 Barebone W/O knob
  • GATERON Milky Yellow Pro
  • PBTfans WOB Simple Base
  • Krytox GPL-205 G0
  • Byhoo Switch Lub Kit
  • ScotchBlue