Jump to content
Site Stability Read more... Γ—
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by DerTroll

  1. DerTroll

    A Dev Team Needed

    click me I think you have to provide a little bit more information if you want to find people. Which engine/programming language are you using? What is already there? Is your code on GitHub? etc.
  2. DerTroll

    move ship

    And the question is ... ?
  3. DerTroll

    Github and Viruses

    Hrhr... reminds me a little bit of children who close their eyes and tell themselves that you can't see them because they can't see you. πŸ˜› Using Linux and staying away from doubious sites is already a good protection but still not 100% safe. Regarding Github: I would only clone popular Repos where you can be sure that it is maintained by trustworthy people. Not because I am afraid of Malware/Viruses but of wasting my time with badly written code. Low risks of catching a virus via Github is a bonus of this approach. Greetings
  4. Haven't worked with parallax mapping myself so far, so I can't help you with the details but it looks to me like it only works in the horizontal direction. If you compare the edges of the learnopengl picture with yours, you 'll see what I mean. So I would narrow down the debugging to every instruction that affects the vertical direction. Greetings
  5. I can't tell how it is usually done in the current state of the art 3D games since I am no industry professional. I am just a hobbyist. However, in my experience, when it comes to optimizing performance vs accuracy there is no general solution. If you have to perform such visibility checks in an MMO with hundreds of players and NPCs, you are certainly right. You can't afford much CPU/GPU time on the test. But in contrast, in an offline game with a small number of agents (Alien isolation for example), you can certainly afford more expensive checks to enhance realism, I guess... Also, you don't need to perform a check for every agent in every frame. You can distribute the checks across multiple frames without anybody noticing it. As I said, I think it depends on your game and if I haven't missed it, the TO does not mention which type of game he is interested in (except FPS). Stopping to play on "easy"-mode would fix that, I guess. Greetings
  6. Depends on the accuracy that you need and the number of checks. My point was just that I didn't understand the TO's problem if he read (and understood) articles about visibility checks from the cameras POV but doesn't know how to check to objects that are not the camera. It's basically the same problem. However, you can remove all objects from the test that are behind the target object. Then you have 2 effects when using this reduced frustums. If the object is far away, the frustum gets really small, causing a lot of objects to fail the initial frustum check. Additionally, the frustum gets completely blocked by a single object more frequently, allowing you to exit the entire test early. On the other hand, if the object is really close, you don't need to check so many objects, since the ground you need to cover is rather small. Of course, if you have a lot of those checks to perform even that might be too much. There are many things you can do to speed things up but I know nothing in particular that doesn't apply also to standard frustum/occlusion culling. The extreme case would be the single ray solution you proposed, but as I said, I think that this might be not accurate enough for what the TO is intending to, but maybe I am wrong. Greetings
  7. Well, I am not really understanding your problem. You can use all the culling techniques usually used to speed up rendering to find out if 2 objects/players can see each other. Since you are only interested in the visibility of a certain object (the other player) you can calculate a reduced frustum that fully encloses the parts of the target object that are inside the full view frustum. Then run the usual occlusion culling algorithms on this reduced frustum. I think this solution is a little bit too minimalistic. It will produce a wrong answer if players are only partially inside the frustum or if a fly or other small object that doesn't really block LOS crosses the ray. Greetings
  8. DerTroll

    Open Source Whack the Mouse

    Short answer: No Long answer: Noooooooooooooo
  9. You have 2 coordinate systems O and S and the matrix A that transforms between them. Each coordinate system is described by a set of vectors/points (\(s_0, s_1\) etc.). So: \(A \cdot o_n = s_n\) where n is just enumerator for your points or vectors (I recommend using vectors - you need just 3 of them to describe your system and you can calculate them from your points). You want to find the matrix A. So this might help: https://yutsumura.com/find-a-matrix-that-maps-given-vectors-to-given-vectors/ This is a general approach and should also help you with this: Don't have the time to think about @Green_Baron answer, but maybe his suggestions are easier and more effective for your specific needs. In any case, the technique of the link should give you the matrix you are looking for. If you need to find a decomposition of that matrix into basic transformation (rotations, scaling, translations) you might want to read about singular value decomposition: https://en.wikipedia.org/wiki/Singular_value_decomposition It basically says that every matrix can be decomposed into 2 rotation matrices and 1 scaling matrix: \(A = R_1 \cdot S \cdot R_2\). The SVD calculates those matrices. However, this isn't a basic technique anymore and probably not part of GLM or most other linear algebra libraries written for games. The library "Eigen" has it, but I wouldn't use it for games. Implementing it yourself (efficiently) is also not something you do in a couple of hours because SVD is not easy to understand if you don't know much about linear algebra. Greetings
  10. DerTroll

    3d animation from Between Realms

    Hi, the model looks great so far. However, you asked for critics and I am quite picky with details. So here are my remarks: - The hip movement is a little bit overdone. Looks like she wants to hit somebody with her butt. - The hair seems to be static - add some movement or let a physics engine calculate it at real-time - No facial expressions. I know that this is quite common, but it is something that always annoys me. Real people don't move around with a frozen face. They look, left and right, changing their facial expression regularly. Maybe you can add some random expressions. Don't get me wrong, these are really minor concerns Greetings
  11. DerTroll

    Game Physics by Dr Eberly

    The thing with C++ is, that knowing the language and being capable of writing programs is just one part. From what I read, the problems you are facing result from not knowing the other part well enough, the build system. I had similar troubles when I started myself. Those problems will vanish, once you really understand how the compiler and linker work together and how you control them. That is the reason why I suggested to put the book and VS aside and learn more about the build system. Start writing some makefiles. Intentionally put some mistakes into your code to see how the compiler/linker reacts. Try to understand the reaction. Do some research on the specific error messages. Once you got that you will probably understand the VS errors or at least you might get a clue about the origin of the problem. Also, feel free to ask more questions if you get stuck. But to get good answers, you need to give us a little bit more to work with. Code snippets or error messages are important for us to help you. Don't be. C++ is really not easy. Probably everybody here had similar issues when they started. If you are still willing to learn it (I hope so), let's try to get you onto the right path: Make yourself a Github account (https://github.com/) and create a new repository (if you haven't already done this). Install git on your computer and clone the empty repository to a directory on your computer (git clone <github-link> <directory>). Now start your VS project inside that directory. You can also copy the tutorials from the book if the author is okay with that. Then just upload your code (relevant commands: git status, git add, git commit, git push) and give us the repository link. This will enable us, to test the code on our own computers and then we will most probably be able to tell you If you have any questions about using git or GitHub, ask. But as you will see, it is rather easy to use as long as you are not working on a large project. I think using a GitHub repository is the best way for us to help you efficiently and to avoid frustration. Don't be ashamed/afraid to ask a lot of questions. Most people here are willing to help and are quite patient. You just need to give them the information's they need and a repository with your code is enough information most of the time. Greetings
  12. I generally agree with your argumentation and won't use that kind of forward declaration either for the reasons you mentioned, but I can see some rare cases where it might make sense. Under the assumption, that this kind of forward declaration is only defined in the scope of the class and does not spill over to the global namespace (have not tested it, so everything that follows is only valid if the assumption holds) it might prevent some hard to track bugs. For example, if you have a forward declaration in one of your headers and rename the corresponding class (replace a lower case letter with an upper case letter), but forget to update the forward declaration and some other locations, you might get some undefined reference errors that are hard to track. You just see that there is an Include of the corresponding class in your file and 2 lines below you want to use it but you get an error and don't know why. Reason: Another included header provides the wrong forward declaration and you don't see that you used the old classes name which is nearly identical. If the forward declaration is in place, you might see it much easier. However, this is more a try to find a reason why it is even possible instead of a real argument. Greetings
  13. It seems like a contradiction to me. I don't know Rust, but c++ is not inherently fast. It is only fast if you use it properly. There are a lot of pitfalls that can slow a c++ program down. Maybe Rust has much less of these pitfalls because of this: In conclusion, I guess the "average programmer dude" might generally be able to write faster code with Rust than with c++, because he is not allowed to mess around with stuff he barely understands. On the other hand, an experienced programmer will use the extra control of c++ to his advantage and will probably generate faster code with C++. Memory management is not a problem. It's actually a gift if you know how to utilize it to your advantage. If you don't know how to handle it, it might be a problem. However, using a garbage collection system is probably not what you want if you aim for maximum performance since it always comes with a management overhead. That's why I said that 'fast' and 'managed' seems like a contradiction to me. In general, more control means, more pitfalls but also more possibilities. In the end, all that matters for performance is machine code (cache/memory issues neglected) and that depends on the capability of your compiler to translate C++/Rust into effective machine instructions. The language you use is only important in the context of how well you can explain to the compiler what you are intending to do. The better he knows what you want, the better he is capable of optimizing the code. Therefore, it needs to be precise and also rich enough to cover all possible problems. It's a little bit like ordering a pizza. If you want one with salami and extra mozzarella and you say 'cheese' because your language does not know the term 'mozzarella', you might end up getting gouda instead. To sum it up: Since C++ is designed to be as close as possible to the hardware in a portable way (in contrast to assembly, which is hardware-specific), I doubt that Rust generally outperforms optimized c++. It might get equally fast with less verbose/complicated code but I am also not sure of that (garbage collection). I might be wrong. I don't know everything... YET! πŸ˜› Greetings
  14. DerTroll

    which gui library

    Didn't say he should. Actually, I adviced against it. I used them just for editors and it was quite a pain to set everything up so that I can use my own render engine instead of the inbuilt Qt OpenGL interfaces. Greetings
  15. I have not seen this kind of forward declaration before, but if you look here it seems like it is possible. From the link: class U; namespace ns{ class Y f(class T p); // declares function ns::f and declares ns::T and ns::Y class U f(); // U refers to ::U Y* p; T* q; // can use pointers and references to T and Y } However, the only reason I can see why you should use such a "local" forward declaration is to avoid polluting the global namespace with forward declarations. Greetings
  16. DerTroll

    which gui library

    Please try doing your own research more often instead of opening a thread for each question you have. You will find enough information on that topic yourself. However, the problem with most GUI engines that I know (Qt, wxWidgets) is, that using OpenGL with them is not as straight forward as it could be. Until you get everything running as desired, it will take some more or less complicated setup steps and I am not sure if you are up to the task if I see the problems you are facing in all your other threads. You should probably get more experience with OpenGL and C++ first before trying to add a GUI engine to your project that will make everything much more complicated. But I'll guess that won't stop you from doing it anyways. Greetings
  17. DerTroll

    Game Physics by Dr Eberly

    Looks like the OP got lucky and there is someone who has this book I am not suggesting to drop it completely. He should just put it aside and learn the basics about building a c++ program and then continue with VS. But maybe you are right. Greetings
  18. DerTroll

    Game Physics by Dr Eberly

    I doubt, that you will find anyone here, who has. There are so many resources on this topic out there and the chances that a person who has read this book stumbles across this thread are rather small. Even if, you get lucky there is still the question if this person faced the same problems as you do. So let's focus on your specific problems and let's try to solve them. So you have basically no experience in how c++ programs are structured and how they are composed. Nothing to be ashamed of, but using Microsoft Visual Studio is the worst thing you can do right now. Not because it is bad but because it is good. It does so much work for you that you usually don't need to know much about how your program is composed... until there is a problem. I know that from personal experience. I started learning c++ with VS and had a lot of linking problems I did not understand. I opened a lot of threads in forums where people told me which flags I had to change in some hidden options menu. It magically worked. I did not understand why but I was happy until I hit the next problem. I could have saved myself a lot of trouble, if I have learned the necessary lessons about the c++ build system. Unfortunately, the things modern IDEs offer, which make the lives of experienced programmers so much easier, are somehow bad for Newbies. So my first advice: Do some simple C++ tutorials without using an IDE. Write makefiles, multiple mini-libraries and link them all together. If you don't make any mistakes (unlikely, but might happen), try adding one on purpose and see what happens if you want to build the program. You need to learn how the compiler/linker addresses certain error types, which leads me to the next point: How cute, just 612? Try hitting 1000 or 10000. It's not that hard to achieve. πŸ˜› Jokes aside. The number of compiler errors you get is absolutely irrelevant. The only thing that matters is the first one. If you forget to include a file where a certain function is defined, the compiler will create an error every time you use this function. I can only support the things @Kylotan mentioned. Try solving all errors step by step. Always solve the initial error and don't bother with the others which are probably just subsequent errors. If you don't know how to solve a specific error, ask and give us the error message and the code section that caused the error. We can't help you if we don't know, what is supposed to happen. If the program compiles, you have at least a more or less working program. If you run the program and you get no output there might be multiple reasons: - The program is not supposed to print any output. - The output is written to a file that you have to open with a certain software tool (ParaView is quite common in Physics simulations) - The program crashed. In this case, you should get at least an error message which you can provide to us. So please tell us, what the program is supposed to do and what it is actually doing. I stopped using VS a long time ago, but I think the VS Version which was used to create the file is somehow important and you might face a compatibility problem here. But that's some wild guessing from my side. Maybe a more experienced user can tell you something about it. However, I suggest you put the book aside for a while and start learning the basics of c/c++. This is not an easy task since c/c++ are rather difficult languages, so it will probably take some time. In my opinion, it makes no sense to learn programming game physics without some solid knowledge about the programming language you intend to use. It will just frustrate you. Greetings
  19. Yeah, that is a problem especially if the player moves along the boundary of some chunks that differ much in the used resources. That's an option one should consider. It's a little bit like a garbage collection system. Well, I think in my special case, I would not flag the resources themselves but the objects that are composed of them. Another option would be to have a larger offset between the player positions were a chunk is loaded and where it is unloaded. That would avoid loading-unloading ping pong if the player moves exactly along the border. No, I haven't yet looked at how other systems implement such a system. I just hope somebody who has already done something comes around and enlightens me. The problem is, that it is always hard to find information about such low-level systems since they are often hidden or not well documented. Until I find the relevant code pieces and actually understand them, I probably got 10k answers in this thread. Greetings and thanks for the input so far
  20. Hi there, recently I read in one of the treads about data-oriented programming vs. object-oriented programming. While I am generally avoiding to follow such principals dogmatically, it got me thinking again about a quite common problem: Resource Managers (in OpenGL). To get a little bit more specific, let's consider a Texture Manager. I have currently implemented them in the following way: When starting the program, the manager creates a texture class for each texture of my game and stores them together with the name in a map or unordered map. The texture class itself has a reference counter and the OpenGL handle of the texture. The value of the handle is set to a specific "texture not loaded" texture during construction. Now if an object is loaded, that requires a certain texture, the texture is requested from the manager. It searches the textures name and returns a special reference class, that stores a reference to the texture class and increases and decreases its reference counter. Obviously, the reference counter has the purpose to initiate the loading and unloading of the texture. The problem here is, that the texture handle, which is just an integer, is not stored in a cache-friendly way, as are other managed objects that I might need during rendering (Buffer objects for meshes, etc). All handles are stored in the texture managers memory location, which might be far away from the buffer object handles and the other object data. So I was thinking that I should probably simply store references to all reference classes (I know that sounds weird) in the texture class itself. The purpose of this is, that I can then simply copy the current OpenGL texture handle to the reference class. In case that the handle changes for any reason (reloading/replacing texture), I update the handle in each reference class using a loop. Sure, this is a little bit more work during an update of the texture and if a reference is added/removed, but how often does that happen? As a benefit of this method, a copy of my texture handle is now stored at the same memory location as the rest of the object's data, which should result in reduced cache miss count. Now I am interested in what you think about these two approaches and how you implement your resource mangers as efficient as possible? Greetings
  21. If I got you right, the second rotation does not apply anymore, right? In this case you probably forget stacking your transformations or made a coding mistake. To solve the latter problem, we need code as @Green_Baron said.
  22. You made some good and valid points here. As you said I have already thought about those problems and they are not that big of an issue because the system is more or less encapsulated. Both classes only interact with each other. Sure, you have to implement everything exception- and thread-safe but I guess that is manageable. Of course, there are always ways in C++ to break code/encapsulation but let's assume the "user" knows what he does. πŸ˜› Just to address some of your points: The copy and Move constructors of the reference class have to increase decrease the reference count (version 1) or add and delete pointers to them in the Texture class (Version 2). It's basically a little bit like a fancy std::shared_ptr. In this case, copying and deleting objects shouldn't be an issue. You are correct, that this system makes things a little bit more complicated but think of a game, without any hard level boundaries, that uses a lot of data which is too large to be stored completely in memory (some UHD textures add up quickly). If you want to run such a game, you have to load and unload data permanently. Of course, you separate the world into chunks and do the loading and unloading per chunk, but that still needs a system, that identifies which data is needed and which not. So the whole idea is to load a chunk and all its containing objects. The objects request their resources in the form of those reference classes from the corresponding management systems, which take care of the loading/unloading. Maybe there is a smarter approach to that. Would be happy to read about it. Greetings
  23. Okay, I feared it might be confusing without code. So I will give you some pseudo-code to illustrate what I mean. Just wrote it in a hurry, so I hope I have not forgotten anything and didn't make too terrible mistakes πŸ˜› Version 1: Texture class class Texture { friend class TextureReference; GLuint mHandle; // <- Texture handle that you get from the OpenGL API and that you need for rendering U32 mRefCount = 0; std::string mFileName; // Or whatever you need to acess the texture data on your hard drive public: Texture(std::string fileName) : mHandle{GetHandleNotLoadedTexture()} mFileName{fileName} {} TextureReference GetReference() { IncreaseRefCount(); return TextureReference(*this); } private: void IncreaseRefCount; { if (mRefCount == 0) LoadTexture(); ++mRefCount; } void DecreaseRefCount; { if (mRefCount == 1) UnloadTexture(); --mRefCount; } void LoadTexture(); void UnoadTexture(); void UpdateTextureHandle(...) { // load new texture and update handle ... mHandle = newHandle; // delete old texture ... } }; Texture reference class: class TextureReference { friend class Texture; Texture& mTexture; TextureReference(Texture& texture) : mTexture{texture} {} public: ~TextureReference { mTexture.DecreaseRefCount(); } GLuint GetHandle() { return mTexture.mHandle; } }; Version 2: class Texture { friend class TextureReference; GLuint mHandle; // <- Texture handle that you get from the OpenGL API and that you need for rendering std::vector<TextureReference*> mReferences std::string mFileName; // Or whatever you need to acess the texture data on your hard drive public: Texture(std::string fileName) : mHandle{GetHandleNotLoadedTexture()} mFileName{fileName} {} TextureReference GetReference() { return TextureReference(*this); } private: void AddReference(TextureReference* referencePtr); { if (mReferences.size() == 0) LoadTexture(); mReferences.push_back(referencePtr); } void RemoveReference(TextureReference* referencePtr); { if (mReferences.size() == 1) UnloadTexture(); // find and remove reference from mReferences ... } void LoadTexture(); void UnoadTexture(); void UpdateTextureHandle(...) { // load new texture and update handle and reference handles ... mHandle = newHandle; for(TextureReference* texRef : mReferences) texRef->mTextureHandle = newHandle; // delete old texture ... } }; TextureReference class TextureReference { friend class Texture; U32 mTextureHandle; Texture& mTexture; TextureReference(Texture& texture) : mTextureHandle{texture.mHandle} , mTexture{texture} { mTexture.AddReference(this); } public: ~TextureReference { mTexture.RemoveReference(this); } GLuint GetHandle() { return mTextureHandle; } }; The texture references are stored in the objects you want to render together with references to buffer objects etc. As you can see, the first version has an indirect access pattern. To get the texture handle for rendering, it has to be fetched from the texture class, that is stored in the texture manager -> potentially a lot of cache misses during rendering. The second version has a local copy, therefore there shouldn't be any cache misses. The drawback here is, that updates get a little bit more complicated
  24. DerTroll

    Selling a Gaming System to a Major Developer?

    You should probably read this. Not a law expert, but I am pretty sure it is the other way around. You should fear that they steal your idea and get away with it. They have the money to pay an army of good lawyers and it is hard to prove that they stole something from you if you have just a manuscript of a game concept and not a useable product.
  25. DerTroll

    OpenGL Reflectance model question

    Depends on your game. If you want to simulate different kinds of surfaces on different objects and it can't be handled by a single model, then you might need multiple models... if that's what you are asking for. Branches (if-else, switch) usually have a big impact on shader performance. Read the first answer from this link if you want to know why. So you should either use multiple shaders or you can try using OpenGL subroutines. In any case, it is advisable to sort your data accordingly to avoid multiple state changes. Greetings ... Got ninja'd by @MJP
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net isΒ your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!