Syerjchep

Members
  • Content count

    98
  • Joined

  • Last visited

Community Reputation

212 Neutral

About Syerjchep

  • Rank
    Member

Personal Information

  1. Pretty straight forward question. I'm using the asset importer library to help me import collada files exported from blender (using an improved exporter add-on). These models have animations. I've written code that's able to use assimp to load these files and animate them reasonably well. The only problem is I have time markers in my models that will say, mark frame 17/250 as "reload:start" and frame 29/250 as "reload:end" and in order to know which frames to play to "reload" I need to be able to access this data in my program. Yet none of the documentation on assimp seems to hint at where this data is loaded to if at all.
  2. I believe I solved this problem. I got the newest version of GLEW and included the glew.c file directly in my project rather than trying to link to it.
  3. Not a graphics question per se, but I'm having a hell of a time just getting glew to work. See, I had a project using glew.h as well as other files like SDL_Opengl and glm all contained within main.cpp which I compiled and ran just fine. But now I want to split my project up into more files. The problem is if I include glew.h in one of my header files as well as in my main.cpp I get "multiple definition" errors. If I only include it in one or the other, then I get "function undefined" errors. I have tried including GLEW_STATIC and it seems to have done nothing. I also tried putting all my OpenGL header includes in a separate header file with it's own header locks and #pragma once calls and it still didn't work.
  4. I've made an evolution simulator using Box2d.

    New video: http://www.youtube.com/watch?v=32TciKAWlOU
  5. Not a wholly new concept, of course, but some of the ways I'm handling the back end aren't common. I first made a non-physics based evolution simulator back in October of 2016: https://www.youtube.com/watch?v=77mOTpppZwg It was pretty decent in some ways, but quite underwhelming. Two days ago I started a new evolution simulator using opengl graphics and the box2d physics library: https://www.youtube.com/watch?v=aNXJZjQS-vY Over the weekend I actually got it to work: https://www.youtube.com/watch?v=X3LkcTvsW1s Now that evolution works, I have to add another feature or two (fighting, gene combination), then I'll post videos of evolutionary progress. Once I add a spiffy interface I'll probably release it as well. For an additional resource, here's a google doc with a sloppy code specification: https://docs.google.com/document/d/1Uc6dLB3cb9oWFAWl6t2GGwI-ImPnVJV3KmlVcmFlFlE/edit?usp=sharing I'm going to tidy that up, and maybe even make a video on how the code itself works.
  6. So I've recently gotten Box2d to work with C++ and am having fun with it, but I wanted to add heat and pressure to my game. Here's a decent example of the kind of pressure system I'm thinking of: http://dan-ball.jp/en/javagame/dust/ That said, is there any page that summarizes the math required for this? I've searched "air pressure simulation" and "wind simulation" and haven't really come up with much in the way of guides and tutorials.
  7. You sure do like using emoticons in your reply. Anyway, if you or your teammates have previous work, post links to it here.
  8. Here's a little preview video I made for a different forum: https://www.youtube.com/watch?v=RsPHvHVxSxQ I've only really been working on this a few days but basically the program simulations a map with many different cells on them. Each cell has its own script that tells it what to do each frame. The 'scripting language' is specific for this program and is stored as a string of bytes that are susceptible to mutation. Most of the preferences and such are still hard coded and I only started making an actual interface for the program yesterday. Once I can work on it a bit more I might release a really early version for people to try.
  9. So I'm making a 2d game where there's a part of the interface that's supposed to display a tilemap. And I'm writing a map displayer that can be resized by the user. It's pretty obvious that if you have a map display that's twice as large as the map, you simply give each tile two pixels. And if you have a display that's half the size map you take every two pixels and average their color together. But what happens if your display is one third the size of the map, or 1.5 times the size of the map? Can someone provide me with a starting point to learn about this?
  10. Raycasts on a 2d map for determining vision.

    This is pretty much what I ended up going with. I took the outer perimeter of the units view point and for each tile (80 tiles if the radius is 10 tiles) did a raycast with 15 iterations each from the unit to that tile. That's only 1,200 calculations where I had needed 36,000. This is good enough to have it run in the main thread without killing FPS.    If anyone's still reading this I got a second question. So I have this code here that determines which tile a specific coordinate is located in:     bool pointInTriangle(point s, point a, point b, point c) {     //Find out if a point is in a particular triangle     //The first point is the point to check     //The other three are the three vertices of the triangle     int as_x = s.x-a.x;     int as_y = s.y-a.y;       bool s_ab = (b.x-a.x)*as_y-(b.y-a.y)*as_x > 0;       if(((c.x-a.x)*as_y-(c.y-a.y)*as_x > 0) == s_ab) return false;       if(((c.x-b.x)*(s.y-b.y)-(c.y-b.y)*(s.x-b.x) > 0) != s_ab) return false;       return true; }   point terrainMap::getTileFromPos(point &miso) {     point ret(-1,-1); //blank coordinate, to be returned -1,-1 if out of bounds       int tmpx = miso.x / 200; //From a non-isometric perspective the tiles are 200 wide and 100 long     int tmpy = miso.y / 100; //Though in an isometric perspective they're actually squares       if(miso.y < 0)         return ret;     if(miso.x < -2*miso.y) //Is it out of bounds?         return ret;     if(miso.x > 2*miso.y) //Keep in mind the map itself is a diamond as well, in addition to the individual tiles         return ret;     if(miso.y > (signed)(50*gridsize))     {         if((signed)(miso.y-(50*gridsize)) > (miso.x+(100*(signed)gridsize))/2)             return point(-2,-2);         if((signed)(miso.y-(50*gridsize)) > (miso.x-(100*(signed)gridsize))/-2)             return point(-3,-3);     }       if(miso.x < 0) //A diagonal line cuts the map in two, on one side the X coordinates are negative on the other they're positive     { //We have to calculate differently depending on which side we're on         point center(       (tmpx*200)-100   ,(tmpy*100)+50);         point topRight(     (tmpx*200)       ,(tmpy*100));         point topLeft(      (tmpx*200)-200   ,(tmpy*100));         point bottomRight(  (tmpx*200)       ,(tmpy*100)+100);         point bottomLeft(   (tmpx*200)-200   ,(tmpy*100)+100);           ret.x = tmpx+tmpy;         ret.y = tmpy*2;           if(pointInTriangle(miso,center,topRight,topLeft))         {             ret.y--;             ret.x--;         }         if(pointInTriangle(miso,center,bottomRight,bottomLeft))             ret.y++;         if(pointInTriangle(miso,center,topLeft,bottomLeft))             ret.x--;     }     else     {         point center((tmpx*200)+100,(tmpy*100)+50);         point topRight((tmpx*200)+200,(tmpy*100));         point topLeft((tmpx*200),(tmpy*100));         point bottomRight((tmpx*200)+200,(tmpy*100)+100);         point bottomLeft((tmpx*200),(tmpy*100)+100);           ret.x = tmpx+tmpy;         ret.y = tmpy*2;           if(pointInTriangle(miso,center,topRight,topLeft))             ret.y--;         if(pointInTriangle(miso,center,bottomRight,bottomLeft))         {             ret.y++;             ret.x++;         }         if(pointInTriangle(miso,center,topRight,bottomRight))             ret.x++;     }       return ret; } Basically it uses division to determine roughly where the coordinate is to a square, then divides that square into a center tile and four triangles around it containing adjacent tiles. It then uses pointInTriangle to determine which of these triangles it is in, or if it's in the center tile by process of elimination. The problem is this takes quite a lot of calculations for something I feel should be a lot simpler. Is there an easier way to convert coordinates to tile coordinates for diamond shaped tiles?
  11. So I'm making an RTS on a 2d isometric map. There is a 'fog of war' where units have line of sight and can reveal tiles around them. Making them simply reveal tiles in a box around their location is pretty easy, but I wanted a more realistic circular vision that can be obstructed by objects in the way.   I've already coded this, and the basic code is here:       resetFog();       for(unsigned int i = 0; i<calcUnits->size(); i++)     {         unsigned int tx = calcUnits->at(i).tileX;         unsigned int ty = calcUnits->at(i).tileY;           tmpExplored[tx+(ty*size)] = true;         for(double vi = 0; vi<360; vi++)         {             double xDir = sin(vi);             double yDir = cos(vi);             for(unsigned int m = 0; m<calcUnits->at(i).type->sightDistance; m++)             {                 double xPos = (xDir*m*15)+calcUnits->at(i).x;                 double yPos = (yDir*m*15)+calcUnits->at(i).y;                 point in(xPos,yPos);                 point aq(calcMap->getTileFromPos(in).toArray());                 if(aq.x > 0 && aq.x < size && aq.y > 0 && aq.y < size)                 {                     tmpExplored[(int)aq.x+(size*(int)aq.y)] = true;                     if(calcMap->treeGrid[(int)aq.x+((int)aq.y*size)])                         break;                 }                 else                     break;             }         }     }       updateHalfExplored(); resetFog() resets the buffer and updateHalfExplored() basically flips the buffer to the main array. As you can see for each unit 360 raycasts are made and each one is checked up to 100 times along the way stopping if an obstacle is found. This means there's up to 36,000 checks per unit which is a ton of processing, and is also far more checks than there are tiles in any units line of sight.   Is there anyway I can do this more efficiently?   The end result can be seen here: https://youtu.be/-qLojl_rAe4?t=45s
  12. So I've got a primary renderer attached to a window, it works fine. However, I have a texture I want to render to before I use the primary renderer to render the texture to the screen. I understand you can change the target of a renderer, and I've done this successfully. The problem is that I want to have the rendering to my texture be in its own thread, and using the same renderer with two threads simultaneously tends to create issues.    How can I render things to a texture in a separate thread from the main thread safely? 
  13. Need help finding which tile my cursor is in?

    This is pretty much what I ended up going with. It works beatifically, the code is understandable, and it takes just as long to run the code if I have 10x10 or 10,000x10,000 tiles. 
  14. Now I realize that sounds pretty easy, but I'm using a pseudo-isometric perspective with diamond shaped tiles. That means I can't just divide the x coord by the tile width and the y coord by the tile height to get the tile like I could with square tiles lined up straight.   Instead, my tiles are like this:   http://www.wildbunny.co.uk/blog/wp-content/uploads/2011/03/figure12.png   Now I have gotten this to work. The thing is, my solution used a formula to find out if the point was in a particular triangle or not. So I just divided each square/diamond into two triangles and used a loop to check though each of the triangles individually until I got one that the point was inside.    The problem with this is that using a loop means it gets slower the more tiles I have. I'm posting this because I just *know* at the back of my mind there has to be a simple equation to use for this, rather than a loop. I simply can't figure out what it might be.   So, can anyone help me write an equation to figure out what diamond shaped tile my cursor is in?
  15. I made this little webgame here: http://63.251.20.184 That's based off the popular webgame: http://agar.io The server is c++ with the sdlnet networking library. The client is an HTML5 canvas for graphics, javascript and websockets as the networking. I'm currently working on adding new features to make it into a unique game.