Need clarification about minimum number of children of root of B-trees

Hello. I'm sorry if this is a beginner question.

I'm preparing for an exam in database design, and a question about B-trees has me doubting the knowledge I have about them: it says specifically I have to consider a B-tree of height 3 where the root node has double the minimum amount of children a 3-levelled B-tree can have.

The number of children in question I think is 4, since I know the root of a non-empty B-tree can have as little as one key, and thus at minimum as 2 children, however I also know that, during the insertion, before increasing the level of the B-tree we always try to organize elements towards the top of the tree, so that we fill the upper levels first before going down.

That seeded the question in me about whether or not, in any realistic case, we could expect the root of a 3-level B-tree to have 2 as the minimum amount of children, rather than something higher; the more I think about it, the more my answer seems correct, looking through the material I don't see any confirmations or denials other than that rule that the root can have as little as 2 children theoretically, however I keep asking myself the question: "if a B-tree ever reached 3 levels, wouldn't it always be organized so that it contains more than one key? So shouldn't the minimum number of children be higher than 2?", the answer to this seems to be "not necessarily" but I'm very unsure, so just to be extra sure I decided to ask here.

Sorry again if this question has an obvious answer, I am brawling with some serious doubts here and, since due to lack of time (or probably just me being slow) I didn't do well in the written half of the exam (don't even know if I passed it but whatever), I want to be certain of my knowledge for the oral part.

Also probably won't reply to your comments immediately since I'm going to bed; thanks in advance.

reddit.com
u/Mafla_2004 — 5 days ago

Why do animators shrink the pupils of their (stylized) characters when they're afraid, when in real life the pupils of a scared person get wider?

Hello. Highly specific question that I remember wondering for a while.

I noticed that, in stylized animations, when a character is afraid/scared their pupils shrink almost to dots, which is the opposite behaviour to what happens to real life people and animals when they're scared (they actually get wider), I was wondering why do animators make this choice? And why do we still interpret that as a clear show of (stylized) fear when the real behaviour is the complete opposite? Is it because it makes the rest of the eye look wider or is there something else going on?

reddit.com
u/Mafla_2004 — 14 days ago

Friend having trouble installing Unreal Tournament 1999 on Linux (Ubuntu 26), can't find package ALAudio

Hello.

My friend wanted to install UT99 on her Linux machine, she went on the OldUnreal website, clicked the link for the repo, downloaded and ran the script install-ut99.sh and the game installed (I'm unaware whether or not she downloaded the entire repo or just the shell script file, I think it's just the script though).

When she went to run it though, she got the following error:

Can't find file for package ALAudio.

History: UObject::SafeLoadError <- UObject::StaticLoadClass <- UEngine::InitAudio <- UGameEngine::Init <- InitEngine <- main

Where can we get the file(s) for ALAudio for the game? Are we supposed to drop them into System64? Or if this isn't the way to fix this, how should we go around to fix it? Thanks in advance

Also, putting this because I feel someone is going to say it: "Just install it on Windows" and similar are not helpful answers.

reddit.com
u/Mafla_2004 — 17 days ago

Getting confused while playing co-op

Hello.

So I bought the game during the discount to play with friends and I'm having a blast with it, but I ran into a weird issue when playing in co-op.

For context, we usually play in the late evening, 20:30 to 23:30, the issue can manifest itself at any time, even when I'm wide awake, but as you'll understand it obviously gets worse when I get sleepy and when there's too much stuff on the screen.

Basically, what happens is that, sometimes, I get confused among all the stuff that is on screen and lose track of my character and of enemies/projectiles, it may be that I temporarily mistake my friends' characters for mine (even when they look different enough, e.g. me playing as Azazel and the others playing as Isaac or Cain) or that I just can't figure out where I am and where I'm going because I'm paying attention to everything else (it's a weird thing, I don't really know how to put it to words, it's like my character blends in with the rest), and the result is that my character becomes functionally invisible for me.

This makes it near impossible to dodge bullets, avoid running straight into spikes or fire and effectively attacking the enemies unless I really concentrate, and even then I struggle a lot.

What I think causes this is a sort of multitasking problem, because I sometimes feel like I have to keep track of where the enemies are and where I am and the projectiles, and I am notoriously bad at multitasking (in fact it gets worse if I'm having a deep conversation with someone, like last night a friend was telling me about a problem they had with Linux and I tried to help, all while I was playing co-op and my other friend was talking to me about the game, the game at that point became completely unplayable, IRL I also struggle a lot when someone talks to me while I'm doing something else or if two people talk to me at the same time, that actually makes me tilt), but if that was the case the thing would also happen in single player and, as far as I can tell, it does not; also the issue manifests itself even when we're not having any conversations that require significant attention.

I already tried to turn on the option to make projectiles glow brighter, but that didn't really help.

Did any of you also run into this issue? How can I fix this? I understand there may not be much to do on a game level to fix it but maybe I can do something to train myself to keep track of everything better? Thanks in advance

reddit.com
u/Mafla_2004 — 17 days ago

Stumped on adding a Remove operation to my iterator

Hello.

Sorry for the beginner question but I tried looking up on Google and coming up with my own solution and didn't find much, more details on this later.

I am using a custom made LinkedList class for a project, and for it I made a simple ListIterator class which overloads the operators *, ++, --, == and != so that it can be used in range based loops, now I found myself needing a remove operation to be added to the iterator since I need to be able to remove elements from a list as I iterate through it, but I came across an issue.

Say I have the following list: {1, 2, 3, 4, 5}, and while iterating I need to remove the element 3, this is easily done since it's in the middle of the list, all I have to do is move the iterator's pointer back to 2, set 2's next to 4 and 4's previous to 2, the loop will still see 4 as next and the removal happened flawlessly

If I have to remove the element 1 though, it gets problematic, cause I can't move the iterator's pointer back, so what can I do is move set it to the new first element in the list, 2, but then, when the current iteration is done and the loop moves to the following, the loop will see that the next element is 3 and thus will go to 3 and skip 2 (if you're confused, the removal goes like this: do operations on 1, remove 1, set current element to 2 cause that's the new head, iteration ends, increment iterator to next element, which is 3, do operations on 3)

I tried looking on Google for a solution, first thing I did was look at what Java does with Iterators (since I'm more experienced there and also coded some Java iterators on my own in the past), and found that they can remove elements in the head because the iterator actually starts "before" the head of the list, and only returns the element inside it when you call Next() the first time, which both advances the pointer and returns the element in the next node. In C++ I can't do this though because the way you get the element from the iterator is with the * operator, which gets it from the current node without advancing the pointer.

I also tried to look for the implementation of std::iterator and found that, at least according to cplusplus.com and cppreference.com, it doesn't provide a Remove operation.

So I am back here asking help for a stupidly simple question, what can I do to implement the Remove operation correctly? Thanks in advance.

reddit.com
u/Mafla_2004 — 28 days ago

Confused about quadtrees and how to handle big/sticky polygons

Hello.

I'm working on a side project in C++ using Raylib and I have to code collision detection on my own. If it matters, for simplicity, I decided to make it so the only available colliders in the "engine" I'm creating are rotated rectangles.

A way to optimize collision detection I came across is partitioning the space using quadtrees, however all the explanations of quadtrees (and their alternatives like loose quadtrees and cover fields) seem to make plenty of generous assumptions about what they're gonna be used for (for example, some guides just talk about putting points inside of them, not polygons with actual size) or anyway don't cover a few cases that might happen.

For example, a doubt I've been having is: say we are trying to put a polygon inside of our quadtree, and the partition of space the quadtree figures it should put the polygon in is already at capacity and already partitioned, the partitions are too small to accommodate this big polygon and are also crowded, and all levels above are full as well, so moving the polygon up is not possible. What should the quadtree do now?

In another post where I voiced the same doubt I received a couple of answers, which though didn't fully answer my doubts:

One person pointed out that such a quadtree is a faulty space partitioning system cause insertion can fail, so the capacity thing shouldn't exist (though since all resources about quadtrees mention capacity, I assume at this point it is a threshold after which you partition, but that can be exceeded if need be), this person also mentions that moving the "sticky" polygons up in quadtrees oftentimes results in quadtrees being unbalanced and having a lot of polygons in the top layers, and that for this reason engines sometimes either store the same polygon in multiple sectors in which they overlap or use another data structure like lose quad trees (which I also took a look at without finding a complete answer to my question)

Other people also have suggested that storing the same polygon in multiple sectors that encompass it could help.

However, the capacity thing still has me confused, the guides I followed (including the wikipedia article about quadtrees) all treat this capacity as a solid boundary: any level stores at most n colliders, not any more, and they mostly don't go over the problem of overlaps (sticky polygons) because they just assume you're working with points, so I am confused and kinda blocked, can you hemp me understand better? Sorry for the dumb question

reddit.com
u/Mafla_2004 — 29 days ago

Tiny dents on tuna cans, are they safe to eat or would I risk botulism?

Hello

I have bought some tuna cans at my grocery store, I obsessed at the store over finding a package that would show no dents whatsoever (the package had 6 cans inside, you could see the conditions of 4 of them and you had to turn them), but all cans showed some small dents such as that I'm linking here so I said "screw it" and bought them anyway.

Turns out I have to return the package because some cans in the middle were caved in, not just dented, however I'm asking here so I can tell which dents are passable and which are not. Are dents like these (tiny and in the middle of the can) enough to discard the can or do they mean nothing? What if the dents are the same size but closer to the seams (few millimiters offset from them)? Thanks in advance.

Sorry for the quality of the pictures, I didn't manage to take better ones

u/Mafla_2004 — 1 month ago

Working with quad trees; is it possible for a collider to be much greater than the sector that contains it? If so, how is it handled.

Hello.

I'm working on a collision detection system for 2D shapes, and I have decided to use Quadtrees in order to make the collision detection more scalable, I documented myself a bit about Quadtrees and now I have a doubt.

If it matters, I am making a very bare bones collision system besides the Quadtree: I realized that all I really need for my project -which is a simple side scrolling shooter, I'm making the engine below it first so I can make the rest of the game using it- is simple generic collision detection that also support slopes, I don't need complex polygons -definitely not convex polygons- if not for terrain, and in the case of terrain I can always use a series or simpler static colliders, so the only colliders the engine will support are going to be rotated rectangles and probably circles.

Say I'm trying to add a big collider to my scene, and the sector the quadtree figures the collider should go in is too small for it and the collider ends up covering multiple sectors, I know in that case you'd move the collider up the sector hierarchy until it can find a single sector that can fully encompass it, but my question is: what if we don't find such a sector? What if all layers above our collider have already exhausted their collider capacity? Can't add the collider to any sector without subdividing it, but also can't subdivide the sectors cause they're already subdivided and also because the collider likely wouldn't fit in the subdivided sectors. What then?

I am of course very much a beginner in this craft, in fact the project I'm making is aimed at making me learn C++ and game engine programming, as well as maybe learning some art skills as well. The sources I used are this video as a starter and the Wikipedia articles for quadtrees, as well as some others I don't have available right now. Thanks in advance.

reddit.com
u/Mafla_2004 — 1 month ago

[Unreal Gold] Is there an easier way to play in co-op with my friends?

Hello. Been looking for a while to start a co-op campaign with some friends, but what held me back so far is that the process of hosting a server for Unreal Gold / UT99 is rather complex and time consuming, and it requires opening your router's ports which I can't do on my house router as of now (not because it's impossible but because it's not safe and it's my father's router, if I lived alone and had a router of my own I'd try)

I thought about hopping on other servers but I want to have full control over which map we're playing and with which mutators, and I also would like to keep randoms out

Do you know of some easier way to host a server for Unreal Gold? Maybe some service that lets you host a server and gives you the IP for it, similar to Aternos for Minecraft? Or alternatively anything that lets me just play with my friends? Thanks in advance

reddit.com
u/Mafla_2004 — 1 month ago

How should I handle returning value from a dictionary if it doesn't contain a certain key?

Hello. I have met a simple dilemma when developing a Dictionary class.

The dictionary class I'm making (a templated class with typename K for keys and V for values) implements an array of LinkedLists of pairs between K and V (LinkedList<Pair<K,V>>), these LinkedLists represent the dictionary's buckets.

I have overloaded the operator [] with the following signature

inline V& operator[](const K&);

However, I don't know how I should handle the return value when the dictionary doesn't contain the key (as in, it doesn't have any value associated with the key), other languages like Java use pointers under the hood so you can just return null, however here I can choose between using pointers or not.

So I wanted to ask, what is the best practice? Should I opt to return a pointer to the object rather than a reference or copy? Should I return a default value or should I throw an exception? And in case I switch to returning a pointer to V, is it better practice to change the buckets to LinkedList<Pair<K,V*>> or should I keep them as they are and return the address of the saved value? Sorry if this is a basic question, I'm still learning.

reddit.com
u/Mafla_2004 — 1 month ago

Do you also struggle with feeling like you're not programming things "the right way"? If so, how do you deal with it?

Hello. I started a recreational project a while ago, making a simple 2D shooter in C++ using Raylib, with the aim of building experience with C++.

For context, I study computer engineering and am somewhat well versed in Java since that's the main language we use, I also used Python and C extensively and have been wanting to get my C++ knowledge on par with the other languages I know for a while. In order to keep track of my progress and also better show other people my code in case I need help, I have made a GitHub repo of it and have set it to public since I'm normally open to other people looking and commenting my code.

Lately however, I started having a bit of anxiety while coding for this project because I constantly think that I'm not coding things the right way: I constantly ask myself if I'm using the best practice, whether in one point I should use a pointer or just building the data structure normally is fine (for example with classes that have a LinkedList inside, as of now I mostly just use normal linked lists rather than pointers and instead I use pointers when I need things to be allocated and reallocated dynamically), if the structure of my code is good or bad etc.

This bothers me because it makes me think and rethink over and over every line of code and every little decision I make, and oftentimes it makes me remake the same things multiple times: "made a LinkedList not a pointer? Nope, bad practice, make it a pointer, but wait, what if it doesn't need to be a pointer? Revert! Wait no you're doing it wrong like this, make it a pointer again!"; sometimes I even think a future employer will look at my code (especially because it's on GitHub) and conclude that I'm complete garbage at computer engineering.

I figure it probably is both because I am inexperienced with C++ (and this language really does take your training wheels off, which I like and sometimes dislike TwT) and because I have OCD, but regardless, I wanted to ask here how you guys deal with such anxieties because they don't make my experience any easier...

reddit.com
u/Mafla_2004 — 2 months ago

Made a few collection classes in C++, how can I make them usable in for-each loops

Hello.

I am working on a framework of data structures for practice and I made a templated linked list, now I want to make it possible to iterate through using a for-each loop, like this

// some cool code above...
for (auto& elem : list)
{
  // iteration code...
}

If it is of any use, the LinkedList class is declared as follows (still incomplete btw)

template<typename T>
class LinkedList : public Collection<T>
{
private:
    DoubleLinkedNode<T> *head, *tail;

public:
    virtual T& operator[](uint32)               override;
    virtual T  operator[](uint32) const         override;
    virtual void AddAt(const T&, uint32)        override;
    virtual void PushHead(const T&)             override;
    virtual void PushTail(const T&)             override;
    virtual void Append(T*, uint32)             override;
    virtual void Append(const Collection<T>&)   override;

    inline LinkedList(const T& item) : head(new DoubleLinkedNode<T>(item)), tail(head)
    {
        this->size = 1U;
    }
};

Now, I tried looking online but I only found very notionistic articles and tutorials, some just said "yeah you have to overload these operators in an iterator", others showed me how to make an iterator only to not use a for-each and instead just create an iterator object and calling the functions manually in a normal for loop (which frankly I could already do myself, didn't need an entire tutorial if that was the objective). Nothing actually told me what should I do to make the LinkedList class directly usable in a for-each loop, for example all this made me confused on where I should declare the iterator class even, should I make it as a nested class inside LinkedList or should I put it somewhere else?

Sorry if this is a beginner question but I'm still learning the language and the internet kinda failed me here, thanks in advance.

reddit.com
u/Mafla_2004 — 2 months ago

What happened to the Nali?

Hello. I've been wondering about this for a while; in UT2004 and UT3 we see that Liandri colonized and mined the crap out of Na-Pali, however we last see Nali players in UT99, and Nali themselves made their last appearance in UC2 as cattle to be slaughtered in Nali Hunt (which may as well be simulated Nali rather than real Nali, though it wouldn't surprise me if they were real Nali), so a question comes naturally. What happened to the Nali? Are they still around? Are they heavily enslaved? Or did years of Skaarj and eventually Liandri occupation drive them extinct? (Peak metaphor of the consequences of late stage capitalism btw)

reddit.com
u/Mafla_2004 — 2 months ago

Undefined references to functions that are actually defined in their cpp files, seems compiler doesn't link the cpp file unless I explicitly include it, what should I do?

Hello.

I'm making a small recreational project to make more experience with C++ using Raylib 6.0, before I went around to make the structure of the game I decided to code some data structures I would need (declared in datastructs.h, defined in datastructs.cpp), making them on my own as exercise; all classes use templates since I need them to be generic data structures.

When I went to test the data structures though I got the following error, essentially a bunch of reference to undefined function errors for each function of the data structures I used:

mingw32-make main
make[1]: Entering directory 'D:/Programming/C++/2D Unreal with Ruff/2DUNR/2DUnrGame'
g++ -o main src/*.cpp -Wall -std=c++14 -D_DEFAULT_SOURCE -Wno-missing-braces -g -O0 C:/raylib/raylib/src/raylib.rc.data -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -L. -LC:/raylib/raylib/src -LC:/raylib/raylib/src -lraylib -lopengl32 -lgdi32 -lwinmm -DPLATFORM_DESKTOP
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o: in function `main':
D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:27:(.text+0xd3): undefined reference to `LinkedList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:28:(.text+0xea): undefined reference to `LinkedList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:30:(.text+0x101): undefined reference to `LinkedList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:31:(.text+0x118): undefined reference to `LinkedList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:33:(.text+0x142): undefined reference to `ArrayList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:33:(.text+0x174): undefined reference to `ArrayList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:33:(.text+0x1a6): undefined reference to `ArrayList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:34:(.text+0x1ee): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:34:(.text+0x220): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:34:(.text+0x252): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:35:(.text+0x29a): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:35:(.text+0x2cc): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:35: more undefined references to `LinkedList<int>::operator[](unsigned int)' follow
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o: in function `main':
D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:37:(.text+0x32c): undefined reference to `LinkedList<int>::Append(Collection<int> const&)'
C:/raylib/w64devkit/bin/ld.exe: D:\Programming\C++\2D Unreal with Ruff\2DUNR\2DUnrGame/src/main.cpp:38:(.text+0x33c): undefined reference to `LinkedList<int>::Append(Collection<int> const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x18): undefined reference to `LinkedList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x20): undefined reference to `LinkedList<int>::operator[](unsigned int) const'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x28): undefined reference to `LinkedList<int>::AddAt(int const&, unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x30): undefined reference to `LinkedList<int>::PushHead(int const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x38): undefined reference to `LinkedList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x40): undefined reference to `LinkedList<int>::Append(int*, unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV10LinkedListIiE[_ZTV10LinkedListIiE]+0x48): undefined reference to `LinkedList<int>::Append(Collection<int> const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x18): undefined reference to `ArrayList<int>::operator[](unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x20): undefined reference to `ArrayList<int>::operator[](unsigned int) const'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x28): undefined reference to `ArrayList<int>::AddAt(int const&, unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x30): undefined reference to `ArrayList<int>::PushHead(int const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x38): undefined reference to `ArrayList<int>::PushTail(int const&)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x40): undefined reference to `ArrayList<int>::Append(int*, unsigned int)'
C:/raylib/w64devkit/bin/ld.exe: C:\Users\mafla\AppData\Local\Temp\ccorPzcu.o:main.cpp:(.rdata$_ZTV9ArrayListIiE[_ZTV9ArrayListIiE]+0x48): undefined reference to `ArrayList<int>::Append(Collection<int> const&)'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:391: main] Error 1
make[1]: Leaving directory 'D:/Programming/C++/2D Unreal with Ruff/2DUNR/2DUnrGame'
make: *** [Makefile:387: all] Error 2

The errors go away if I add #include "datastructs.cpp".

I initially thought something was wrong in the Makefile, but I'm not sure, and other than that I have no idea what I could have done wrong to cause this nor how to fix it. Since I can't just paste all the code from main.cpp, datastructs.cpp and datastructs.h here without making the post excessively wrong, I'm gonna have to link my GitHub repo (sorry): https://github.com/mafla2004/2DUnrealClone/blob/master

I tried already to copy the contents of datastructs.cpp into another file which I created directly in the project from VSCode (thinking the reason might have been that VSCode didn't see the project cause I created some files in another IDE), but that didn't work either.

What can I do to fix it? How can I avoid the same thing happening again? Thanks in advance

reddit.com
u/Mafla_2004 — 2 months ago

Do you think Ruff could fly keeping a straight back?

Here I put both the refsheet of my fursona and a silly ugly diagram I made explaining my dilemma

I'm not really asking if Ruff could fly completely realistically, because the wings are definitely too small and he wouldn't be able to buzz them like a moth would, but rather my problem is one of "thrust" so to say

I always imagined Ruff being able to hover in a "straight" position, basically keeping his back straight like angel-like beings are usually portrayed to fly, or at most slightly angling his back forwards (anyhow not keeping his back as bent as in the right portion of my dumb diagram), but if he kept that position and was to move his wings in a horizontal motion, wouldn't he push air forwards instead than downwards? Of course here we're talking about hovering in place, if he wanted to fly forward he would have to tilt forward etc.

I thought that maybe he would be able to angle his wings so that they produced a downwards thrust that allowed him to hover without having to angle his back, but now I'm curious to hear from those of you who know a bit more about moths than me: how do moth wings work? How do you think Ruff would be able to fly with these wings? Would he be able to take off at all ignoring the size and muscle strength needed to use them?

I also thought about posting this question on r/furgonomics but I don't think it fits so here it goes

u/Mafla_2004 — 2 months ago
▲ 4 r/raylib

Having problems with linking the library using CMake

Hello.

I wanted to try out Raylib and found that to link a library to a C++ project CMake is often used, so I decided I could try and learn how to link the Raylib library on my own.

What I did was to add the path of installation of raylib (specifically the path to its CMake files) in CMakePresets.json, like this

"cacheVariables": {
    "CMAKE_C_COMPILER": "cl.exe",
    "CMAKE_CXX_COMPILER": "cl.exe",
    "CMAKE_PREFIX_PATH": "$env{PATH};C:/raylib/raylib/cmake"
},

And then I added the following lines in my CMakeLists.txt

# Find raylib package
#set(RAYLIB_DIR "C:\raylib\raylib\cmake")
find_package(raylib 6.0 REQUIRED)
target_link_libraries(target PRIVATE raylib)

This fixed two previous errors I had, one in which the CMake was unable to find the package and one that threw an error when parsing the path because of Windows' backslashes, however I now get this error that I can't seem to get around

1> Working directory: D:/Programming/C++/First Raylib App/YetAnotherTerrariaClone/out/build/x64-debug
1> [CMake] CMake Error at D:\Programming\C++\First Raylib App\YetAnotherTerrariaClone\CMakeLists.txt:17 (find_package):
1> [CMake]   Could not find a configuration file for package "raylib" that is compatible
1> [CMake]   with requested version "6.0".
1> [CMake] 
1> [CMake]   The following configuration files were considered but not accepted:
1> [CMake] 
1> [CMake]     C:/raylib/raylib/cmake/raylib-config.cmake, version: @PROJECT_VERSION@ (64bit)
1> [CMake] 
1> [CMake] 
1> [CMake] 
1> [CMake] -- Configuring incomplete, errors occurred!

I tried to change the version required by the package in the CMakeLists.txt to lower versions, but it didn't work, I also tried removing the version and just typing find_package(raylib REQUIRED) but that didn't work either (the error changed to <<could not find a configuration file for package "raylib" that is compatible with requested version "">>), I then finally tried, in a desperate attempt, to change the version in raylib-config-version.cmake from \@PROJECT_VERSION@ to 6.0, but it didn't work either.

What else can I do? What am I doing wrong? Thanks in advance

reddit.com
u/Mafla_2004 — 2 months ago

Mi vergogno di aver messo lo stesso gioco così tante volte e merito le derisioni TwT

u/Mafla_2004 — 2 months ago

Need advice on handling weapon reload animations for weapon with dual fire modes and magazines.

Hello. This might seem like a simple problem but there are some things that make it more complex than it should be, so I decided to ask for advice here.

Weapons in my game work as follows: They have two fire modes, the primary which is fired with LMB and the secondary which is fired with RMB, a weapon might use the same magazine for both fire modes, have different magazines for different fire modes or have one or both fire modes not use magazines, this introduces a bit of a problem when it comes to reloading.

This is because a weapon might have to use an animation for reloading the primary clip, an animation for reloading the secondary clip, and an animation for reloading both at the same time, and not every weapon might need all these animations: some weapons might use none because they don't use clips, some might only need the primary or the secondary, some may need the primary and the secondary but not the animation for reloading both and so on.

I could have the weapons hold three pointers to animations and just not worry if some of these are set to null because it won't cause a massive memory waste, but the situation gets more complicated when you factor in the possibility for reloading on an empty mag: as you know some weapons might use a different animation for reloading when the mag is empty, and in the case of my game, this would need to apply to the singular fire modes, doubling the max number of animations a weapon could have from 3 to 6, and most weapons won't use all 6, I calculated that there are a grand total of 19 possible cases.

Of course, just shoving 6 animation pointers in the weapon class is not good practice for a plethora of reasons, so I began rethinking stuff:

First off, I decided to isolate "fringe cases" that are so rare it's not worth it to implement them in the base class, those being the cases in which an animation for reloading both mags is needed, there will be at most one weapon in the game that will need this so I can just code it in the specific weapon itself, the max number of animations goes down to 4.

Secondly, I thought about offloading handling animations and possibly reloading itself to components for each fire mode, so a firemode has a pointer to a reload manager which can hold one or two animations, which will then decide which one to play and possibly also replenish the weapon's clip accordingly, the downsides are that this would take much more memory than just having 4 animation pointers in and would introduce a bit of neddless complexity in the code.

What is making me reconsider the components path though is the fact that some weapons (and not few since most weapons are based on WW1 guns) might need to reload rounds singularly, so I need to handle that case too, this is where using the component thing could help, but at the same time I could have an enum in the weapon class that, for each firemode, specifies if the mode needs no reload, a simple reload, support for empty mag reload or rounds reload.

I also looked at how other games handle this problem and found that... They just don't, most games with dual fire mode weapons either don't use mags (Unreal for example) or use a singular mag for both fire modes (Half-Life), I'm not sure though this could fit the needs of my game, but I could try to redo that "isolation of fring cases" process.

So I'm a bit indecisive and I decided to ask for advice here, what would you do in my situation? I don't want my code to look like that of Yandere Simulator TwT

reddit.com
u/Mafla_2004 — 2 months ago