PhilObyte

Members
  • Content count

    40
  • Joined

  • Last visited

Everything posted by PhilObyte

  1. Hey, in order to compute light intensity for a pixel, I need to sum per-pixel attenuation along a ray to a buffer. The ray is parallel to the x-axis, so I have to sum values along the x-axis:   eg. 0112011 would become: 0124456 (number is sum of all previous numbers plus itself) This is a rather complex operation, depending on length of ray (width of texture) and number of rays (height).   I thought a solution would be to draw the texture additive multiple times, shifting it to the right one pixel each time: 0112011 + 011201 + 01120 + 0112 + 011 + 01 + 0 _________ 0124456 This works, but is computation expensive as well. Also, there are only 255 values which yields chunky results. I can't encapsulate numbers to 3-digit base 256 colors because additive blending would break this (it just adds per channel obviously). Please ask if I have not described the problem well. I hope someone can help me! Thanks, Phil
  2. Gonna try "Fast Summed-Area Table Generation and its Applications" (http://developer.amd.com/wordpress/media/2012/10/Hensley-SAT(EG05).pdf). I hope the cost for swapping render targets is no very high, I will test different sample widths and look what works for me. Thanks for all replys, I'm still very new to HLSL and sometimes don't know how to solve problems with it.
  3. Thanks for your reply! I saw a similar approach utilizing bi-lerps for performant gaussian blur. Regarding mipmaps: is there a way to use them for non-square blocks? I would like so read blocks of the x-axis only, without values from adjacent lines. This would decrease the number of rays resulting in artifacts.
  4. Terrain Generation

    You might want to look at this tutorial.
  5. Hey, I hope this is the right board to post this!   When I saw this prototype for a game idea (great site, btw.), I immediately thought of the usage as a CAPTCHA. It is very easy for a human to distinguish foreground and background. Would it be equally difficult for a computer to read it? I know that traditional CAPTCHAs can be read by a compute more reliably than by a human (http://www.digitaltrends.com/computing/google-cracks-captcha-with-an-algorithm-thats-99-8-percent-accurate/). I am curious because I know very little about efficient image processing. This is why I ask you: would it be very easy for a computer to read CAPTCHAs that are generated by a moving/still white noise, as you can see in the prototype I linked? Or could you think of a technique that would require little processing costs thus making my idea useless?   Thank you, Phil.
  6. Hello, I've been struggling for a while now getting a motion blur shader to work. I want to give the player a better feeling for velocity. My current approach is to draw a texture of my scene that consists of vectors how much this pixel is blurred and in what direction. I pack the numbers into the RG and BA channels to the base of 256. I even want to write a shader that does this for me, depending on rotational velocites, giving pixel-perfect gradients.   No problem until now, but how does my shader blur the scene, having just a sampler of the BlurTexture and the normal scene? I suck at math, so please help me! Thank you in advance, Phil.
  7. 2D Motion Blur Shader

    This does not produce what I expected :( the objects aren't streched, but rather change in opacity. Is there no way to do it like PAINT.NET? there is a motion blur that stretches the object. But it is really slow so I think it is not done by a O(n) fragment shader
  8. 2D Motion Blur Shader

    Thanks, I think I understood it. Will try this today!
  9. Shooting At Stuff

    I would not have guesses that it will be so complicated, but it is really useful, thanks!
  10. Light Test

    From the album My XNA Game-Engine

    Minecraft style lighting in 2d using a Queue and something like Dijkstra's algorithm. All relies on Grid(t), ITile, IPathNode, Light and LightManager (diagram).

    © (c) 2014 Philipp Hochmann

  11. My XNA Game-Engine

    I am currently making an Engine for my next XNA-Project. Of course, it's said "Make games, not engines and use a 3rd-party tool", but I want to learn how I can do simple tasks by myself.
  12. Old prototype

    From the album My XNA Game-Engine

    This is an old picture. Particles of the ship's jet look awful. The asteroid is rotating and the tiles follow this rotation, achieved by a transformation hierarchy (TransformedEntity in diagram).

    © (c) 2014 Philipp Hochmann

  13. Many enemies and particles

    From the album My XNA Game-Engine

    As you can see, I still don't know how to push the ships away from each other. I don't want to use a Physics lib.

    © (c) 2014 Philipp Hochmann

  14. Ai Testing

    From the album My XNA Game-Engine

    A.I. works good now. I used a vector projection on the relative velocity to determine the thrust. Rotation offset for shooting is calculated by matching tangential velocity of agent and its missiles.

    © (c) 2014 Philipp Hochmann

  15. Engine Diagram

    From the album My XNA Game-Engine

  16. I like the article because it gives me ideas for my current way of treating big amounts of particles. But I don't get why it is bad to use two lists, e.g. HashSets, because they don't need to be sorted, for storing alive and stock instances, whn you just add/delete references.
  17. When I want the camera to follow an object I multiply the camera matrix with the object matrix. So it follows/rotates/scales with the object (I usually disable scaleWithParent). I recommend to read this article: http://www.gamedev.net/page/resources/_/technical/math-and-physics/making-a-game-engine-transformations-r3566
  18. Hello community, I do not know how to make enemies chase the player. I already have the code to find the angle the enemy needs to shoot at to hit the moving player, and how to steer to it. (I don't want to make them cheat, they need to use their left-/right-jets like the player). But how do I find out which translational acceleration needs to be applied?   The challenge is to cope with the different physical attributes the ships have. Enemies might be much faster than the player, or much more inert. If I let them accelerate continuously, they are much too fast and rush by the player and can't rotate fast enough back which makes them lose the player (they can accelerate translational into the direction they head to and rotational left-/right) If I take the braking distance into account, they try to approach the point where the player is, which works, but if the player moves it results in too slow enemies because the braking distance is higher than the actual distance to the ship and they slow down.   I tried vector projection, to find out how much the velocity of an enemy matches with the direction to the player or the player's velocity, but that didn't help me either. I hope you understood my problem: How do I take the player's velocity into account to find the translational acceleration an enemy needs to have to chase it?   Here are the properties a ship has, I hope it helps you: int Mass { get; set; } float TranslationalAcceleration { get; set; } float RotationalAcceleration { get; set; } float TranslationalFriction { get; set; } // Amount the velocity vector is reduced each second float RotationalFriction { get; set; } float MaxTranslationalVelocity { get; set; } float MaxRotationalVelocity { get; set; } Here is the code for the rotational acceleration, in case you need it: public float ApproachAngle(float desiredAngle) { if (Math.Abs(desiredAngle) > .001f) { if (Physics.GetBrakingDistance(Math.Abs(ship.WorldRotationalVelocity), ship.RotationalAcceleration / ship.Mass + ship.RotationalFriction) > Math.Abs(desiredAngle)) { return -MathHelper2.GetSign(desiredAngle); } else { return MathHelper2.GetSign(desiredAngle); } } else return 0; } public float GetIntersectionOffset(float currentAngle, Vector2 targetVelocity, float ammoVelocity) { float tangential = targetVelocity.RotateBy(-currentAngle).Y; return MathHelper2.GetAngle(new Vector2((float)Math.Sqrt(Math.Pow(ammoVelocity, 2) - Math.Pow(tangential, 2)), tangential)); } It would be very nice if you help me. Phil
  19. 2D chase steering algorithm

    I already do, this is what the method GetIntersectionOffset() does (The shots need to have the same tangential velocity as the player relative to the enemy to hit the player). But I can't find the acceleration the enemy needs to keep up with the player :(
  20. Democratic Chess

    Hello Community, some of you may have seen "Twitch plays Pokemon". On the site there is a stream of an emulator that runs an old pokemon game. With the chat, you can press the keys of the virtual gameboy which leads to pure chaos, with sometimes 100,000 players.   This gave me the idea for an experiment: what would happen if two large groups would play chess against each other? Just one board and one game. Every team member can vote for the next turn. When a timer reaches zero, the turn with most of the votes is executed. When both teams are large, they would be exactly equally strong (in theory).   What do you think about it? Phil
  21. Democratic Chess

      Sounds exciting, but I would need to learn from the beginning, I have no clue how multiplayer and databases work. It stays a cool idea, I maybe realize in the future ;-)
  22. Space Game

    From the album My XNA Game-Engine

    this picture shows particles and light. Textures made a friend of mine.

    © (c) 2014 Philipp Hochmann

  23. I don't know whether I understood you right, but I think you need to do is intersection resolving. When your moving rectangle collides with the static (and it is not important from which side) you need to find out how deep and from what direction they overlap to push it out so that they are next to each other perfectly aligned but not penetrating. The code for is tricky. I took it from the XNA's platformer example and modified it a bit. I have not tested the normal it outputs but the rest should work perfectly: /// <returns>Depth of intersection relative to rectA</returns> public static Vector2 GetIntersectionDepth(Rectangle rectA, Rectangle rectB) { float halfWidthA = rectA.Width / 2f; float halfHeightA = rectA.Height / 2f; float halfWidthB = rectB.Width / 2f; float halfHeightB = rectB.Height / 2f; Vector2 centerA = new Vector2(rectA.Left + halfWidthA, rectA.Top + halfHeightA); Vector2 centerB = new Vector2(rectB.Left + halfWidthB, rectB.Top + halfHeightB); float distanceX = centerB.X - centerA.X; float distanceY = centerB.Y - centerA.Y; float minDistanceX = halfWidthA + halfWidthB; float minDistanceY = halfHeightA + halfHeightB; if (Math.Abs(distanceX) >= minDistanceX || Math.Abs(distanceY) >= minDistanceY) return Vector2.Zero; float depthX = distanceX > 0 ? minDistanceX - distanceX : -minDistanceX - distanceX; float depthY = distanceY > 0 ? minDistanceY - distanceY : -minDistanceY - distanceY; return new Vector2(depthX, depthY); } /// <returns>[0] position to add to B [1] normal</returns> public static Vector2[] ResolveIntersection(Rectangle rectA, Rectangle rectB) { Vector2 depth = GetIntersectionDepth(rectA, rectB); Vector2 normal; if (Math.Abs(depth.X) > Math.Abs(depth.Y)) { if (depth.Y > 0) normal = Vector2.UnitY; else normal = -Vector2.UnitY; } else { if (depth.X > 0) normal = Vector2.UnitX; else normal = -Vector2.UnitX; } if (Math.Abs(depth.X) > Math.Abs(depth.Y)) { return new Vector2[2] { new Vector2(0, depth.Y), normal }; } else { return new Vector2[2] { new Vector2(depth.X, 0), normal }; } } Hope I could help, Phil
  24. Democratic Chess

    Thanks for your feedback! Unfortunately, I know too little about networking and browser-programming to do this (and I have no large group I could test the idea with), so it will remain a thought experiment.