#development

1 messages · Page 193 of 1

quartz kindle
#

ye

#

@symbol.iterator

#

for...of basically calls the object's hidden symbol iterator function

#

which executes the iterator pattern

#

so its basically a wrapper for a bunch of functions

frosty gale
#

surprised the engine cant optimize that out if it sees you dont use any of said iterator functions in your code other than accessing the value

quartz kindle
#

because anyone can create a custom iterator

#

so its "unsafe" code

#

lmao

frosty gale
#

actually ill do a quick benchmark on it

#

because i forgot how much it affects perf

quartz kindle
#

here's an example of a custom iterator that i made

#

add those to a class, and you can do for(const a of myclass)

#

you can also use generator functions instead, which are even slower :^)

past field
#

so there’s no way i can use this with v13?

quartz kindle
#

sqlite is a universal independent database

frosty gale
#

50% slower 💀

quartz kindle
frosty gale
quartz kindle
#

basically an array-set-like class that stores data in a single delimited string

#

lmao

#

so i implemented every single array method and some more

#

to make it indistinguishable from arrays

#

so you can do for..of myclass, as well as [...myclass]

quartz kindle
# past field 😭

did you actually try anything with it? like did you try coding something with it?

frosty gale
#

about strings do you know how js compares them under the hood?

#

like does it keep a hash of them

quartz kindle
#

it has a gazilion different structures for different types of strings lmao

past field
frosty gale
#

funnily enough comparing strings by hashes turns strings from one of the slowest data types to being on par with comparing numbers, i hash strings in my database and compare the query string with the strings hash in the record and if it matches it will do a 1:1 compare to make sure its actually the string and not a collision

quartz kindle
#

it starts off as a single string, which can be one of like 3 types depending on which chars it holds, then once you start editing it, its pretty much broken down into linked lists and what not

frosty gale
#

javascript is scary

#

now i need to be worried that my string is a linked list

quartz kindle
#

lmao

#

like

#

when you concatenate a string

#

it wont actually concat it under the hood

#

just join the pointers or something, but its kept as two separate strings

quartz kindle
#

this is pretty much all you need

past field
#

when i install the node module

#

idk i’ll just need to try it

quartz kindle
#

the worst it can happen is the install fails lol

#

it wont delete your pc

quartz kindle
frosty gale
#

does that string ever end up becoming a whole string instead of a linked list

frosty gale
#

what if the concats are like single character length so you append many 1-2 length strings

quartz kindle
#

theres even an npm package for thsat

frosty gale
#

does it follow the same process

quartz kindle
#
radiant kraken
quartz kindle
#

lmao

frosty gale
#

mans hacking the v8 engine

quartz kindle
#

btw i tested it and it doesnt really improve performance in any of my test cases

#

just made it worse

radiant kraken
#

reminds me of lodash functions

frosty gale
#

so the method prob doesnt apply anymore

quartz kindle
#

actually, the delimited string storage class i showd you before, is where i tested this

frosty gale
#

at this rate it would be easier to just not use it

quartz kindle
#

pretty much

frosty gale
#

if you could insert bytes in between two memory locations computers would be OP

quartz kindle
#

lmao

frosty gale
#

no need for these concat algorithms

#

but it causes so many problems

#

im surprised no one figured out a solution to this

quartz kindle
#

indeed

frosty gale
#

idk maybe ram that magically shifts itself in light speed

quartz kindle
#

its the whole basis of the entire memory fragmentation dilema with all those memory allocators

frosty gale
#

just reminded me my kernels memory allocator is awful

#

basically an entire linked list

#

if you need a new block of memory you append to the end of the list with the beginning being some metadata

#

for allocs you first iterate through all blocks to see if one with a good enough size exists

#

would be a good idea to split the block sizes into categories for faster allocations in the future though

quartz kindle
#

you can learn a lot of checking out what big name allocators are doing

#

like jemalloc and mimalloc

#

also, array.shift and array.unshift are fucking terrible for some reason

#
[array] unshifted 99999 strings of 10 chars in 10326.8212ms
[ftset] unshifted 99999 strings of 10 chars in 35.20800000000054ms
[array] shifted 99999 items in 17758.464099999997ms
[ftset] shifted 99999 items in 7.6833000000005995ms
frosty gale
#

arent js arrays just linked lists?

#

i would imagine them to be

#

although what about indexes

#

linked lists have one weakness of being awful with index lookups

quartz kindle
#

pretty sure they are hash tables

#

somehow

#

lmao

frosty gale
#

yep ive had it with this language

#

not using arrays anymore

quartz kindle
#

lmao

frosty gale
#

how do you make performant queues then

#

if unshift and shift are slow

quartz kindle
#

pop and push are fast

frosty gale
#

oh right

quartz kindle
#

so its possible they are actually stacks

frosty gale
#

forgot about those for some reason

#

actually

#

but then that wont work for everything

#

if you want a fifo queue

quartz kindle
#

its probably a composite structure

frosty gale
#

you need unshift eventually

quartz kindle
#

something like a hash table with sorting order stored elsewhere

#

or idk

frosty gale
#

make a custom array in native c++ with node-gyp

quartz kindle
#

lmao

frosty gale
#

although performance penalty of calling native methods will probably outweigh gains in small queues

quartz kindle
#

yup

frosty gale
#

prob a library for that though

quartz kindle
#

you can make a rope with objects

#

with a reference to first item and last item

frosty gale
#

hold on this is a gap in the js ecosystem then

#

i dont really see anything with simple queues on npm

quartz kindle
#

there are many data structures that js doesnt have natively but thaty you can easily do with objects lol

frosty gale
#

if only voltrex was here to chime in

#

explain himself as to why js arrays dont make fast queues

quartz kindle
#
frosty gale
#

oh interesting

#

yeah i see what its doing

#

i think its using offsets to dequeue elements

#

so if you dequeue first element it will add offset of 1 so first entry in array will be second index

quartz kindle
#
    if (this._offset * 2 < this._elements.length) return first;

    // only remove dequeued elements when reaching half size
    // to decrease latency of shifting elements.
    this._elements = this._elements.slice(this._offset);
frosty gale
#

and it removes them when reaching half size

#

this doesnt look like a very good implementation honestly

#

sounds very messy

quartz kindle
#

heres a challenge then

frosty gale
#

can you do a benchmark?

quartz kindle
#

look at each of those datastructures

#

and come up with a more performant one

#

:^)

frosty gale
#

for the queue problem id prob make a linked list out of it

#

wonder how that would differ performance wise

#

actually i might give it a shot

#

doesnt even have to be in c++ can be in js

quartz kindle
#

they have a benchmark in the repo

frosty gale
#

its definitely better thats for sure

#

although actual gains will differ given they clear the dequeues once you reach half the array

#

depends on use really

#

what is their linked list implementation

quartz kindle
#

here

frosty gale
#

not bothered to look through entire code but willing to bet its just chained objects with a last and first entry that points to each other

#

how i wouldve done it

#

wonder if doing this in native would speed things up

#

but then doing that you limit portability of the code

#

and idk how bad performance penalties are with js to native translation

quartz kindle
frosty gale
#

i reckon it could be much better if the translation of native types to js types and vice versa would be more efficient

#

because thats realistically the only overhead here i believe

#

but im not a maintainer so i dont know the challenges of it

#

if they can find a way to eliminate a lot of the overhead from calling native libraries javascript could easily become much faster than it already is

quartz kindle
#

its been a point of conflict between a few peeps

#

like the maintainer of uwebsocket for instance

#

keeps complaining about the node perf team, about how bad it is

#

node had a huge performance regression since node 10

#

which never quite recovered

#

Absolutely. That's what I've been saying for years. The only limit uWS.js has is node::MakeCallback and they manage to tamper with that every release, to our disadvantage.

#

I wrote a benchmark that just does node::MakeCallback a million times in different Node.js versions.

Node.js 8.0.0 does it in 161ms.
Node.js 10.0.0 does it in 193ms.
Node.js 13.8.0 does it in 273ms.
Node.js 13.9.0 does it in 622ms.
Node.js 14.5.0 does it in about 600ms, but sometimes 800ms (huge variations).

past field
#

sigh

#

tim pls

quartz kindle
#

did you try anything yet?

#

im waiting for you to install it and try it lol

past field
#

i’m scared lmao

#

ok i’m about to go to my pc and try

#

npm install better-sqlite3 right?

quartz kindle
#

yes

past field
#

is there a difference between npm i and npm install ?

quartz kindle
#

nope

#

its an alias

frosty gale
#

your computer wont blow up i promise

#

unless someone injected malware into better-sqlite3

#

which i highly doubt at the moment

frosty gale
#

what are they doing

#

this is all voltrex's fault

quartz kindle
#

xD

past field
quartz kindle
#

cmon lol

#

i've never seen anyone scared of using npm install before

#

people usually install too much shit instead

frosty gale
#

bro i hate html when disabling quirks mode you literally cant make a div be 100% of the pages height without a scrollbar appearing

#

what is this shit

#

i see no one complaining about this so this just must be a skill issue somehow

quartz kindle
#

it has like 5px default margin and padding or something

#

its stupid

frosty gale
#

that actually worked bruh

#

i hate web dev

#

thank you

quartz kindle
#

lmao

lament rock
#

have

frosty gale
#

ive been coding my app in quirks mode the entire time bc i literally couldnt center the page without the stupid scroll bar

#

now im trying to move out of it so i actually comply with modern css

quartz kindle
#

you can also use a css normalizer

#

a lot less relevant today than it used to be, but still useful with normalizing certain behaviors between firefox and chromium

frosty gale
#

looks helpful

past field
#

igh i’m finna do it

#

my heart beating fast

quartz kindle
#

????

frosty gale
#

i wish my only problems were a single npm install

quartz kindle
#

same

#

i need to code this big ass function but im kinda stuck with where to begin

frosty gale
#

you already narrowed it down into a function so thats a good start

quartz kindle
past field
#

idk why that was so stressful to me

quartz kindle
#

i need to find the dates when X planets have Y event

#

planets being anything from the millions of things i support
and event being stuff like "planet" reaches X position, or crosses Y difference with another planet
from a list of many possible search patterns which i still didnt finish

past field
quartz kindle
#
const db = new Database('foobar.db');

this creates a new database with the file name you specify

#

if the file exists, the existing database is loaded, if not a new will be created

past field
#

but i add it to my index.js

#

anywhere specific i need to add it?

quartz kindle
#
const statement = db.prepare('SELECT name, age FROM cats');

this creates a statement, which is an SQL command, written in SQL language

#

then you can use one of

statement.run() // run the command
statement.get() // run the command and get the result
statement.all() // run the command and get all results
past field
#

all of this goes into the index.js file?

quartz kindle
#

it goes wherever you want to use it

#
const db = new Database('foobar.db');

this is like the discord client

#

you probably only want one of these

harsh nova
#

(Based better-sqlite3 user)

quartz kindle
#

and then access that one from other files and places

past field
#

shit im lost now lol

#

sorry this is new to me

#

it's gonna take me a min to understand this

quartz kindle
#

sigh..

#

you know the discord client right?

#

the one you create with client = new Discord.Client()

past field
#

right

quartz kindle
#

so you know that you only have 1 client

#

in the entire program

#

no matter how many files you have

past field
#

yes

quartz kindle
#

its pretty much the same thing

#

unless you actually need multiple databases, you will likely have only 1 database in the entire program

#

the database is this const db = new Database('foobar.db');

#

so you likely wanna have that in your index

#

then that db variable is what you use to work with the database

#

ie, write and read stuff

past field
#

ok so

#

ok here are the first 54 lines of my index

#
const dotenv = require('dotenv');
dotenv.config();
const fs = require('node:fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

// Require the necessary discord.js classes and variables
const { Client, Intents, Collection } = require('discord.js');
const token = process.env.DISCORD_TOKEN;
const config = require('./config.json');

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_MEMBERS] });

// Load our commands
client.commands = new Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

const commands = [];
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.data.name, command);
    commands.push(command.data)
}

// Register slash commands
const rest = new REST({ version: '9' }).setToken(token);
console.log('Started refreshing slash commands...');
rest.put(
    Routes.applicationCommands(config.clientId), { body: commands },
);
console.log(`Successfully reloaded ${commands.length} slash commands!`);

// When the client is ready, run this code (only once)
client.once('ready', () => {
    console.log('Ready!');
});

// Our slash command handler
client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return;

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});```
#

so I can add const Database = require('better-sqlite3'); here after the new client instance?

quartz kindle
#

sure

#

it doesnt matter where you put it

#

what matters is that it has to be before const db = new Database('foobar.db');

#

and btw you can name them whatever you want

#

for example you can do this if you want to

const XD = require('better-sqlite3');
const mydb = new XD('randomfile.abc');
past field
#
// This is for my database
const Database = require('better-sqlite3');
const db = new Database('foobar.db');```
#

how do I show the colors

quartz kindle
past field
#

ahh ok thank you

#

i'll just leave the name as foobar lol

quartz kindle
#

sure

past field
#

ok so now I create the statement

quartz kindle
#

now you're gonna be working with the SQL language

#

everything inside the prepare() function is written in SQL

#

not in JS

past field
#

ok so I need to learn the SQL language

quartz kindle
#

yes

#

at the beginning, your database is empty

#

the first thing you must do, is create a table

#

SQL works with tables, which is like an excel file

#

you have rows and columns

past field
#

ok wait

#

sorry tim pls don't hate me man

quartz kindle
#

to create a table, the SQL command is CREATE TABLE IF NOT EXISTS table name here (columns here);

#

now before you create a table

#

you NEED TO KNOW how the table looks like

#

which means, what columns it will have

#

imagine you are creating an excel file

past field
#
// This is for my database
const Database = require('better-sqlite3');
const db = new Database('foobar.db');
const statement = db.prepare('SELECT name, age FROM cats');```
past field
quartz kindle
#

to work with sql you really need to think about what you're doing, so think

quartz kindle
#

for example db.prepare('CREATE TABLE IF NOT EXISTS table name here (columns here)');

past field
#

ok i got you now

#

I get that part now

quartz kindle
#

but first

#

think

#

what do you want the table to look like?

past field
#

um

quartz kindle
#

what kind of data are you saving?

past field
#

so my end goal here is to have my bot be able to save data for certain games and commands that I'm going to do. for example, like people who use /birthday with my bot to input their birthday and I'll have another command like /listbirthdays that will list all of the birthdays that were input into the /birthday command

#

if that makes sense

quartz kindle
#

ok

#

so imagine an excel file for birthdays

#

what columns does it have?

past field
#

Column 1:username

#

column 2: birthday(mm/dd)

quartz kindle
#

very good

past field
#

column 3:age

#

nah nvm

quartz kindle
#

now

past field
#

think i got a 70 yr old in my server ion wanna out her ass like that

quartz kindle
#

in discord, you probably wanna use IDs instead of usernames, because usernames can be changed, IDs cant

quartz kindle
#

and maybe instead of age, you wanna put birth year

#

but anyways

#

so you now know how the table needs to look like

#

so you need to create it

#

like this

past field
quartz kindle
#
const statement = db.prepare('CREATE TABLE IF NOT EXISTS birthdays (id INT PRIMARY KEY, birthday TEXT, birthyear INT)');
statement.run();
past field
#

prepare = columns

#
// This is for my database
const Database = require('better-sqlite3');
const db = new Database('foobar.db');
const statement = db.prepare('CREATE TABLE IF NOT EXISTS birthdays (id INT PRIMARY KEY, birthday TEXT, birthyear INT)');
statement.run();```
quartz kindle
#

yes, very good

#

change the STRING to TEXT, i wrote it wrong

past field
#

and I'd have to create a new table for every different thing I want to have data for?

quartz kindle
#

if those things are very different and it makes sense to have separate tables then yes

faint prism
#

It's been a while! I've mostly been hanging around the C# discord server

quartz kindle
#

otherwise you can think if it makes sense to merge some

quartz kindle
#

for example, you dont need to have separate users and birthdays table, if you put the birthdays in the users already

past field
#

ok i see what you're saying now

quartz kindle
#

now, to make it easier to use, create a new file, like database.js

#

and put this in it:

// This is for my database
const Database = require('better-sqlite3');
const db = new Database('foobar.db');
const statement = db.prepare('CREATE TABLE IF NOT EXISTS birthdays (id INT PRIMARY KEY, birthday TEXT, birthyear INT)');
statement.run();

module.exports = db;
#

and you can remove it from index

past field
#

ok i got you

#

so another question

quartz kindle
#

this way you can easily access the same db from any file

#

by doing const db = require("./database.js")

lament mist
#

hello guys how are you? I know I shouldn't ask this but how long did it take to confirm your Masomenos bot? Does your bot have premium options?

quartz kindle
#

this is the discord for the website top.gg, not the discord for masomenos bot

past field
#

for ```js
const db = new Database('foobar.db');

#

will I have to create a new database for each table?

#

is this 1 db file that will hold all of the tables that i create in it

quartz kindle
past field
#

ok i got you

quartz kindle
#

just like an excel file can have multiple pages

past field
#

ok I'm going to create a new file and put it in there instead of in the index

past field
#

if i decide to call the file database

quartz kindle
past field
#

ok i got you

#

so take it out of my index

#

create database.js file

#

and put ```js
// This is for my database
const Database = require('better-sqlite3');
const db = new Database('foobar.db');
const statement = db.prepare('CREATE TABLE IF NOT EXISTS birthdays (id INT PRIMARY KEY, birthday TEXT, birthyear INT)');
statement.run();

module.exports = db;

#

in it

quartz kindle
#

yes

#

and anytime you need new tables, add a new statement to create a new table there

#

you can also make it a oneliner, ie db.prepare().run()

past field
#

so where do i put const db = require("./database.js")

quartz kindle
#

in any of your command files that needs to access the db

past field
#

ok i got you

#

i see now

quartz kindle
#

now the next step is storing data

#

the SQL command to store data is INSERT

past field
#

ok so all i did just now i create the table

quartz kindle
#

it works like this, for example:

const statement = db.prepare('INSERT INTO birthdays (id, birthday, birthyear) VALUES (?, ?, ?)');
statement.run(member.id, "MM/DD", 1995);
past field
#

ahhh ok

quartz kindle
#

the member id, the day and the year you should get from the discord command interaction

past field
#

and this goes in the database.js file?

quartz kindle
#

it goes inside the command

past field
#

or the command file?

#

ok I got you

quartz kindle
#

and then reading from the db:

const statement = db.prepare('SELECT * FROM birthdays WHERE id = ?');
const result = statement.get(member.id);
#

thats how to get a single entry from the db, based on the user id

#

or if you want to get everything in the table:

const statement = db.prepare('SELECT * FROM birthdays');
const result = statement.all();
past field
#

ok so

#
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('birthdayset')
        .setDescription('Set your birthday')
        .addStringOption(option =>
            option.setName('birthday')
                .setDescription('Your birthday (MM/DD)')
                .setRequired(true))
        .addIntegerOption(option =>
            option.setName('birthyear')
                .setDescription('Your birth year')
                .setRequired(true)),
    async execute(interaction) {
        const { member, options } = interaction;
        const birthday = options.getString('birthday');
        const birthyear = options.getInteger('birthyear');
        
        
        const statement = db.prepare('INSERT INTO birthdays (id, birthday, birthyear) VALUES (?, ?, ?)');
        statement.run(member.id, birthday, birthyear);

        interaction.reply("Your birthday has been set!");
    }
}
past field
quartz kindle
past field
quartz kindle
#

also

#

whenever you're not sure what your database actually has inside

#

you can use an sqlite viewer and load the file in it

#

for example

#

open your .db file with that, and it will show you the contents like this

past field
#

OH

#

BEAUTIFUL

#

thank god that exists

#

ok so with this database

quartz kindle
#

you can use that to confirm that your commands are working

past field
#

let's say i have the data in the tables

#

and I have to reset my bot

#

as long as the bot runs (because it will establish a connection to sqlite) the data will all still be there

#

cause it'll pull from the tables

quartz kindle
#

once saved, the data is never lost, unless you specifically run a DELETE command

#

after your bot restarts, the existing db with all the data will be loaded again

past field
#

ok i got you

#

i got an error

#

it says db is not defined

#

oh is it bc I didnt put it at the top

#

i guess it's saying I don't have a database connection established

quartz kindle
#

well stop guessing and show the error

past field
#

lol tim you are the best man

#
ReferenceError: db is not defined
    at Object.execute (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\commands\birthdayset.js:21:27)
    at Client.<anonymous> (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\index.js:49:23)
    at Client.emit (node:events:518:28)
    at InteractionCreateAction.handle (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\client\actions\InteractionCreate.js:83:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\client\websocket\WebSocketManager.js:346:31)
    at WebSocketShard.onPacket (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\client\websocket\WebSocketShard.js:493:22)
    at WebSocketShard.onMessage (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\discord.js\src\client\websocket\WebSocketShard.js:327:10)
    at callListener (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onMessage (C:\Users\Maurice\Desktop\Da-High-Roller-Bot-main\node_modules\ws\lib\event-target.js:209:9)
quartz kindle
past field
#

so like

#

um

#

idk how to ask my question

#

ok in my database.js file

past field
#

i thought the ```js
module.exports = db

#

was supposed to make the connection

#

right?

quartz kindle
#

no

#

module.exports tells you what you're gonna get when you require() the file

#

if you create a file abc.js and put in it module.exports = 10, then when you do require("./abc.js") you're gonna get 10

past field
#

ok i gotcha

#

um

#

so

#

do i add ```js
const db = require('./database.js');

#

at the top of the /birthdayset command file?

frosty gale
#

yes assuming database.js stores your module.exports = db

#

then you can use the db from the birthday set command file

past field
#
const { SlashCommandBuilder } = require('@discordjs/builders');
const db = require('./database.js');
// Rest of the command login below
frosty gale
#

looks good

past field
#

ok i see now

quartz kindle
#

assuming the file database.js is in the same folder as the command file, that is

past field
#

it's not

frosty gale
#

oh no

past field
#

so i'll move it there

frosty gale
#

oh good

quartz kindle
#

you dont need to move it there

#

what if you have more than one commands folder?

#

are you gonna make a copy of database.js in each folder?

#

also if will fuck up your command loading code

#

it will try to load database.js as if it were a command

past field
#

right i just thought about that because it's a .js file

quartz kindle
#

what you need to do is make sure the path is correct

past field
#

idk what i was just thinking lmao

quartz kindle
#

do you know the difference between ./ and ../ and what they mean?

past field
#

yes

quartz kindle
#

so there you go

past field
#

../ indicates a path

#

right?

quartz kindle
#

yes, ./ is the current folder, ../ is the previous folder

#

so use that accordingly to require the file in the correct location

#

i mean

past field
#

oops sorry

quartz kindle
#

sure, you can use an absolute path

#

but its easier to use relative paths lol

past field
#

i’ve only done the paths when the files are in the same folder so idk how to format relative paths lol

quartz kindle
#

./file.js = same folder
../file.js = previous folder
../../file.js = 2 folders back
../../../file.js = 3 folders back
../abc/files.js = previous folder and then inside folder abc

past field
#

ohhhhhhhhh ok i got you

#

ok birthday command worked

#

now i just need to make my /birthdaylist command that will list out the data that was stored on the chart

quartz kindle
#

good luck

#

im off to bed

past field
#

thank you so much for your help man

frosty gale
#

turns out someone pushed a backdoor to the xz linux library which is bundled with most distros for compressing/decompressing tar files

#

it looks like the update was caught before most major distros added it to their repo but beware if you did any updates recently

#

xz version 5.6.0 and 5.6.1

quartz kindle
#

dayum

#

mine is v5.4.1

#

thank god

frosty gale
#

I don't fully understand how it works but it appears to intercept some function call in sshd for encrypted sessions and does its own thing before resuming normal code

#

it was only found out because sshd logins were 2x as slow from the long work the backdoor was doing

quartz kindle
#

i've been reading on it all morning

#

dude noticed sshd was taking a lot of cpu for apparently no reason

#

as well as getting valgrind errors in some db he was working on

#

which coincided with a system update some time earlier

#

now a bunch of dudes are witch-hunting a group of chinese developers who have been making PRs in a lot of places in the name of loong arch

#

this guy Jia Tan has apparently been secretly planning this for 2+ years

crystal wigeon
#

hey has anyone worked with google adsense?

#

my account got deactivated, and im not sure what to do to activate it again

hidden idol
#

#credits

frosty gale
#

even if you saw it in the makefile youd go "i dont know what that does i probably just dont know makefile"

#

but he still messed up in a lot of places

#

doesnt work on all systems either because of the manipulation of the symbol tables or whatever its doing

quartz kindle
#

its very possible that it could be the work of some spy agency

#

if it turns out to be that, its funny how fast it was discovered by random open source people curiosity

#

lmao

frosty gale
#

since 5.4.3 interesting

#

his commits will probably be looked over since then too

#

the whole projects suspended on github, not sure what thats gonna solve actually

#

github just wanted to do something even if its not particularly useful

quartz kindle
#

they even disabled the original maintainer's account

#

even tho he has nothing to do with it

frosty gale
#

no wonder linux still uses mail lists instead of something like github

#

so the project doesnt get disabled for fun

past field
#

tim!!!

#

thank you again for yesterday man!!!

#

i got birthday set and birthday list working with the database!

#

the only question i’m having is in the event list, it’s only showing the users ID and not display name

quartz kindle
#

if you want to force show their usernames, you need to fetch the user data from discord, then display it

quartz kindle
#

they all end in 00s

#

which means they are getting rounded

past field
#

😳

frosty gale
# quartz kindle its very possible that it could be the work of some spy agency

some further thought, thats possible because why would he go out of his way to insert malicious code in a very highly used open source library after building up so much trust to become a maintainer of xz
a single incident like this gets your reputation tarnished basically forever and you will never be trusted to work in projects of this scale again unless you of course fake your identity

quartz kindle
#

discord IDs have a particular interaction with javascript because they are too big to be represented by normal numbers

#

so you need to do it like this

#

instead of db.prepare(...).run(member.id) you need to do db.prepare(...).run(BigInt(member.id))
doing BigInt(member.id) will ensure the user id is correctly stored in the database by converting it to the correct big number format
OR if you prefer, you can go back to the table settings, and change the ID field from INT PRIMARY KEY to TEXT PRIMARY KEY

frosty gale
past field
past field
#

ok so understanding how this database works now

#

i have something i’ve been wanting to do and i think the way i need to do it makes so much more sense now

#

so i went to create a /hex command that will allow the command user to put a hex code into the parameter, which will have the bot create a color role and assign it to the user.. and they’ll be able to change it which the bot will delete the previous color role, create the new one and assign it

#

so i’d have to create a table with columns like (user.id, current hex code, new hex code) ? and it’ll track who has what and when it’s changing ?

frosty gale
#

I don't think you even need a database to track that

#

you can simply look through the users roles, remove any existing color roles they have, and add the new one

#

stick to simpler solutions first

#

that way your database won't easily go out of sync with the users actual roles and it's much more reliable

past field
#

i’m thinking to deep on it 💀

frosty gale
#

as a general idea for each user's custom role I'd make them start with something like "COLOR:"

#

then when removing any old color roles you can go over the users roles and delete any that start with COLOR:

#

but id be careful creating a custom role for every user im not sure discord likes that

past field
#

that’s a good idea! well it’s only for certain users.. i have server subscribers and one of their perks is being able to change their name color to whatever hex they want

frosty gale
#

that's probably fine then, discord has a total role limit of 250 total roles in each server

past field
#

i was using hexamatic for that but they’ve made their bot private

#

so i figured i can just code my bot to do it

past field
#

is there a way to have the put position the color roles higher up on the roles list so that it can show? (it has admin permissions)

#

nvm

#

i think i got it

#

nvm no i didn’t

frosty gale
#

you dont want color roles being a higher position which have higher permissions

#

you can disable the roles above from showing their colors on the users profile so that the color shows

#

i think on each role above your color roles you should set the colors to this

#

as an example here if a user has the dyno and booster role, the booster color will show because dyno role has no color

past field
#

nvm i got it

past field
#

well

#

I also had it find a specific role Id on my roles list and place all color roles under that specific role ID

dusky idol
#

What usually makes my discord bot consume ram and how can I reduce the ram consumption?
Is it linked to guild count? I haven't sharded the bot yet and it's in ~1900 servers. Well ofc I'm gonna shard it regardless sooner or later but does it have anything to do with the ram issue I'm facing or is it a complete seprate problem

frosty gale
#

but yes it is linked to your guild count since the more guilds, the more channels, messages and users your bot needs to have cached

#

depending on the library youre using they usually have lots of settings now to reduce and fine-tune caching

past field
#

i imagine the cached data with 1900 servers is the biggest factor

#

especially big servers

dusky idol
dusky idol
dusky idol
past field
dusky idol
#

Speaking of databases I too am having a database crisis atp

slim dirge
#

Hi all, just had to share that I'm super chuffed about having just played with AutoMapper for the first time this week and successfully integrated it into my bot! Gotta love learning new tools and mechanisms! kittyhype

quartz kindle
#

5gb at 1900?

#

are you using discord.js?

frosty gale
dusky idol
#

I'm unsure why was it at that earlier thought, I rebooted like 2 hours ago. Before that the reboot was 2 days ago

#

and yes py

quartz kindle
#

lmao

#

anyway, most ram usage comes from channel cache, message cache, member cache, presences

#

check with your library if you can customize limts for those

frosty gale
#

discord.py is very customizable in that regard i think

slim dirge
# dusky idol I checked it's not 5 but 1.3ish right now after reboot. It scales up overtime au...

If I might offer a suggestion, as this is something I've looked into recently as well, consider the flags in your DiscordSocketConfig. It will be different in JS, as I'm using DNET in C#, but the concept should be identical. Consider flags like AlwaysDownloadUsers which caches users, and MessageCacheSize which caches messages, and any other cache-related flags you might have.

If your bot doesn't need to cache messages, for example, set it to 0. This is what DNet has, as an example.

Hope it helps!

dusky idol
slim dirge
sharp geyser
#

@harsh nova think they talking about you

slim dirge
#

lmao

frosty gale
#

@quartz kindle thats another person

#

if it wasnt for that its very likely it wouldnt have been caught for a while

quartz kindle
past field
#

update: i added up and it was indeed not any fun there.

spark flint
#

@modern sable

#

their only messages too KEKW

modern sable
#

ty

rose warren
#

is it just me or is discord's slash command option autocomplete slow? it takes like a second to update the autocomplete results

past field
#

how do i get the coordinates of my png?

#

i used canvas’ fill text to generate numbers on this photo but idk how to get the coordinates to tell it where to put the numbers

queen needle
#

I would just do the math, since the board seems equal sized

past field
queen needle
#

(canvas height - px of border of first square - (height of square/2))

#

Should be center of square

#

idk if that makes sense, if someone else doesn't help I can give better info when I get home

quartz kindle
#

they were pretty alright last time, its been a while since i tested them tho

#

not too slow not too fast

past field
#

thanks !

rose warren
#

It takes like a second or two to load the autocomplete suggestions

#

I mean I get that slash commands are faster because they're cached at the client level, but i kinda expected autocomplete options to load faster than they do lol

#

I'm not even doing a db query or anything to load them it's just an array of objects I'm filtering

quartz kindle
#

especially because you are receiving via ws and responding via http

#

so every time its creating a new http request, which does cost a bit of time, plus whatever latency there is between hosts

rose warren
#

Yeah. It's not painfully slow or anything. I guess it's just the way slash commands load so quickly because they're cached that make the autocompletes feel really slow

quartz kindle
#

yeah, unfortunately there is nothing we can do about that

#

its pretty much the equivalent of discord itself doing a db query on every character typed lol

rose warren
#

Yeah mayaLaugh it kinda sucks that we can't post the option values to the API with the command data

quartz kindle
#

what if you have millions of options :^)

rose warren
#

Free storage topgglol

quartz kindle
#

lmao

rose warren
#

Watch me store my entire logs table

quartz kindle
#

xDDD

#

i need to retest my autocomplete, i did a test drive like a year ago, but never implemented it

#

im gonna use it for stuff like geocoding and celestial object lookup, for which the backend is now working

rose warren
#

I just built a tag command this evening which is how i ran into this

#

Migrating my server's mod bot over to slash commands

#

It's kinda nice for tags because you don't have to remember the tag. I have verbose titles now in the option field but the old slugs work too since they're the value parameters

quartz kindle
#

cool

#

let me try to reboot my autocomplete real quick

past field
queen needle
#

What did you end up using?

past field
#

i can use the marquee tool to get the h x w of the boxes and the coordinates of where the numbers should be posted

eternal osprey
#

hey guys

#

does anyone know a site where i can find free frontend images

#

been trying to find an image for a rocket but it seems fucking impossible

past field
past field
rose warren
#

Their official photography

frosty gale
#

for some reason typing is also sent via http not websocket

#

so if a user/bot wants to indicate theyre typing thats a http request

#

it would make better sense to send over a low latency already established ws connection

quartz kindle
#

it does take a second but doesnt look that bad tbh

past field
#

nvm

past field
#

so what’s the difference between i.update() and await i.reply()

untold glacier
#

I want to buy nitro like you, but I don't have it credits

past field
#

or cashapp boost

untold glacier
#

I don't know how to use it

past field
#

oh wait nvm

untold glacier
untold glacier
untold glacier
#

I'm new to the server and I want to show it to my friends

shut socket
#

Hi

shut socket
untold glacier
#

Is there someone who can help me please?

shut socket
untold glacier
#

Very bad 😭

shut socket
#

Like what do you need help with I mean

untold glacier
#

I just want nitro in my life

shut socket
#

Can’t help you with that one. 😂

craggy pine
past field
#

😂

#

ok so I’m creating a bingo game (discord.js v13) and i’m having trouble getting 2 of my buttons to respond correctly

untold glacier
#

I don't know anyone

#

😭
ذ

craggy pine
#

@clear plinth ^

past field
#

interaction failed to the start button and the show board button, i thought it was because there was no acknowledgment of the button interactions, so i have it send a message to the channel for start and i had it set to send the players an ephemeral of the generated bingo boards when the “show board” button is tapped but no luck

craggy pine
#

Why not just use v14 where buttons are a million times easier to work with

shut socket
#

Or using component interactions for djs13

shut socket
past field
# shut socket Why js 13?

i think v13 was the latest js at the time i started this project and idk enough about this to go through and change the language to v14

shut socket
#

Yeah do that

past field
shut socket
#

Ummm sure topggThink

#

The collector is good but the way that whole command is setup is not great

#

I can convert it to djs14 in the morning if you want

past field
#

is v14 easier to work with? i just started learning all of this coding last month

#

feb 20 to be exact

craggy pine
#

I mean, when I went to v14 from v13 I just re-made my bot entirely using the new stuff. Helped me learn more if I'm being honest since I got to rethink how I made certain things.

past field
#

i’m scared

#

of that

shut socket
#

It’s better for handling purposes I’ll say

past field
#

hm

#

yeah i'm kinda scared

#

is it as simple as just doing an npm install of the latest discord.js and changing the codes to v14 language? or will this require changes within like the index.js or package.json ?

craggy pine
#

I mean it will require you to change your index.js file some but I dont by much. Its still v14 code regarless

#

I'm not even sure if at all actually. But I know the migration wasn't hard.

karmic parrot
#

In discord.js why is my embed title coming out like this? I'd like the server's name to be a hyperlink any help would be great.

Edit: Is it because I don't have "https://" ?

craggy pine
#

exactly why.

karmic parrot
#

Ah ok. I didn't realize that I didn't have it until after I sent the message. 😂

past field
quartz kindle
pale vessel
karmic parrot
shut socket
#

You use database query?

past field
surreal sage
#

I want to have an app (executable) check the status of the user's subscription and restrict access to the app based on that

#

I do not know how I should handle the client-side security

#

Preventing reverse engineering or changing a false to true in a http request with fiddler

lament rock
#

You can have the server provide the content to display

lament rock
#

Then the client can and likely will be hacked

#

If the content is there then there is no stopping it, only preventing it

#

Even if you implemented something like state tracking where you kick the user back to a screen if they access an illegal state, they can just ignore those commands

#

Thought a little more and perhaps you can have the content encrypted and the server can provide you with a key you can use to decrypt the content

#

Though this runs into the issue that once users have the key, they can distribute it and always use the key

#

You can change the decryption key every update unless you somehow find a way to make it time based but I have no clue how something like that would work

rose warren
#

Glad I didn't do anything wrong mayaLaugh

quartz kindle
#

i have many sources for geocoding, some are remote apis, others are local text files

#

the one i tested with autocomplete comes from local text files, queries take about 10-20ms

eternal osprey
#

does anyone know how we can change this hamburger menu frok bootstrap v5.0 to open sideways?

#

So in row format

frosty gale
#

discord needs to add caching to this

#

so you can mark certain autocompletions as global or something

shut socket
#

Eh wouldn’t really be effective

#

You are better of making the autocomplete different for each interaction user with caching the guild or user id upon using the command and using a query or local file definitions to be displayed into the autocomplete function

quartz kindle
#

imagine you change your autocomplete stuff but users are still loading cached autocomplete results on their end

#

unless discord would add a mechanism to clear cache, ie an autocomplete versioning system

#

too much work for a meh feature i guess

#

it would lighten the load on their network tho

eternal osprey
#

what do you guys think of my design?

#

created in bootstrap

frosty gale
#

the hyperlinks either need to be spaced out more to align with the logo and hamburger menu or the logo and hamburger closer together

eternal osprey
#

yeah i can space that part a bit more to align indeed

#

arigatoo

radiant kraken
#

the spaceship should be more in the center imo

#

so it doesn't look so shoved-in

eternal osprey
#

Thanks!!

frosty gale
#

dont listen to me im just posting random margin offsets

crystal wigeon
#

does anyone want to partner with me?

#

on a game bot?

#

im struggling to like balancing the game

#

or if somebody wants to buy it off of me, sure im all for it too

past field
green kestrel
# quartz kindle

just seen this in scrollback.... why is the birthday field a string with two numbers seperated by /?

#

makes me twitch.

quartz kindle
#

(altough it did make me twitch as well)

crystal wigeon
#

I can give it to you for like maybe 10k

crystal wigeon
#

I can give you some %

past field
#

sure you can give it to me for free, you can do anything you put your mind to if you believe in it

crystal wigeon
#

Gae

green kestrel
crystal wigeon
#

With like atk, def etc

green kestrel
#

ok

#

i also made an RPG game 🙂

crystal wigeon
#

Nice

#

Any pointers on how to balance it out

green kestrel
#

balance is hard

crystal wigeon
#

Fr fr

#

but rn it’s out of control

#

Damage is reaching 60m

green kestrel
#

how?

crystal wigeon
#

atk buffs

eternal osprey
crystal wigeon
#

So like take a look at izzi

#

Just topgg izzi

eternal osprey
#

Only bootstrap margins

#

As it automatically scales for you

crystal wigeon
#

and try it out

green kestrel
#

dont give out so many buffs then? how are they able to buff so high

crystal wigeon
#

It’s like a 3v3 jrpg

#

it’s cause people can create their own teams

#

But i wanted to cap it

#

When I do that ppl started crying and saying I nerfed it too much and they gonna quit

green kestrel
#

in my game if i find someone with massive armour/weapon buffs, i know they found an exploit

#

this single player or multi

crystal wigeon
#

No no here sadly it’s not an exploit

#

It’s just how the game works

#

but the thing is should I cap the buff

#

And to how much

#

200%?

green kestrel
#

or increase enemy def to scale with the player

crystal wigeon
#

hmm

#

but that isn’t like right imo cause enemy has some stats of its own with linear scaling

#

Players have made teams that scale their atk exponentially

#

Should I just remove the exponential buffs?

#

People will say i nerfed it too much

#

Idk man it’s taking a toll on me mentally

#

If you can help me solve the problem that’d be great

#

Like maybe take a look at my bot first

green kestrel
#

exponential sounds like a disaster

#

i would make them linear

#

you cant really scale things exponentially

crystal wigeon
#

Mmm

crystal wigeon
#

And I made it exponential buff so some of them become useful

#

Since most of them were useless

green kestrel
#

every bot ive ever played that has exponential things breaks

crystal wigeon
#

Any tips on how I can buff them to make them useful?

#

but what if i add cap

#

What if I cap the buff

green kestrel
#

i was asked to beta test one once and it was just a race to get the final unlock that was exponential scaled thing, then it all broke

crystal wigeon
#

To like 200%

humble gyro
lament rock
#

Make your own library that does math on strings. dont need to worry about 32 or 64 bit integers

humble gyro
#

... just 3 or less times

green kestrel
#

a cap sound sane

lament rock
#

128 bit needs to get on

humble gyro
#

very

crystal wigeon
#

Is there any other suggestion to like balance out the abilities

#

So they become useable

#

I’d appreciate it if you can like join me and help me out tbh

green kestrel
#

make them non permanent, and with a cooldown

#

so people dont just stack a ton of them and keep it on

crystal wigeon
#

So my rpg is like turn based and the skill activates every 3rd round

green kestrel
#

this is kinda why, you plan out game logic first before you write games, a lot of game designers play out their game rules as tabletop

crystal wigeon
#

And there are 15 rounds in a battle

#

Mm I had 0 game dev experience haha

green kestrel
#

if you can get away with it and your players wont hate or desert you, throw it all out for a version 2

#

and design the version 2 on paper first

#

make something you can test with dice and paper

#

and try it, over and over looking for things that dont work right

crystal wigeon
#

No it’s more things do work right just need some good buffs to balance them

#

Hmm

#

also I mostly also need like game mode ideas

green kestrel
#

if it depends completely on buffs to make it work it sounds like the balance is just off

crystal wigeon
#

how so

green kestrel
#

should be playable and enjoyable without having to have buffs

#

?

quartz kindle
#

a good idea is to make buffs either scale multiplicatively with themselves or make them scale additively but give them dimnishing returns

crystal wigeon
#

it is. It’s just that people don’t use some abilities cause it deals less damage compared to atk buff abilities. Ofc they would deal less damage but they have other perks like def buff etc

#

It’s hard to explain id say. You should totally checkout the bot

green kestrel
#

in my game, i have some buffs i havent ported to the bot yet, they have withdrawl! so, for example you can cast a spell to get increased sneak, it works for X amount of time but afterwards your sneak is REDUCED to half... you can keep casting, but the effects are cumulitive

crystal wigeon
#

Yeah mine is like idle rpg tbh you just build a team and battle it out with round based system where a skill can activate every 2 rounds or 3 rounds and these skills give an atk/def buff

#

There’s more than just atk and def buff tho

#

Like hp regain

#

Etc

green kestrel
#

mine is the opposite of idle rpg

#

a full open world with a story

crystal wigeon
#

nice

quartz kindle
#

can you show an example of how the damage goes to 60 million?

crystal wigeon
#

I need some ideas too

quartz kindle
#

like how much base damage and which buffs get you there

crystal wigeon
#

it’s mostly because somebody has 3 cards in their team that buff atk

#

Base damage is pretty balanced it’s about 1-2k

#

so if you have 100 base atk, upon skill activation it goes to maybe 125. The skill giving 25% buff

#

Now you have 3 atk buffing cards in team

#

Some of them give 10% some 15%

#

So now your atk has increased from 100 to somewhere about 175

#

that should be ok

#

But ig I just have to add a cap

green kestrel
#

should have got spiffing brit to play it BritishMe

quartz kindle
#

i wouldnt add a cap

crystal wigeon
#

Then how would you balance it

quartz kindle
#

how do the buffs scale so hard?

#

do you do like

#

100 * 1.25 * 1.25 * 1.25?

crystal wigeon
#

Ye

#

That’s a recent change i made

quartz kindle
#

how about instead you do 100 * (1 + 0.25 + 0.25 + 0.25)

crystal wigeon
#

that’s how I had it before

#

But players keep complaining lol

green kestrel
#

players will always complain

crystal wigeon
#

it’s more they say it doesn’t buff enough or something

quartz kindle
#

and now they complain it buffs too much?

crystal wigeon
#

Nah

#

Why would they company when something breaks lol

quartz kindle
#

then if they are not complaining why not leave it lol

crystal wigeon
#

lol

#

But it ruins the game

quartz kindle
#

how about you buff other things

#

like def and hp

crystal wigeon
#

yeah doing that too

#

There are abilities that do that

quartz kindle
#

introduce strats that are anti-buff

#

monsters/teams that cancel buffs

crystal wigeon
#

yeah those are there too

quartz kindle
#

and ruin the lifes of mass buff builds

crystal wigeon
#

Ye people tend to avoid such boss lol

#

welp

quartz kindle
#

make more bosses do that

#

make all bosses do that

#

game balancing is a perpetual cat and mouse chase

crystal wigeon
#

If I do that it won’t make the game fun cause every time you only have to build atk buff teams

#

Fr

quartz kindle
#

if something gets too powerful and overused, either nerf it or buff something else

#

and then people will figure out something else to abuse

#

then buff/nerf again

crystal wigeon
#

Ngl that’s why I need a game dev help

quartz kindle
#

people will always find out a new way to abuse the game

crystal wigeon
#

It does require one to go through the game to help me balance this out tbh

quartz kindle
#

if you made 40k last year, you should be able to hire some help no?

crystal wigeon
#

Didn’t make any this year kekcry

quartz kindle
#

lmao how come?

crystal wigeon
#

players left after a game mode update I made to make many of the skills useful

#

I nerfed “damage” in context. When the game was broken before people always did 400k damage etc that stayed normal for a long time then i modified the game damage formulae as I learnt new things to balance it out

#

Things finally started balancing out but damage was only like 40k which is what was expected

#

So people just deserted cause they can’t do 400k damage anymore lol

quartz kindle
#

it happens a lot, people get used to some op strategy then quit when it gets patched because too lazy to learn a different strat

crystal wigeon
#

ye but sad part is I also left a lot of bugs in the game which players thought are features

#

Then when I fixed those they quit

#

So like 80% gone

quartz kindle
#

rip

crystal wigeon
#

yep so now I need to think of a new game mode to save it

quartz kindle
#

does it have pvp?

crystal wigeon
#

yep

#

People don’t do it cause they think all abilities are useless

quartz kindle
#

thats usually where people tend to invest more, because of their competitive nature

crystal wigeon
#

yeah

#

But because of all the buffs and nerfs they’ve given up on PvP

#

that’s where balance comes in

quartz kindle
#

pvp always requires periodic rebalancing, theres no way around it

crystal wigeon
#

I’m trying to balance out the skills so they can be used in PvP

#

Mm

quartz kindle
#

pvp can never stay the same, there always need to be fresh things

#

otherwise people get bored

#

also, people like tournaments and stuff

crystal wigeon
#

any ideas for PvP mode?

quartz kindle
#

competitions with prizes

crystal wigeon
#

Yeah

quartz kindle
#

rankings

#

etc

crystal wigeon
#

They do that on their own

quartz kindle
#

do you have some sort of ladder/mmr system?

crystal wigeon
#

Nop idk how to do that

#

I tried match making and it sucked

quartz kindle
#

that would be a good feature to have

#

look into ELO ratings

crystal wigeon
#

But how does it work tho

#

Wins / loss?

quartz kindle
#

yeah

#

ELO is what they use in chess

crystal wigeon
#

You also need significant amount of players

quartz kindle
#

the points you get or lose depend on the ranks of both players

crystal wigeon
#

Cause if there’s only 1 guy who reached x elo. How would you match him?

quartz kindle
#

that cant really happen

crystal wigeon
#

With my small player base that’s what happened

#

I tried the mmr system before

quartz kindle
#

if the elo difference is too big, the bigger elo will earn little to no additional points

crystal wigeon
#

Based on wins and loss

quartz kindle
#

like if both players have 1000 elo

#

the winner can get like 25

#

and the loser loses like 20 idk

#

if one player has 2000 elo and the other 1000

#

then the 2000 elo player would get like 1 point if they win

#

and the 1000 elo player would get like 100 points if they win

frosty gale
quartz kindle
#

its a pretty self balancing system

crystal wigeon
#

But you shouldn’t really be matching 1k elo with 2k elo right

quartz kindle
#

exactly

crystal wigeon
#

That’s broken

quartz kindle
#

but if there are no players left, thats what will happen

crystal wigeon
#

hmm

quartz kindle
#

then its up to your settings, if you prefer to let those matches happen, or if you prefer to tell the player that no matches were found

crystal wigeon
#

but if that’s too frequent it won’t be much fun

#

Like if the same players face each other

quartz kindle
#

usually the match making will spend some time looking for similar elo players

crystal wigeon
#

And that’s what happened too

quartz kindle
#

and gradually increase the range if it starts taking too long

#

until a certain limit

crystal wigeon
#

yeah but imo you still need atleast more than 1k players

quartz kindle
#

nah

#

a few dozen players is enough for a start

crystal wigeon
#

otherwise it just keeps going in circles with same 2 people being matched

quartz kindle
#

another possibility is adding bots/ai

#

for when no other player was found

crystal wigeon
#

did that too yeah

#

most of the time players just got matched with bots

quartz kindle
#

exdee

quartz kindle
#

if the game is pretty much idle/automated

#

the players dont necessarily need to be both online and searching for a match, for it to happen

#

players could "enable" their team for matches, and they would be available for matches even if the player is offline

crystal wigeon
#

Yeah I just matched people based on their mmr and showed them logs if someone attacked them

quartz kindle
#

well sounds like you already did a lot

crystal wigeon
#

yeah I did and it didn’t work much as I expected

#

Due to lack of playerbase some players who reached high elo always just battled bots

#

it didn’t workout much

#

Had like 300 players at the end who tried it out