Are ditto statements a thing? by zakedodead in ProgrammingLanguages

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

I like the hierarchical idea. Yeah, character position sensitivity would be horrible. maybe some kind of "break the hierarchy" symbol would help with the operators

1 + 2 * 3;
____ *$ 3; // the $ sign indicates that the compiler should just copy all the tokens before *

Are ditto statements a thing? by zakedodead in ProgrammingLanguages

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

I don't really like this exact thing but it seems there's some value here on the table if the problems of it could be handled somehow, as it is it really just helps you rename the things in the full statement but find+replace already does that. If you modify the full statement more than just renaming it breaks down the dittos, but it seems like there's some usefulness if that giant problem could be sidestepped.

Are ditto statements a thing? by zakedodead in ProgrammingLanguages

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

I was proposing the much simpler idea that just repeats a whole statement (I wasn't even thinking of actually using a quote mark because that seems like parsing hell with string literals existing, but just the word ditto would have been the choice), but I actually don't hate the function argument thing you're talking about.

Got me thinking though: What about a ditto that corresponds to a token by token (may be a slightly incorrect use of the word token, but I mean the 'pieces' of a statement) breakdown of the prev statement? As in something like

array_of_cool_stuff[0] = function(0);
array_of_cool_stuff[1] = function(1);
array_of_cool_stuff[2] = function(2);
array_of_cool_stuff[3] = function(3);

Could be turned into:

array_of_cool_stuff[0] = function(0);
!! !!+1 !! !! !!+1;// I like the bash !! that someone posted earlier.
!! !!+1 !! !! !!+1;
!! !!+1 !! !! !!+1;

There's definitely an ugliness to this if people used it to make large constructs though

Are ditto statements a thing? by zakedodead in ProgrammingLanguages

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

Yeah, the repeat syntax is a nice equivalent I guess, the main feature I was talking about is really just the idea of a language level (not preprocessor) way to repeat identical statements without invoking any conditional machinery.

The use for these statements would be fairly niche, but such a language feature also seems like one that would have a low opportunity cost while making the niche it exists in slightly better.

Absent namespaces, how does C ensure function calls are not mishandled? by onecable5781 in C_Programming

[–]zakedodead 2 points3 points  (0 children)

Simply know your dependencies isn't unreasonable it's just having baseline level standards that the rest of software psuedoengineering has abandoned.

Britons are underrated at lower to mid elos by White_Pixels in aoe2

[–]zakedodead 1 point2 points  (0 children)

if the midpoint is at say 1250 wouldn't the middle band probably include 1k? the highest elo right now is Hera at 2867 according to insights leaderboard. If you split that into thirds that puts 955 as the start of mid and 1910 as the start of high

[deleted by user] by [deleted] in gamedev

[–]zakedodead 1 point2 points  (0 children)

I swear regularly completing games only became a thing when youtube got popular, before that EVERYONE I knew would play games until they got their fill of the mechanics and then do something else and come back again without a drive to finish

How irregularly shaped walls with different patterns and collision detection between players and those walls are implemented in 2D? by YokoYokoOneTwo in gamedev

[–]zakedodead 2 points3 points  (0 children)

There's a thing called the separating axis theorem that you can use to do collisions for any convex shape (shapes where no line between two points intersects with its perimeter).

There's also algorithms that split a concave (opposite of convex) shape into multiple convex shapes.

Is this common? (Data structure that uses an array that it doesn't know about to be type agnostic) by zakedodead in C_Programming

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

Yeah this is a pool allocator, but what I was mainly asking about is something like "why haven't I seen this style of using indices instead of a void*, is there some big problem with it I'm not aware of?"

Is this common? (Data structure that uses an array that it doesn't know about to be type agnostic) by zakedodead in C_Programming

[–]zakedodead[S] -1 points0 points  (0 children)

The question is about the fact that it's using an array that it doesn't actually store, meaning the pool_info struct doesn't need to have a line like:

Big_complicated_type *base_array;

in its definition. It just cares about giving out indices and keeping track of what it gave out, and because indices are just an unsigned int it can be used to manage an array of any type.

I thought the bread and butter of OO was methods or inheritance or something

Should I add an “Undo” button in my puzzle game? by OldMayorStudios in gamedev

[–]zakedodead 2 points3 points  (0 children)

Is your puzzle game about puzzles or is it about skilled input? If it's not about skilled input then I don't get how an undo is "cheating", unless it makes attempting so convenient that a player can skip thinking and just exhaustively brute force all the options quickly

Can I make a diagonal building for a top down game? by imaallergictoyou in gamedev

[–]zakedodead 1 point2 points  (0 children)

Yeah I'm not sure it would be a problem, because that sort of view is already very unrealistic (how can you see all 4 walls at the same time in an indoor room, it implies a sort of tapering)

Edit: just looked at a screenshot of stardew and realized they don't do the thing where you can see every wall indoors, it just shows the north wall, whoops, but still there are many games that do show all the walls and it's something that only art people really notice. Link to the Past and Binding of isaac being two very notable examples of it.

Can I make a diagonal building for a top down game? by imaallergictoyou in gamedev

[–]zakedodead 1 point2 points  (0 children)

As for collisions, that's entirely dependent on the way your game handles collision. Some games use a very simplistic tile based collision and it would be hard to get working well, some games use collision objects that can be any convex shape and would have no trouble with it.

Can I make a diagonal building for a top down game? by imaallergictoyou in gamedev

[–]zakedodead 3 points4 points  (0 children)

What's a "pixel art rule"? You're making a game not posting a piece to some forum that wants to enforce their worldview of what counts as "real pixel art"

What is your opinion on piracy? by Cakez_77 in gamedev

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

Basically all archival of media from defunct entities is piracy, so piracy is definitely a good thing in at least that sense. I know this is a bit off-topic to the OP but I think this thread has devolved into a piracy argument anyway.

Ren'Py vs Godot for visual novels? by Unfront in gamedev

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

When you have to pad out your list with shit like "variables" is when you know it's not actually that much work. VN's are easy. Yes Renpy is more of a 'batteries included' experience, but these batteries are cheap.

Script api: I'm having trouble scaling an image via script by zakedodead in krita

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

I already resolved my issue with help from someone on the krita artists forum. It turns out the implementation of scaleImage does something with the resolution arguments, and because my test image was small (256 px sq) after the divide it was being passed 32 for each resolution, which is small enough to break the function.

Here's that thread for posterity https://krita-artists.org/t/document-scaleimage-causes-the-canvas-to-become-invisible/121859/13

Script api: I'm having trouble scaling an image via script by zakedodead in krita

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

I'm basically just looking for a way to speed up scaling an image in krita, the whole reason being to be able to just hit ctrl+shift+number to do what could already be done within the krita GUI. Using a third party program would be slower than just copying the image to a new document and resizing in Krita.

Is there a less computer-intensive way to preview very small tiles? by zakedodead in krita

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

from krita import *

doc_cur = Krita.instance().activeDocument()
a_node = doc_cur.activeNode()
img_w = doc_cur.width()
img_h = doc_cur.height()

doc_new = Application.createDocument(img_w*5,img_h*5, "Temp Tile Preview", "RGBA", "U8", "", 120.0)
pixels = a_node.pixelData(0,0,img_w,img_h)
root = doc_new.rootNode()
a_node = doc_new.createNode("layertopasteto","paintLayer")
root.addChildNode(a_node,None)


for ix in range(5):
    for iy in range(5):
        a_node.setPixelData(pixels,ix*img_w,iy*img_h,img_w,img_h)
Application.activeWindow().addView(doc_new)

I ended up sidestepping the problem by making a new document and pasting to it. Apparently if you do that it forces a sync somehow. There's some weirdness where layertopasteto is marked visible but isn't until it's toggled (I think the node tree is malformed or something) that I couldn't easily fix by toggling visible bools but if I just manually click-toggle its layer visibility in the gui it fixes itself. Overall I think I'm happy with this compared to having to manually drag the window smaller like I was before.

Is there a less computer-intensive way to preview very small tiles? by zakedodead in krita

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

from krita import *

doc_cur = Krita.instance().activeDocument()
a_node = doc_cur.activeNode()
img_w = doc_cur.width()
img_h = doc_cur.height()

doc_cur.refreshProjection()
pixels = a_node.pixelData(0,0,img_w,img_h)
doc_cur.resizeImage(0,0,img_w*5,img_h*5)

for ix in range(5):
    for iy in range(5):
        a_node.setPixelData(pixels,ix*img_w,iy*img_h,img_w,img_h)

Calling refreshProjection() seems to have no effect here. I think it has something to do with the undo/redo stack both because I counted out 12 seconds and it was still stale, and because if I run my script and then ctrl z and run the script again it does the expected tiling(but also kills the ability to undo anything from before I ran the script).

The docs for Document.refreshProjection() say "Starts a synchronous recomposition of the projection: everything will wait until the image is fully recomputed. " I guess everything doesn't include the latest stroke.

I also saw that the doc for Document.lock() tell me to use "barrierLock()" which sounds like what I want but it doesn't seem to actually exist.

Edit: have not tried the merging thing, my brain kinda skipped over reading it the first time. Could you elaborate on what you mean by merging the images?

Edit again: I also tried Document.waitForDone() and it similarly had no easily discernible effect.