Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About maltman

  • Rank

Personal Information

  • Role
    Creative Director
  • Interests


  • Twitter
  • Github
  • Twitch
  • Steam

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @SyncViews Yeah that sounds about like what I am going for. I don't want the client to have a lot of freedom over the GUI. Things like click to focus, hot items, etc should be built in/non-configurable. This is mostly just for my game projects so I stop remaking the same code over and over. I stole from your post and copied your idea of re-ordering the child references. I created a root UI node which is entity # 0. It is invisible, has a global position of 0,0. and is the only node with no parent. It's children nodes are considered "windows". When I click on a window it gets shuffled to the front of Entity#0's children and gets rendered first. It's great! I am trying to recreate Windows GUI. I don't have any experience. I just feel that Windows style is a good starting point because it is familiar and it is flexible and I've been using it since the 90's. So my problem right now has to do with this: I don't know how to select only the highest Z level item for the Hot Item. It's easy for the windows(children of entity#0) because they are all in one vector of children, but the highest Z level item is in the tree and I don't know what to do. There are four important chunks of data: Hot Item: Whatever the mouse is hovering over, at the highest Z level, is the hot item. Active Item: Whatever is the hot item when the L-mouse button is clicked on becomes the active item, until the mouse is released. If the hot item is the same as it was when the L-mouse was clicked then activate that item or else set Active Item to Null. Focused Item: Focused Item (correct me if I am wrong) is like a text input box when it is ready to receive input. Focused Window: Like in Windows, entities you can alt-tab through which when focused on will be sent to top of render order. These are all children of entity#0. There are only one of each of these data so I have them all as global members of my singleton (evil I know) AppWindow class. I just can't figure out how to selectively only make the highest Z level entity the Hot Item. Thanks so far for the replies they've been very helpful. Edit: I am thinking I might want to make a Z-level map. I can add a "z height" member to the node component and entities can keep track of how high they are. Or they can add themselves to a static vector of vectors of entities. I can traverse the vectors top down checking mouse collision. That is the only thing I can think of right now.
  2. Well the solution I have now is this: There is a 0th guiEntity which is a sort of none thing which just serves as the root of the gui tree and which has a global position of 0,0. I created a component called Node which has a reference to the parent entity and a vector which has references to the children entities. During rendering I traverse this tree from the 0th entity to all the children. When I want to cycle up a window to the top of the render I find the entity I've clicked on and move it to be the first of the 0th entities children. Right now I am only having 0th entities children as "windows". I don't see a need to have other entities recognized as "windows". I define a window as an independent entity which is usual draggable.
  3. @SyncViews Your post is pretty enlightening for me. I didn't think of using a for loop like that. Recursion is still pretty confusing for me. That is part of why I am doing this project on a GUI before a game. GUI programming is at least convergent, you know what you want you just have to figure out how to get it. Game programming seems to me a bit more complex and open ended. I am not very interested in the immediate mode GUI after learning about them. I want to make a GUI library which inflicts the least amount of mess upon the client codebase as possible. Something clean and rather opaque. Also I see nothing wrong with caching data. Ram is cheap. I have altered my old project to use an ECS library. This library operates like many other ECS systems. Simply with a registry of entities which you can assign components to with bit masks. I'm trying to solve the problem of cycling focused elements to the front of render order now. My current hang up is on whether or create a new registry or vector of pointers or if I should just modify the original registry of entities when I want to cycle the elements to the front. Are there any disadvantaged to messing around with the original registry. I know it is kind of like having social security numbers and home addresses be the same thing, but I could possibly store another unique ID as a component to the entity.
  4. Hey, OP here. I've been using EnTT library coding in C++ for a GUI library. So far so good. I like the library and the pattern because it helps me with decoupling and inheritance confuses me a lot. The way the library works is each entity is an integer and they are all held in a registry. The systems you create traverse the registry and pick out all the entities which have the necessary components. Then the systems carry out their transformations on the components. For me this is easier than OOP at least it is does not seem any more difficult and provides a cool way to look at things. My next problem with my GUI library is bringing focused windows to the front of the render order. It seems I need another registry for render order. I thought about rearranging the main registry however, then I would have to store another unique ID as a component for each entity. I don't know really what is best I guess there are multiple ways to skin this feline. @Shaarigan. I'm pretty basic I don't have a complicated or unusual use case yet, but hopefully someday I will be sophisticated enough to. I like the idea of working with libraries and reusing others code. Usually the general solution is much better than any one I could come up with at this point in my development in CS.
  5. I have used EnTT for a few half finished projects. I like it because, as a more intermediate programmer, it forced me into the pattern. Sort of like coding on rails a bit in a good way. Part of my feels that it is too much of a bother for most projects. Another part of me feels like that the ECS pattern is only going to get more common and that I should be concerned about data locality and speed no matter what (otherwise why am I even writing in C++?). I've honestly never had a project which needed the extra performance boost that an ECS library would give me. Usually my bottleneck is inefficient collision detection and noob rendering. Two parts of my mind are conflicting: one tells me that using a library is great because it lets me how things are supposed to be done, and that I should use a library of every type before I try to roll my own. Another part of my mind tells me that I will never fully learn this stuff without rolling my own and that I am wasting my time using a library when I can't even roll my own and don't know completely how it all works. Anyhow, let me know your thoughts and experiences with ECS libraries.
  6. Well I've hit an impasse. I like my idea for a tree style system of entities, however it has revealed a weakness in me: I know nothing about trees, traversing trees, managing trees. I think I should continue with this style because so far it has been a great learning tool for me. I've never used recursion so much as I have working on this. I have trouble doing recursion with classes since "*this" seems to only point to the base classes and not the classes accessed via recursion. Not sure how to get around that. Anyways lots of fun, lots of fun. I'll probably start another side project to do more gamey style crap maybe with a multiplayer element, but this will still be an ongoing project for me as I learn more about recursiveness and trees.
  7. Well the way Hodgman described it is how I was thinking. Sort of treating all the behaviors of the window/entities like they were components to attach like legos. I'm just trying to do this without using inheritance and with as little code as possible. Can you elaborate on why IMGUI is poopoo and what are some alternatives you suggest?
  8. maltman

    Any tips for Better Writing?

    All history is horrible when its just "made up". Instead write a cool story and then try to learn from your cool story about your own world and its history. In general don't include any history in your story which does not add to the story. Less is more. definitely don't have any lengthy forced exposition which the player must listen to. Take for example Dishonored 1. There is a whole world out there with gods and stuff. I as the player don't really care I just want to kill stuff and do stealth missions. However, in the back of my head there is always a feeling that there is more to the world than this little corner and that makes it cool. But it isn't forced on me.
  9. I'm making a GUI library to build a game with. I started rather naively with a GUI class and then a window class and then a button class. I realized these share elements an I thought about using inheritance but then stopped myself. I decided entities and components are more flexible. Continuing this line of reasoning I realized that all GUI is just a tree of nested rectangles with various mouse interaction functions. So I've decided to build my entire GUI out of a single class: Window class. This class will itself contain a vector of its children Windows and will have some data like location and size and a reference to its parent window. It will only have a location which is considered relative to its parent. The ultimate window will cover the entirety of the screen and be transparent. This post is more of a blog post than asking any questions. Leave a post if you think my idea is brilliant or stupid or if I'm looking at this wrong. thanks.
  10. This worked: std::rotate(winIt, winIt + 1, windows.end()); Had to be backwards with the window being last in the array because I am using painters algorithm so last drawn is on top. I also switched to unique_ptrs Thank you.
  11. You know I just realized, I shouldn't be rotating or moving the windows directly because that means moving where they are in memory. Instead I should just move a reference or pointer to the window. The window class may grow big after all.
  12. I never ask for help, to a fault, but I'm stumped on this. I am trying to recreate something like Windows where there is a stack of windows and one window is on top which can be interacted with. When a window that is not on top is clicked on, it goes to the top. My problem is that I cannot figure out how to move a window from the middle of the stack to the top of the stack so that it can be rendered first and appear on the top. I'm using C++ and I'm trying to do it in a non-crappy way. Attached photo with some of my code (doesn't work).
  13. Can you think of any examples of a 2d isometric game without grid based buildings and terrain?
  14. Hello denizens of gamedev.net. I come in peace. I am here to mingle with my fellow recreational software creators and perhaps to learn some things about life. Right now I am working on a 2D isometric game along the lines of factorio. Have you noticed that in games like factorio, age of empires, and basically every 2d isometric game that buildings are placed in a grid of tiles wheras units can move freely between the tiles? Is there a good reason for that being the standard? Are there any games where buildings or even terrain is not bound to a grid structure? What would be the advantages of the grid? One advantage I can think is that it would be easier perhaps to randomly generate terrain on a grid rather than freely. Also, can someone please direct me to someone good resources on how to generate procedural maps and also how to save those maps to files. Thank you.
  • 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!