by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Nikolai Wuttke
    @lethal-guitar
    That's a good question actually.. I learned OpenGL and shader programming at university, where I took several classes on computer graphics, and also my Bachelor's and Master's thesis both involved graphics programming. So I'm not really up to date on online learning material I'm afraid..
    I think I've seen that recommended before
    Maybe worth a shot?
    Nikolai Wuttke
    @lethal-guitar
    I've started working on adding controller support for the in-game menus
    Nikolai Wuttke
    @lethal-guitar
    The 2nd starts talking about shaders a little further down
    Nikolai Wuttke
    @lethal-guitar
    One issue with GLSL shaders is the variety between versions, which can be confusing when looking at different tutorials. Here's a good overview of the differences: https://github.com/mattdesl/lwjgl-basics/wiki/GLSL-Versions
    Pratik Anand
    @pratikone
    Thanks a lot for providing all of these resources. yeah, that's awesome that you got to do your thesis in graphics programming. My Bachelor's professor for CG wasn't that good in teaching it so it killed my interest. I tried doing it for my masters but no professor taught it at Masters level. I have been trying to pick it up for long and finally now I am doing it. Rigel Engine is my learning ground for graphics and game engine development and you have created such a polished C++ source code that it is a joy to learn
    I have created a new pull request post your refactor of changes. let me know if it looks good
    Pratik Anand
    @pratikone

    Hey @pratikone, cool! Looking forward to it :) I was thinking we could setup a github.io page, the project doesn't have one yet. Since the content is all static, that should be sufficient, right?

    github.io is always the best hosting approach. i have come to love it a lot. But in this case, I think it may not be technically sufficient to host wasm content. I will try to find if github pages allow wasm content (one with file access). Even if it doesn't, we can still host the game page somewhere and link it from project's github.io page which will provide information about the project. Kind of a prettier README

    Nikolai Wuttke
    @lethal-guitar

    you have created such a polished C++ source code that it is a joy to learn
    Thanks for the kind words, happy to hear that!

    But in this case, I think it may not be technically sufficient to host wasm content

    Ah I see. Then yeah, let's try to find something else. Are there any free hosting options that work with Wasm?

    Kind of a prettier README

    Yeah, I was thinking the same, would be nice to have a github.io page in any case for that purpose.

    The PR looks quite good, I added a few more cleanups on top but when CI is green, I'll merge it :thumbsup: Thanks again for making the cleaned up version
    Pratik Anand
    @pratikone
    Oh, you made changes already. I realized I didn't make changes like moving to compile options, removing mLastTime and using set in cmake property and was making it
    and then saw your message here.
    All cool
    Nikolai Wuttke
    @lethal-guitar
    Ah sorry, didn't know you were also still working on it. But I think it's good that I took the time to make the changes myself, it helped me get familiar with the Emscripten toolchain :)
    I'm creating some GitHub issues now
    Nikolai Wuttke
    @lethal-guitar
    Issues created, and I pushed one last change. Let me know what you think, then I'll merge!
    Nikolai Wuttke
    @lethal-guitar
    And it's merged! Thanks for all the work you put into this!
    Pratik Anand
    @pratikone
    yay, thanks. Would not have been possible without your help
    Nikolai Wuttke
    @lethal-guitar
    My pleasure :) Btw, I've already found a solution for the sound issues I'm seeing. It's a problem in the way we use SDL's audio. I'll see if I can fix it this weekend
    Pratik Anand
    @pratikone
    awesome
    i am also looking at handling C++ exception in emscripten. Until now, it has no support, even for a nullptr or IO exception, we get a number on webassembly. It doesn't print anything. By just adding a simple function, it will start printing the same errors in web browser too
    Pratik Anand
    @pratikone
    Also, I am getting back at understanding entityx part of Rigel Engine. I am planning to add it back as a large comment block in the code for any one to understand in the future. Here is my understanding.
    I am using an example of BlueGuard. I have noticed that there are 3 actor ids for Blue guard : standing left, right and typing. Is there a single entity or 3 different entities for a guard? It has bunch of components assigned in entity_configuration.cpp like shootable, bounding box etc and one important component which is components::BlueGuard which defines its own state. There is another thing called BlueGuardbehaviorsystem which defines the behavior. It subscribes to these events like shootable damage and reguarly updates (what kind of updates ?) and receives subscribed events. What all I am missing here ?
    Where there is a check for type in receive function for shootable damage in blue guard behavior system ? does such event goto every entity which has subscribed to it or does it only goto specific entities which are involved in the event somehow ?
    Nikolai Wuttke
    @lethal-guitar

    I am planning to add it back as a large comment block in the code for any one to understand in the future.

    Ah cool, that's a nice idea, thanks for doing that!

    Is there a single entity or 3 different entities for a guard?

    There is only one entity. The actor ID is used to parameterize the entity's behavior, but all three actor IDs map to the same entity, and all the logic is handled by the same code.

    Where there is a check for type in receive function for shootable damage in blue guard behavior system ? does such event goto every entity which has subscribed to it or does it only goto specific entities which are involved in the event somehow ?

    The BlueGuardSystem receives all events of type ShootableDamaged. So you could say that the event goes to "every entity", although it's important to note that entities do not handle events themselves normally, systems do. But indeed, the system receives this event any time a entity with a Shootable component receives damage, for any kind of entity. The event is emitted from the DamageInflictionSystem btw: https://github.com/lethal-guitar/RigelEngine/blob/be5977b2964f7fc7650983246d008d2efa11de4b/src/game_logic/damage_infliction_system.cpp#L131

    So the BlueGuardSystem receives all ShootableDamaged events, even those which are emitted for other types of entities (not blue guards). But it's only interested in receiving this event for blue guard entities, so it has to do some filtering. That happens in the first line of BlueGuardSystem::receive, where we check if the entity referenced by the event has a BlueGuard component.

    So that's how we check the "type" of the entity which was damaged. But there is not really a concept of "entity type" in ECS, it's more like any entity which has a BlueGuard component will exhibit the blue guard behavior, and reacting to taking damage a specific way is part of that behavior.

    what kind of updates?

    The idea of "update" is very generic, so it depends on what a specific system does. In ECS, every system is typically updated once every frame. In Rigel, most systems are updated at a slower rate, since the game logic updates only at 15 FPS. But the rendering system for example is updated every frame.

    For the blue guard system, "update" means that the guard's AI is updated for the current frame, which can result in different things happening depending on the state of the guard and the player, like the guard might walk one step, or shoot at the player etc.

    For other systems, update has a different meaning. For example, the damage infliction system does a collision check to determine if any entity with a Shootable component is touching an entity with a DamageInflicting component, and handles the damage infliction if it finds a collision. The physics system moves entities around if they have a MovingBody component with a velocity set. The player damage system checks the player for collision against any entities with a PlayerDamaging component, etc.

    The blue guard's full observable behavior in the game results from the different systems working together to implement all aspects of that enemy. A blue guard entity has a PlayerDamaging component, therefore the player takes damage when touching a blue guard. It also has a Shootable component, so that the player can damage and kill a blue guard by shooting it. The BlueGuard component then holds all the state necessary to implement a blue guard's AI, which involves animation, walking, and shooting at the player. The AI is specific to the blue guard enemy, and therefore needs a dedicated system, whereas the aspects of damaging the player on contact and being shootable by the player are more general and can be used by many enemies. The systems implementing these aspects don't need to know anything about the specifics of blue guards.

    In a traditional OOP implementation, you could implement this by having a base class Shootable, from which PlayerDamaging would inherit, and then a class BlueGuard inheriting from PlayerDamaging. But that would be less flexible, becau

    Nikolai Wuttke
    @lethal-guitar

    because you may want to have entities that are player damaging but not shootable, and the other way around, etc. So then you would either need to make additional classes like PlayerDamagingNotShootable, or you would have to use a common base class like Enemy with properties to control if it should be shootable, player damaging etc. (resulting in a larger, more complex class)

    With the ECS approach, the Shootable and PlayerDamaging components are completely independent and you can easily combine them however you like.

    For example, you could make an invincible blue guard by simply removing the Shootable component, and the blue guard behavior would still work the same (it would just never receive the event that it has been damaged). Other blue guards could still have the component and still be shootable.

    Nikolai Wuttke
    @lethal-guitar
    Btw, I consider using a component and system to implement enemy behavior a design mistake nowadays, and I'm working on replacing that design with the newer BehaviorController approach. See https://github.com/lethal-guitar/RigelEngine/pull/509/commits/307839c556e6e0f3bf0fd9fcde713fee0b3f4476 for how this applies to the blue guard.
    Basically, having one system and one component for each type of enemy requires a lot of boilerplate without any real benefit. With the behavior controller, there is a single system and component pair to implement any arbitrary logic. It also streamlines the event handling for damage taken etc.
    It deviates from the ECS idea, since normally you don't want behavior in components. But in this case, it makes for simpler and easier to extend code, so I think it's preferable over strict ECS.
    Duke Nukem is so simple (compared to modern 3D AAA games) in any case, that the ECS approach is kind of overkill. A good old OOP based architecture would have worked totally fine, and that's also how the original game code is architected (albeit with using function pointers for polymorphism, since it was written in C not C++).
    Nikolai Wuttke
    @lethal-guitar
    But I wanted to learn about ECS at the time when I began the RigelEngine project, and so I went with it :) And I do like some aspects of it quite a lot, like the player damage, shootable, physics etc.
    Pratik Anand
    @pratikone
    hey thanks for the explanation. I will go through it properly to understand it
    For the ECS vs OOP part, yeah you are right. It is a simple game where anything would have worked. No scaling or performance requirements. I did notice BehaviorController but didn't know that it is not part of ECS. RigelEngine is my first encounter with ECS so I don't know what's in there and what's not. entityx github also doesn't do a good job of it. It just throws some simple projects using ECS and says go figure yourself, what's code for project and what's code for entityx
    I am surprised Duke Nukem 2 was not written in assembly. Or maybe because it was 1992 so use of assembly would have started to fade
    Nikolai Wuttke
    @lethal-guitar
    I think on PC, a mix of C with some assembly for performance critical functionality was common at that time. Commander Keen and Wolfenstein 3D had their source released, and they are both written that way. On consoles, assembly was still common though - the source for the SNES version of Doom was just released recently and it's all assembly
    Nikolai Wuttke
    @lethal-guitar
    Yeah it's true, the entityx repo could be organized a bit more clearly.. When I was learning about ECS, I found it a bit tricky also to find good material with practical examples. The basics are explained in many places but often only with very simple examples. And then it's hard to know how something like Duke's enemy AI should be modeled.
    It seems that there are different interpretations of the ECS model. In the end, I quite like the hybrid approach I've settled on for RigelEngine though
    There is this talk by a Blizzard engineer about how they used ECS for Overwatch, it's quite nice because it's a real world example: https://youtu.be/W3aieHjyNvw
    Can definitely recommend :)
    In the original Duke 2 code, there are also some sections that look like handwritten assembly, with others clearly coming from a compiler.
    Pratik Anand
    @pratikone
    Hey @lethal-guitar , as you might have noticed, i am away from Rigel Engine development for a few months. I have been running busy with other stuff. I a,
    i am planning to slowly ease back into it, starting with a tech blog on wasm work. Just catching up on any more quirks you found on wasm port ? I remmeber you found the reason for clipping and audio playback.
    Also, i am planning to focus on wasm side more for now. What are your plans for hosting it ? Are there any critical features you are waiting on , before you think it would be good to host ? Maybe i could start looking at those features.
    i will also be very interested to know what is your near future plan for rigel engine . Where you would want it to go
    Nikolai Wuttke
    @lethal-guitar

    Hey @pratikone ! I also wasn't very active myself, recently 😅 And sorry for the late reply, I'm currently on vacation and internet access is spotty here.

    For the Wasm port, I made issues for everything I noticed: https://github.com/lethal-guitar/RigelEngine/milestone/16

    As you mentioned, audio and window clipping are already fixed. There is still no audio on Chrome: (lethal-guitar/RigelEngine#567) - but it seems like it might be an easy fix, maybe a good one to get started.

    The biggest remaining issue that I think should be sorted out before hosting the game is lethal-guitar/RigelEngine#570. It makes navigating the menus quite cumbersome and gives a bad impression of the game - the loading is normally not noticeable, even on slow devices like Raspberry Pi. So it would be good to find out why it's so slow in Wasm. If you're interested in looking into it, that would be great for sure!

    Regarding hosting, I haven't thought about it very much. It's been a while since I've done any web development, so I would need to look into the landscape today and what options there are. It should be free, but aside from that, I don't really have any preferences or requirements. So if you have ideas, feel free to suggest something!

    Regarding future plans: I'm not quite sure what to focus on next, actually. Ultimately, the big goal is to release 1.0, non-beta. But there are many different things to do before I would consider the project ready for that: Improving performance on Raspberry Pi, implementing all remaining missing features, configurable controls, more usability improvements.. Then there are also some feature requests: Quick saving, better modding support, an improved camera..

    I think the immediate next steps for me when I get back home will be fixing the recent bug I discovered, merging the two open PRs, and then maybe looking into implementing the cloak effect shader.