• Advertisement

Angelic Ice

  • Content count

  • Joined

  • Last visited

Community Reputation

928 Good


About Angelic Ice

  • Rank

Personal Information

  • Interests
  1. Ah, I see. That means, I need to keep and transform the bounding box from axis-aligned to the displayed view as well? Will have to look into what mouse-collision is common for that shape, probably some diamond/point math.
  2. But how would I check if an object is under the mouse pointer? The isometric world, or player's shown world offers diamond shapes, that's why I went for an axis-aligned game world, to provide simple collision etc. If I project the mouse coordinate to the axis-aligned world, it would already be transformed to the wrong field. Is a screen ray the same as a ray cast?
  3. Hey! I have an isometric scene as displayed world for the user and the rest is axis-aligned, pretty much to have an easy collision-checking. The axis-aligned consists of cubes, hence 3d, with height. The issue are mouse clicks. When cubes stack, as in one cube on top of another cube (and so on), projecting to isometric-representation brings one issue: The stacked cube "tower" hides cube behind them. So if a player wants to click on top of the cube-tower, the coordinates would be projected to the wrong cube, visually hidden cubes, which the player probably has no interest of clicking. Is there a way to fix this issue? Goals: A player needs to be able to click 1) every cube and 2) every object (enemies etc.) on top of a cube.
  4. Kylotan, I guess I understand what you mean. Maybe I'm trying to much here already, I just wanted to use virtuals everywhere to substitute them in unit-tests. Maybe I should only do this to actual dependencies and that's the origin of bad design. Are you sure this matches in your code? You are right, this is wrong. I meant: std::vector<Interface_Bucket*>, a vector of pointers. I just read about LSP and am not totally sure if what I do is against that, but I highly assume it is. Usually, bucket-objects do not require a category, just as in most implementations, that's what the interface would convey. However in my implementations, some bucket-objects would have an enum giving more detail about what category they have, so more of a specialised customised bucket-data-structure. Since this would require a getter, they would violate the LSP, I assume. Thanks a lot, your posts and linked resources helped me a bunch already, I was going forth and back in my head for a few days now and was not really sure how to formulate my situation into an internet-search : )
  5. Leaving out? What do you mean? The '...'? Those are nothing but constructors and remove/clear methods. But I wanted to take out one example that caused me trouble in fully designing the interface. None of them is actually implemented yet because I realised that inserting is already causing trouble. And yes, I can ensure that they have the same type because there won't be another derived object-type. Derived_Bucket_A will have only one Derived_Bucket_Object_A, they are a "pair". Originally I had a Bucket-Class and its with the signature of add_object(Categorised_Bucket_Object* object), and since Categorised_Bucket_Object has the enum as a member, it's easy to just attain it via getter. But surely, once everything becomes an interface, it's difficult to attain a value that only is part of the implementation. I will look into the Bridge design pattern : ) Thanks for your help!
  6. Hey everyone! Text is down below, just wanted to provide some C++ish pseudo-code to help me expressing my issue ('...' defines omitted details): class Interface_Tree { public: ... } class Tree : public Interface_Tree { public: ... private: std::vector<Interface_Bucket> buckets; } class Interface_Bucket { public: ... add_object(Interface_Object* obj) } class Special_Bucket : public Interface_Bucket { public: add_object(Interface_Bucket_Object* obj) { /* If `Interface_Bucket_Object` cannot be cast to `Special_Bucket_Object_Category`, do nothing. This would require a dynamic_cast which I want to avoid, that probably cannot unless restructuring. Check what enum-type `Special_Bucket_Object_Category` If `VERY_IMPORTANT` use pointer `very_important_obj`. Else add to `objs`. */ } private: std::vector<Interface_Bucket_Object*> objs; Interface_Bucket_Object* very_important_obj; } class Interface_Bucket_Object { public: ... } enum Special_Bucket_Object_Category { IMPORTANT, VERY_IMPORTANT, SPAM }; class Special_Bucket_Object : public Interface { public: ... private: Special_Bucket_Object_Category category; } I wanted to start programming to interfaces (or in C++, virtual classes) instead of actual classes (which are now just derived ones) in order to improve unit-testing etc., hence every class derives a base, that can be easily implemented differently. But the issue is, if I have a Hash-Bucket data-structure class owning buckets that collect bucket-objects, how can the bucket differentiate characteristics of an implementation of the implemented bucket-object? Sure, I can do a dynamic-cast, if that fails just abort, but I do not want to do a dynamic-cast, because I would rather restructure my code. I want my bucket-objects to have a flag (could also be called tag, category, ...) that notifies a bucket that this object needs the entire bucket, hence the enum in my code expressing the flags an object can raise. If I would omit all interface-stuff, it would be fairly easy. My Bucket's add_object() method could easily only be called with that exact object and since the exact bucket-object type is now given, and not just some interface, accessing the enum is trivial via a getter-method. And a last reminder: I'm not using virtual-classes to profit from inheritance in a sense of a bucket being able to collect a tons of different implementations, just one implementation that carries an enum. The bucket-tree won't own different types of buckets neither, just one implementation kind of bucket. The only reason I use inheritance is to enable easy unit-testing. So, how can I access the object's category without dynamic-casting?
  7. How do you maintain Spatial Hashing?

    By spanning buckets I was referring to one object transitioning from grid a to grid b. For the sake of collision, it would be required for other objects to know on what buckets there are currently on. I thought using one hashed bucket per grid would be quite neat and not reconstructing the entire spatial-hashing would make it a bit more efficient, since we are not talking about thousand of objects, hence alignment in RAM is probably not that crucial. Oh, I could do the following: Keep old and new coordinates and then in order to update... - If old hash-buckets are also reachable via the new/transformed coordinates, keep them. - If old hash-buckets are not reachable via the new/transformed coordinates, remove references to the object in those buckets. - Assign every new grid that was not already reachable via the new/transformed coordinates with old coordinates. Is this a legit way of dealing with it? I never really thought about just simply using the old coordinates which made the thought-process for me quite difficult of finding the old hash-buckets.
  8. Hello forum! I would like to know how you handle spatial hashing in terms of updating elements. First of all, I would like to point out, I'm talking about a spatial hash where one object can be referenced in multiple hash-buckets, as it could cross the border from bucket 1 to 2. Next would be a game-object's position being updated, what do or would you do? Rebuild the entire spatial hashing (as its done with octree etc.)? Or would you maybe give each game-object a reference to its hash-buckets to make the game-object instruct deleting your game-object from its list/vector/... inside each hash-bucket referenced? If you decide to remove and then insert again - as just mentioned - I would be really interested in the way you tidy up all hash-buckets that used to have that particular object - since one object could potentially be referenced in multiple buckets (hit box being on a corner where e.g. 4 buckets meet, as stated in the beginning above). If you have any particular language-specific tricks, I would be interested in C++ ways of doing. Maybe some weak-pointer-trickery..? Thanks for your time!
  9. Hello forum! I have a structure for my game-field, similar to a scene-graph one could say. Every object in this scene-graph has the base-class Scene_Graph_Object. Now, when the savefile is being deserialised, an object builds all of these Scene_Graph_Objects from the file. Nonetheless, there is one thing separating these Scene_Graph_Objects, their purpose within the game-field. Some have no function, some are purely visual, others are playable, ... They are being sorted into different vectors depending on their category, more precisely put: Scene_Graph_Objects could be downcast to Visual_Only_Scene_Graph_Object, Playable_Scene_Graph_Object, ... And this brings up my question: Where should this differentiation happening? Deserialise -> Create Visual_Only_Scene_Graph_Object, Playable_Scene_Graph_Object, ... save them as Scene_Graph_Object base, and send that to the game-field-builder? I feel like all these up- and downcasting isn't really a pretty thing to do. Also considered to use some flags instead. As in an enum that all Scene_Graph_Objects own and can be checked once they are meant to be sorted into the scene-graph. The reason behind these categories is, that they help me to build a pretty simple and tailored game-field, but somewhat I think that inheritance is not really bringing up any advantages, because inherited classes do not really extend the usage but only categorise the scene-graph-objects. Would be quite happy to hear what you think : )
  10. Hello everyone! My game has a huge support for customised content. Customised as in new levels with (optional) new features, graphics, etc. I considered getting a server for my game that players can upload their levels to and others can download/rate/comment them, all in the game-client. The issue is that players could upload content that might be illegal to certain laws in certain countries. I surely do not want to support such content. Simply removing usused content (people trying to upload illegal videos, ...) is one step I have in mind, but surely does not remove other stuff. But how do I encounter this situation? Talking with a lawyer is surely on my todo-list if I settle for hosting the server myself. Nonetheless, having to pay for the server and then even be sued for uploaded content is very unappealing. The game will be sold on multiple stores. I sadly feel that the costs (especially to protect myself against lawsuits) is too high to offer such a server... hence using something as the Steam Workshop might be a better bet. My last idea was to forbid media content but script files... but in the end even that could be stolen from other licensed material... Is there any content/advice that I could read about to inform myself on how this all could work out while being safe in terms of legal infringements? Thanks for reading!
  11. 3d Physics and 2d Game-objects

    Actually, I have 2d isometric levels with grids. Players interact with a grid-logic only. Originally I used a flattened vector to store grids, it worked out quite well but then I started to encounter an issue: If a character moves from tile 1 to 2, they have to lock/unlock their grids at some point, as in transitioning from one element to another on the vector. This destroys the flexibility of real-time checking. If the target-grid disappears, the player should fall down. If an enemy appears, they should be damages. But grid-logic left me kind of turn-based, which is not my goal. So I decided to do AABB and go full 3d for the physics/real-time-feeling but still render in 2d and provide a grid-logic to the user. Box2d is 2d though, right? I would require a cube-object though. Anyway, I doubt doing cube-collision is that hard to do in AABB. I was not really sure if the transformation from AABB 3d to 2d display is common, but according to some research, it is.
  12. 3d Physics and 2d Game-objects

    I researched a bit more during the last days. I have no real physics engine because I thought handling the required physic is doable by myself: Collision between cubes and is one gravity-affected cube standing on a ground cube. What do you mean by bouncing cube and not snap to grid? In my 3d world there is no grid, only in the displayed world, the 2d one. I read about AABB and I think that is what I meant earlier. I want to do AABB for collision and then do an isometric projection to my 2d world and calculate the x and y of each plane, since there are no 3d models but 2d images. By transformation-matrix I rather meant a way to transform my 3d cubes to the 2d images, I read about isometric projection and will probably use that.
  13. Hello forum! Hello forum! Quick overview of my problem: All my assets are 2d, because the game is only viewed from the isometric-perspective. But the game shall include height, which also requires that every isometric-tile exists with height, width and depth. Nonetheless, since the actual visible game is isometric, I'm struggling a bit with realising the 3d-part. All bounding boxes are meant to be cubes. Currently I worked out the following plan: - Do the 3d math in a orthogonal view (but in 3d). - If an object moves, work with its physics-coordinates and check for collision etc. - If a movement has been committed, transform the top-down 3d view to a 2d isometric view (use physics-coordinates to calculate the location for the 2d texture plane of the tile). I'm still wondering whether this is a good way to do it or if there is anything that should be preferred? I personally assumed, that is way easier to work from top-down, because cube-collision should be easier and faster to implement, if everything is just straight. Another question would be, what transformation-matrix should be used for this case? Last but not least, how would a mouse-click be handled? My idea was to transform the mouse-coordinates from 2d to the 3d field and raycast it for collision? Thanks for taking your time to read my post! Edit: I assume this posts fits better in Math and Physics... sorry!
  14. Hello community! I actually would like to develop a small piece of software that alters colours seen on the monitor. I know about applications like Flux, that remove blue hues depending on time and plenty other stuff. What I precisely want: Be able to filter out complete or partial ranges and convert them into other ranges. E.g. mapping green colours to red ones. Probably using some matrix to convert them. So, I'm more curious about how manipulate/access the screen-colours. For example, I'm assuming I will depend on graphics drivers? Or can I bypass graphics drivers by post-processing as I would prefer to be independent of the sheer amount of different drivers. Especially uncertain about what problems I will be facing... graphics drivers, OS, ... and what programming languages already offer solutions. Thanks for your time, please note if I've been unclear.
  15. Algorithm Spatial Sorting in 3d

    Ah, assumed something into that direction, thanks! Yes and it is too slow on weak devices (e.g. smartphones), especially since I need a rather scaling implementation, as the object-count is not predictable (200 objects was just the bare minimum).
  • Advertisement