• Content count

  • Joined

  • Last visited

Community Reputation

536 Good

About Omega147

  • Rank
    Advanced Member
  1. DirectX Textures Too Dark

    Could it be something as simple as the gamma levels on the computers you're testing on? Are you performing any in-game gamma correction?
  2. Quote:Original post by triqer I'm trying to implement what you said, but it seems like a LOT of checking stuff, and it seems like there should be a simpler way to do this. Well, predictive collision is harder to do than actual collision. Can you explain what you're trying to do in your program a little more? Why do you need to know if two objects will collide?
  3. Do you only need to know if they will collide, or are you interested in when they will collide as well? Do all objects have the same shape or size? Are there any other forces at work, such as friction, gravity, etc.? Can the objects change direction or velocity intermittently? Do the objects have a constant rotation? If the objects are aligned on the axes and can only travel in straight lines, one quick out is to see if the objects are on the same axis and moving towards each other. For example, if you know object A is at (0,0) with velocity (3,0), and object B is at (10,0) with velocity (-2,0), then they are moving towards each other on the same axis and will eventually collide. If two objects are on the same axis and both moving in the same direction, and if the object that is "behind" the other has a faster velocity, then the two objects will eventually collide. If two objects are on different axis and moving along different planes, such as one object moving up/down and another moving left/right, then the only point at which the two objects can intersect is at the point where their projected paths cross each other (if at all). You can find that point of intersection quickly if you have the differences in the objects' X and Y values handy. Next, compute the distance each object has to travel to reach that point. Assuming velocity and acceleration remain constant, you can compute the time it will take each object to get there with the equation "time = distance / velocity." If the two objects have the same time to reach the same point then they will collide. This also tells you precisely when the objects will collide. The above checks are all for the general cases that fit the criteria you've provided, however. If your objects are polygons, if they move in non-linear fashions, if they don't move at constant velocity, if they can change direction, etc. then there are a bundle of other calculations to do. Incorporating the SAT, for example.
  4. What's wrong with my collision?

    Quote:Original post by Yelnats Also, what do you mean strange happening to my variables? I mean when debugging, are you watching your variables? Have you stepped through your code line-by-line during execution to follow the variable assignments and ensured that everything is being set as you would expect?
  5. Strange lag problem

    Quote:Original post by cnr So, the games that I've made seem to run at 50fps, but then when I open something like Google Chrome, or .. any other 3D accelerated application, the framerate jumps up to over 2000. When you open Chrome, does your application maintain the high FPS even when it has focus? If the application doesn't have focus, the frames will jump because the OS will lower the drawing priority for it.
  6. What's wrong with my collision?

    Quote:Original post by Yelnats This still doesn't solve my previous errors. Can you provide more detail? What happens when you reach each of the map edges? Can you reproduce the stopping error? What coordinates does the program report for each tile that your player is at, and does that match up with what you're expecting? Also, have you noticed anything strange happening with your variables during debugging?
  7. Separate engines in separate threads?

    Quote:Original post by caecilius If I instantiate a separate Engine on each thread, will I have any problem executing scripts, or is there some kind of global state that is used even between Engines? It depends on the engine you're using. Some applications incorporate singletons, which restrict the number of instances that can run on a machine. Others don't. The problems you would run into would be those associated with any multi-threaded application, such as synchronization and resource sharing.
  8. What's wrong with my collision?

    In what increments do you move your sprite? Unless the sprite is moving at 20 pixel increments, then wherever you have a -- or ++ in your collision, you run the risk of triggering an out of bounds exception. In your "cleft" method, for example, if left is any value between 1 and 19 (the value 0 is caught in the "collisions" method), then when the integer variable "l" is assigned to "left / 20," it will receive the value 0. Then, no matter which branch the code proceeds to after that, indexing into "--l" will be outside of the array's bounds at -1. You may also want to revise your "whole" method. A difference of 0.05 between a float and a type-casted integer of that float doesn't make the value a whole number. Because floats are prone to round-off error, it's not uncommon to get a value like 3.999999999999 or 3.00000000001. With the type casting in your collision code, a float like 3.99999999 (essentially 4), would be treated as 3 when cast to an integer. Your "whole" method would classify that as not a whole number, since the difference would be 0.999999 (greater than 0.05), even though the float representation is 4 and indeed a whole number.
  9. braindigitalis: Do you have a game design document?
  10. Best way to track all story paths?

    I recommend Chat Mapper. You may also be interested in Ren'py or ChoiceScript.
  11. Help me solve this collision

    If you know the points B and C, imagine that there is a right-triangle formed to the lower-right where the line BC is the hypotenuse of length d. Since you know B, C, and d, you can calculate the two other sides of the imaginary right-triangle, and from that the interior angles. Once you know those angles, you can find the angle ABC as well as CAB, and then the final ACB angle. When you have those, you can calculate the length of e, which when subtracted from the X value of point B will give you A.x.
  12. 2D sidescrolling floor

    Quote:Original post by kfboelter Do I have to keep record of every Y coordinate of the floor, for every X on the cenario? Like, store it in some data structure? One optimization you could implement would be to store a series of straight lines that trace the surface of your floor. Then when you do collision, you would check all the lines within distance of your colliding object(s) and perform corrections that way.
  13. Question about tile games

    Quote:Original post by jyk The best way to find out where the time goes when making a game is probably just to start making one. Quoted for truth. A lot of your time will go into all the places you didn't expect, no matter what you've planned for. The worst part is putting the final polish on. Even with a fully functional, playable game, adding polish can take months.
  14. XNA Array comparison help

    Your approach is fine, just be careful with your boundary conditions. As you've illustrated, if the player were to move down from their [0, 0] start position, you'd be attempting to index into your tile array at [0, -1], which will throw an exception. Adding a couple if statements to check for boundaries should solve that problem. Here's some pseudo-code: if(player.Position.Y > 0 && move_direction == DOWN) { if(tileArray[player.Position.X, player.Position.Y - 1] == 1) { player.Position.Y--; } else { // can't move! } }
  15. Xdocument help

    Quote:Original post by turlisk I was informed to use foreach(xelement element in something.Elements()) to get all the tiles but i'm not sure how to use it or where to use it to fill the 2d array properly. Your "foreach (XElement element in tileInfo.Elements())" section of the code should be pulling all the tiles; each tile element will be stored one at a time into the variable "element." All you should have to do is change your assignment in the foreach body to use that variable: foreach (XElement element in tileInfo.Elements()) { arrayint[x, y] = int.Parse(element.Attribute("gid").Value); }