Jump to content
  • Advertisement

impulsee

Member
  • Content Count

    24
  • Joined

  • Last visited

Community Reputation

134 Neutral

About impulsee

  • Rank
    Member

Personal Information

  • Interests
    DevOps
    Education
    Programming
  1. impulsee

    ECS design

      Sorry, I didn't mean that I not know how to get everything drawn to screen (i have classes that deal with thinks like binding VAO's and using the shader program so all the linking is easy enough to do)   Ill try and give an example. So for my current rendering system I would have to have the following   A entity list for things that i want rendered a entity list of things that contain a light component  the camera This is fine for the most part and very much do able. For a standard model i would only have to like the model view and projection matrix, i would also have to link the texture if the model has one (simple bool check) and link the lights to the model (again easy enough). The trouble im having comes when a shader need more then this. It would seems that say i needed to pass another bool to a shader for some reason, i would have to define this with another component then bring it into the rendering system and check it exists then pass that components data to the shader. This would quickly get very complicated and messy for the system. The only other solution i can think of is the have a render class for each different type of object and have all the linked passed to it but this would still involve passing data from components.    Hope that gives a better explanation of my problem 
  2. impulsee

    ECS design

      Arr good to find some examples cheers for the links :).   I have one more question and it comes in relation to rendering. With using Opengl, creating a good render component and system seems pretty complex (due to getting the camera component, lights and data that might need to be linked to the shader for different objects). Has anyone got a good suggestion for solving this problem. I just dont see an easy way of creating this system without alot of small hacks (which is wat my current implementation has)   Again cheers for the help
  3. impulsee

    ECS design

      Yes I could see how this would become a problem.    From what I can tell, it might be best to just register the entity with the systems that would care for it, then just loop though those.   I have also seen examples that use nodes that store the needed components. Is this a good implementation idea or are their hidden problems. I would guess that you would need register a node with every system that would take a bit of time (but then again you would have to do this for entities aswell)
  4. impulsee

    ECS design

    In general im hearing that i should register a component with a system and then have the system loop though those components, but what if a system requires knowledge of more then one components (like the render system).    Registering a entity to a system sounds like it could work (like as naros suggests)     This sounds like a very interesting idea but i fear that this could become very complicated/memory heavy if a system would be interested in more then 2 components 
  5. impulsee

    ECS design

    Hey everyone,   I have been trying to create an entity component system for a while and thought that i had a good lay out but now i have ran into a big problem.   My first implementation was based on entities holding all of their components in a vector. systems would then loop though all entities  see if they have the entities they care about and then act if they had them.    As im sure you would be able to tell, this will hurt as we will loop though every entity and check if it has a component (or many more) which will hurt performance.   My second version planned to use an unordered map for every component type where the key will be the id of the component. This was looking good for a while but i ran into a problem with performance again. For systems I can loop though a component type but if i want a different component type (say for rendering i need model and texture and transpose component). I would need to do a find check to make sure that a map has a component of that ID. sadly this causes a massive loss in performance and leaves me where i was before.   So I guess really I'm asking for some guidance. Does anyone have a suggestion in a good way to create my entity component system to avoid performance problem. should i continue to use unordered maps or should I use vectors.     Thanks for reading :).  
  6. Hello everyone,   I have been looking into a lot of things about Entity component systems and after thinking how i would create one for a game I stumbled across a couple of questions that i need some help answering.   When it comes to ray casting and collision I can see an easy answer to record collision and letting another system deal with the outcomes like damage or HP buff or whatever, 1 of those solutions being some kind of messaging system that stores the collisions (well the 2 entities ID's) and a second solution could be creating a component with this data. All of this could be recorded in the collision system no problem.    Where i see a problem is where ray casting might be done for things other then collision like say avoidance steering behaviour or maybe guard line of sight. I don't see a way to easily resolve this issues as doing this check in say a steering behaviour system is possible but I don't feel its very efficient.    Another ways I have thought about it is to let systems talk to the collision system, but again I don't know if this is really a good idea.   Do anyone have any ideas on a good way to resolve this problem (and i guess problems like it) or if any of the ways i have suggested are viable.   Cheers for any input given. 
  7. impulsee

    Billboards Problems

    @[member='Nanoha'], Yes good old opengl and its camera logic   I believe i have it working how i need to now, Thanks for the help 
  8. impulsee

    Billboards Problems

    @[member='Nanoha'], do u mean flip the forward and right vectors or flip what the vector is (.x becomes .z)   In relation to your seconds fix, i have done written this change but the end result is very similar to what i had before   code below  glm::mat4 cammodelview = glm::inverse(view); //glm::vec4 right = glm::vec4(1, 0, 0, 0) * cammodelview; glm::vec4 right = cammodelview * glm::vec4(-1, 0, 0, 0); right.w = 0; //glm::vec4 up = glm::vec4(0, 1, 0, 0) * cammodelview; glm::vec4 up = cammodelview * glm::vec4(0, -1, 0, 0); up.w = 0; //glm::vec4 forward = glm::vec4(0, 0, 1, 0) * cammodelview; glm::vec4 forward = cammodelview * glm::vec4(0, 0, -1, 0); forward.w = 0; glm::mat4 mytest; mytest = glm::mat4(right, up, forward, glm::vec4(0, 0, 0, 1)); also for glm matrixname[0] will access the first row of the matrix (x axis)
  9. impulsee

    Billboards Problems

    So like the following? glm::mat4 cammodelview = view; glm::vec4 right = glm::vec4(1, 0, 0, 0) * cammodelview; right.w = 0; glm::vec4 up = glm::vec4(0, 1, 0, 0) * cammodelview; up.w = 0; glm::vec4 forward = glm::vec4(0, 0, 1, 0) * cammodelview; forward.w = 0; glm::mat4 mytest; mytest = glm::mat4(right, up, forward, glm::vec4(0, 0, 0, 1)); modelMatrix = translationmatrix * mytest; From this code i do get a behaviour that the quad that im using does following the camera (never see the edge) but i feel its still a bit off as when close up on the right side of the quad i get (if you can make it out atall)   https://i.gyazo.com/1a3e0ae81a7a9cb71affc37b74bba640.png (white box being the quad)   I think maybe its rotating the opposite way to where im turning (the camera is rotating) as i feel like the quad should be rotating so its almost pulling away the the camera (that being said could definitely get away with this)   Thanks for the responses btw :)
  10. impulsee

    Billboards Problems

    @Nanoha, Atm its for particles so that no matter where the camera is, the quad is facing the camera.   That definitely makes sense (in relation to the angle being positive or negative), I will try the solution out and get back to you when i get home  :)
  11. impulsee

    Billboards Problems

    Hey everyone, im trying to get a 2d plane to face the camera (Billboards for particles) but im having some problems.   Im currently trying to construct a quaternion using angle axis to face the object to the camera but either the object is not completely facing the camera at all times   currently I am constructing the angle and axis with a vector from the object to the camera and the original direction vector of the object (0,0,1) (so we recalculate each time)  glm::vec3 tocam = glm::normalize(camerapos - pos); float angle = std::acos(glm::dot(direction, tocam)); float a = fabs(glm::degrees(angle)); glm::vec3 axis = glm::cross(direction, tocam); currentrotation = glm::angleAxis(angle, axis); newdirection = currentrotation * direction; glm::mat4 RotationMatrix = glm::toMat4(currentrotation); glm::mat4 translationmatrix = glm::translate(glm::mat4(1.0f), pos); modelMatrix = translationmatrix * RotationMatrix; Is my understanding of this incorrect? i very much believe that the angle calculation is correct but that im doing something wrong with the axis.     Thanks in advance for any help and feel free to explain in detail what im doing wrong (more i can learn the better) :).
  12. impulsee

    Formations in RTS (A* pathfinding)

      Arr ok that does make sence.   I guess I could instead of having a seperation Behaviour just have a stop system instead. Then for the formation just do what tangle and shadow said and project the formation where i click and send each unit to one (with more logic it would fit with there current position). Would this work better?
  13. impulsee

    Formations in RTS (A* pathfinding)

      Yer, I have a grid of tiles where each one is a waypoint for A* to use to get the unit where I want it to go.   There will be obstacles that set tiles as inaccessible (like trees, walls and other buildings), so I don't know if that means not free-move but I'm guessing it does. From this I don't believe that you have steering avoidance around objects like these (if im wrong please say) as I thought that's what the a star is for. This leads to my problem as I don't know if its not just best to project a formation where the mouse is clicked and path-find each unit using a* to one of the formation points while using avoidance to stop them colliding, or if there is some better way to do formations.  
  14. Hey guys,   I'm trying to create an RTS but first making small programs that deal with different aspects of the type of game i want to create. Atm I have a 3d demo of one object that i can click and move around the map with the use of seek behaviour with A* (my map is gird/tile based) Now I want to be able to do the same but I'm having trouble thinking of a good way to move a group of units as a formation (im trying to move things as a box shape like in warcraft 3).    For this I have seen that you can create a formation from the units you have clicked, pick a leader, and then "flock" (with an offset for each unit) the group to its target location with using alignment to keep the units going to its destination, cohesion to keep it in place in the formation, and separation for local avoidance from other units.   I feel like this would work OK for the most part (presuming i can get the formation algorithm working) but the problem I have is that I don't know how I would deal with collisions on the way to the location (as the a star would only be calculated for the leader not the group) and what if at the end location the formation is not possible (there is a wall in the way or something similar).    Another way I was thinking was to simply project the formation at the mouse click location and make every unit path find there way there but i still run into the same problem with the end position.    So my question is do any of you guys know a fix for this, or just a better way in general to do path finding for multiple agents.   
  15. impulsee

    flocking sim help

    thanks that helped with the boids shaking on the spot so much    the only other thing i need to ask is that at the start i give each boid a starting velocity but they still end up stationery in the middle of the screen (like the screenshot). do i have to keep adding a force impulse to make they move in a direction?   in the example website all i could see was a starting velocity and after that they went in wat i guess would be the most common direction velocity (averaged). this is wat i thought alignment was in charge off. though i would also guess that it would be separation and cohesion that would be screwing up the alignment 
  • 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!