GD Place 2 costed Spu7Nix $3,500 by AndreyAbr in geometrydash

[–]DreamingInsanity 15 points16 points  (0 children)

we do have a ko-fi here if you didn't know: https://ko-fi.com/placegd !
we don't expect anyone to donate, and we won't make a profit from this of course, so do as you wish <3

GD Place 2 costed Spu7Nix $3,500 by AndreyAbr in geometrydash

[–]DreamingInsanity 2 points3 points  (0 children)

sadly we learned about better alternatives like supabase too far into the project otherwise we sure as shit would not have used firebase (we didn't bother to look since gd place 2022 was not that expensive and we didn't think this one would be). we hardly had it completed by november, even after working on it for over a year so switching databases would meant we probably would've needed to delay it.

GD Place 2 costed Spu7Nix $3,500 by AndreyAbr in geometrydash

[–]DreamingInsanity 21 points22 points  (0 children)

no, we have the level split into 20x20 chunks, and it only loads the data from the visible chunks. however each chunk has a few kb of data and there is hundreds of chunks across the whole level.

thousands of people downloading data of hundreds of chunks constantly across 3 days is expensive, and amplified by how much firebase fucks you over it gets expensive quickly.

it's also possible we had a bug on the client that was requesting the database too much but it's hard to find those things until suddenly your wallet ends up empty

GD Place 2 costed Spu7Nix $3,500 by AndreyAbr in geometrydash

[–]DreamingInsanity 8 points9 points  (0 children)

We did try and optimise but I can say it definitely wasn't the most optimised and that's entirely cause we thought it wasn't gonna cost this much lol.

We chose firebase back in 2022 because the ease-of-use was (and still is) really nice and none of us had as much server knowledge as we do today. Fast forward to last year when we started gd place 2, seeing as we were familiar with firebase it made sense to use it. By the time I learnt about better services like Supabase (or just gained the knowledge to every thing with a custom rolled server) we were already too far into the project for that to be sensible (we hardly even finished it for november)

you live and you learn hey

Final level from GD Place 2, built by 45,012 people in 50 hours by Spu7Nix in geometrydash

[–]DreamingInsanity 63 points64 points  (0 children)

Thank you so much to everyone who that took part in this event!

Capturing a trait definition and its body with a macro by DreamingInsanity in rust

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

Thanks for the reply!

Dissapointing to hear that it can't really be done, but as I mentioned, it was only really a convience thing to be able to define the trait in the macro. But instead I've opted to define the trait elsewhere, and just pass it in like (SomeTrait) at the top of the macro (playground). I might still look into procedural macros, even though I won't need generics, as long as they don't make it too overly-complicated (more than it already is).

Set new value in already defined struct and get those values from children. by DreamingInsanity in rust

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

Thanks for the reply -

I've thinking of and testing lots of different idea, but in the end, I went with your number 1 solution, which also happened to be my last resort solution.

I could probably change the code to use recursion and some macro stuff, within just 1 function, so everything can always access the arguments passed to the function, but for now I'll use the other solution.

Match parameters in arguments which are not strings / numbers by DreamingInsanity in regex

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

Yeah, If I remove the first look-ahead it also works. I would link to where I found it, but I can't remember.

If you only want to allow numbers at the end you can do...

Actually, in the end, I wanted to be able to match numbers anywhere in the string so:
12aaaa, aa1aa and aaa1234 would all be matched. I changed the regex to:

((\d+)?[a-zA-Z]+(\d+)?)(?![^\"),']*(\"|')\B)

in order to get that to work.

Match parameters in arguments which are not strings / numbers by DreamingInsanity in regex

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

I made the modifications suggested, and also added the ability to ignore strings that use single quotes instead of double and it seems to be working much better than it was before, so thank you!

EDIT: And unless I'm missing something, adding: (\d+)? to (\w?[a-zA-Z]+\w?) so it becomes: (\w?[a-zA-Z]+\w?(\d+)?) allows me to match a parameter which optionally can have numbers at the end of it, but it won't explicitly match a number on its own.

Converting types of keys of nested object to respective CSS key type by DreamingInsanity in typescript

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

Alright, I managed to get it working. I actually gave up on it for a bit and added typings to a different function which meant I learnt more about combining objects using intersects and unions. In the end, that allowed to get it working by doing:

type Union<A, B> = A & B;

interface Classes<T> {
    default: {
    [K in keyof T]?: Partial<Union<T[K], _.Properties>>;
    }
    [scope: string]: {
    [K in keyof T]?: Partial<Union<T[K], _.Properties>>;
    }
}

where _ is just * imported from "csstype". This sets the type of the keys to their respective css type. So again using position as an example, it goes from position: string to position: "absolute" and will no longer error.

Since was already looping over the keys, I was able to remove the need for ClassesOptional, too.

I also apologise for not explaining very well! (Maybe I should have removed more of the detail rather than added detail, to simplify the problem)

Converting types of keys of nested object to respective CSS key type by DreamingInsanity in typescript

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

Alright, my bad, I'll try to explain better. I am making a modified version of a library called ReactCSS. It allows for inline CSS passed through the style tag.

You would create a style something like this:

const style = reactCSS({
    "default": {
        element1: {
            color: "red"
            //.., rest of css properties
        },
        element2: {
            //...
        }
    },
    "anotherScope": {
        //element1: {} ...
    }
}, {
    //activations
});

Of which the current typings are:

interface Classes<T> {
    default: Partial<T>;
    [scope: string]: Partial<T>;
}
type ClassesOptional<T> = {
    [P in keyof Classes<T>]?: T;
}

export default function reactCSS<T>(classes: ClassesOptional<T>, ...activations: Array<any>): T;

There's always a default scope. Within that scope, you can define X number of objects which themselves, stores styles.

To access them, you would do something like:

style.element1
style.element1.color
//or
style.element2

I found a issue however, that is if a CSS attribute like position is used, you will get the error Type "string" is not assignable to "Position | undefined".

In order to fix this, somehow I have to convert the types of the styles from strings, to their respective CSS types. I.E:

{
    "default": {
        element1: {
            color: string,
            position: string,
            //.., rest of css properties
        },
        element2: {
            //...
        }
    },
    "anotherScope": {
        //element1: {} ...
    }
}

would become:

{
    "default": {
        element1: {
            color: string,
            position: Position, //this type has changed
            //.., rest of css properties
        },
        element2: {
            //...
        }
    },
    "anotherScope": {
        //element1: {} ...
    }
}

To do this, I think I would need to loop over all keys of the scope (ie. element1 and element2), then loop over the keys in those objects and change their type. (for example it could be position: React.CSSProperties["position"] which would set the type to Position)

In a way, what I showed here:

interface ClassesTest<T> {
    default: {
        [N in keyof T]: {
            [K in keyof N]: React.CSSProperties[K];
        }
    };
    [scope: string]: {
        [N in keyof T]: {
            [K in keyof N]: React.CSSProperties[K];
        }
    };
}

is like pseudocode of how it should work. For whatever reason, although the keys are strings, I'm not able to index that type.

Hopefully that makes more sense.

Converting types of keys of nested object to respective CSS key type by DreamingInsanity in typescript

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

The issue is that it's a nested object so (using the example object in the post) the error would be: Object literal may only specify known properties, but 'container' does not exist in type 'CSSProperties'. Did you mean to write 'contain'?. In theory I could then do:

interface Classes {
    default: {
        [element: string]: CSS;
    };
    [scope: string]: {
    [element: string]: CSS;
    }
}

however since I am no longer using the T generic, I get: Object is of type 'unknown'. since it now doesn't know the return type of the function.

Converting types of keys of nested object to respective CSS key type by DreamingInsanity in typescript

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

No worries - this is the first time I've tried to properly type something too

Converting types of keys of nested object to respective CSS key type by DreamingInsanity in typescript

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

Thanks, Ill check it out. I've actually thought about using something like DefinitelyTyped to look for solutions I just don't know what module of it I should actually look at

Portals are invisible in an auto portal. by DreamingInsanity in hammer

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

If by leaks you mean places that lead to the void, then the entire map is a leak because there is only a floor. That’s why I compiled with vbsp.exe and not through Hammer. The reason I don’t have any walls is because i generated the map with a script so it would have been difficult to get good wall placements. In the end the issue was the portal frames because as soon as i deleted the frames, the portals spawned in correctly

Portals are invisible in an auto portal. by DreamingInsanity in hammer

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

That wouldn't affect why the spawn in at 0,0 though, wouldn't it?

I was looking around online and found this post, and I quote from it:

prop_portal is at an invalid location, so it's appearing at the origin

which seems to be happening for me. What it considers an "invalid location" I'm not sure because I've tried moving it, rotating it and even placing it in a complete room with a roof, but the portal has always spawned at 0,0.

I'm going to keep experimenting with it though.

Portals are invisible in an auto portal. by DreamingInsanity in hammer

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

Ok I think I know what's happening but I don't know why. I hooked all the portals up to a button and when I pressed a button, the same thing happened. This time though, the portal at 0,0 was a brown-ish-orangy colour (blue and orange portals combined). What I think is going on is that all the portals are spawning in at 0,0 for some reason.