havsmonstret

Members
  • Content count

    19
  • Joined

  • Last visited

Community Reputation

1017 Excellent

About havsmonstret

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. Skeletal animation with COLLADA

      Correct me if I'm wrong, but it appears that you're performing a matrix calc for each bone for each vertex. If so, that's very inefficient and, either on the CPU or GPU, is a waste of computing time and power. I.e., it's likely that most of the vertex weights are 0 anyway.   A more common approach (in the shader) is to multiply the vertex position by only (for example) the 4 bone matrices that affect that vertex with the largest (normalized**) weights. That is, for each vertex, determine the indices of the bones with the 4 largest weights, and store those indices and weights as part of the vertex structure. That resorting should be done for the model file (and written out to a custom file to be used for your app) before it's loaded into your app. It needs be done only once.   ** By normalized weights I mean: select the 4 bones with the greatest weights for that vertex. Rescale them such that weight1 + weight2 + weight3 + weight4 = 1.0. Then store the first 3 weights. The fourth weight can be later calculated as 1.0 - wt0 - wt1 - wt2.   You then store all the bone matrices in an array in the shader and end up with something like the second code set here. In particular, note that the bone indices and weights are input per vertex, rather than vertex weights per bone.   Yeah, you're right. That is just hard coded currently so I could get a simple animation up and running and get it to work before I optimize and generalize it.   Thanks! That's exactly what I needed to get it up and running!
  2. Hello. I'm trying to implement skeletal animation and loading my model and animation from COLLADA files. I've read all the data from the file and I've got my bones and vertex weights set up. Currently I set all the bones' transformation matrices to the identity matrix and then translate the root bone to see that that works.   I apply all the bone transformations with the vertex weights in my vertex shader (GLSL): mat4 animationTransformation = TRANSFORM_Root * vertexWeights0 + TRANSFORM_Head * vertexWeights1 + TRANSFORM_Shoulder_L * vertexWeights2 + TRANSFORM_Arm_L * vertexWeights3 + TRANSFORM_Shoulder_R * vertexWeights4 + TRANSFORM_Arm_R * vertexWeights5 + TRANSFORM_Upper_Leg_R * vertexWeights6 + TRANSFORM_Leg_R * vertexWeights7 + TRANSFORM_Upper_Leg_L * vertexWeights8 + TRANSFORM_Leg_L * vertexWeights9; gl_Position = vertexTransformation * animationTransformation * vec4(vertexPosition, 1.0); And then I modify the TRANSFORM_Root matrix and upload it: animation.getJoints().get("Root").setTransform(new Matrix4(new float[][] { new float[] { 1.0f, 0.0f, 0.0f, 3.0f * (float)Math.sin(t) }, new float[] { 0.0f, 1.0f, 0.0f, 0.0f }, new float[] { 0.0f, 0.0f, 1.0f, 0.0f }, new float[] { 0.0f, 0.0f, 0.0f, 1.0f } })); shader.updateUniform("TRANSFORM_Root", animation.getJoints().get("Root").getMatrix(), true); This works fine and the whole model translates nicely along the x-axis.   What I don't understand is what data to actually use for what from the COLLADA file.   Each bone has it's own transform in the skeleton definition (visual_scenes). Further I have a bind shape matrix (read from bind_shape_matrix) which is just the identity matrix in my case, a "skin bind-pose" matrix for each bone (read from library_controllers -> skin). They are specified as "inverse bind matrices". I also have animations for each bone, specified by a list of times and matrices. I understand I should interpolate between these different animation matrices.   But how do I put all these matrices together for uploading to the graphics card? I've read a couple of tutorials and they are quite unclear on how to do this (or don't use COLLADA at all), most just have a "bone transform" which is used to transform the vertices. But how do I calculate this transform from the bones' transformations, the skin bind-pose matrices and the animation matrices?   Here's the COLLADA file if anyone wants to take a closer look: https://gist.github.com/anonymous/da2c3f57140c1a5beb1b   Sorry for the nasty code. Thanks in advance!
  3. web based dungeon creator

    Is there a game bound to this or is it for physical role-playing? In that case there's quite a lot of competition, one of the best IMO is http://donjon.bin.sh/fantasy/dungeon/
  4. Feedback on turn-based combat system

    Okay, so the game is more of an arcade dungeon crawler than a traditional RPG. All the levels are randomly generated and your goal is to make it down to the last level and defeat an end boss. As usual with roguelikes, the game features permanent death, so if you die you have to start from the beginning.   Leveling up and character progression doesn't exist, the lower health means greater power is there to replace the traditional experience and levels. Since the game is arcady and really meant to be played is shorter amounts of time I wanted something other that's interesting than long character progression and story that you have to spend lots of time on.   The power-ups are consumables found in the randomly generated world and increase your character relative to her current powers. There's not many of them in order to keep the game simple and arcady. I'm still trying to keep some depth via the combat system.   I hope that clears up a little about the game and my intentions. The game is in quite a niche genre and a hobby project, so having to attract a large audience is not a primary goal.
  5. Hey.   I'm thinking a bit about a simple turn-based combat system, nothing fancy but at least something out of the ordinary. It's planned to be implemented in a roguelike game. The game is based around a lower health means greater power mechanic, so the lower your health, the better your character performs. Health can never be recovered, only temporarily fortified.   First of all, there is no character stats. You do not have strength, agility or anything that really changes the combat. All weapons inflict the same amount of damage, but they work in different ways. There's four types of weapons; Short weapons, medium weapons, long weapons and ranged weapons.   Short weapons can attack any adjacent cell.   Medium weapons can attack any adjacent cell and the two cells next to it. It can hit up to 3 opponents.   Long weapons can attack any adjacent cell and the next cell behind it. It can hit up to 2 opponents.   Ranged weapons can attack any cell in the field of view. The first enemy on the projectiles path is hit and does not continue.     When you attack something, a random number is generated with normal distribution, with the mean at the base damage for all weapons. The two red lines indicate that everything between them is a hit and everything outside is a miss. These lines depends on the opponents armour class. The lower the armour class, the closer the red lines are to the mean and the harder the opponent is to hit. If the attack is considered a hit, the random number generated is the damage output.     The higher the amour class though, the more damage is reduced from the incoming damage.   Lets set up a scenario: The character is using a medium weapon and there's two enemies adjacent to her. She attacks them and one roll is made for each opponent. She hits one but misses the other. Since there was two potential targets, the damage done is halved.   Lets say the damage output for the opponent we hit was 10. The damage is halved, so there's 5 damage sent to the opponent. That opponent has a high armour class so the damage is reduced by 3, the damage inflicted on the opponents health is 2.     Instead of having a lot of different weapons with different damage and magic attributes, the game features power-ups instead. A power-up might heighten the players damage in different ways (changing the mean and standard deviation in the damage roll), or increase the players effective health. You can increase your armour class by using heavier armour, this will of course make you easier to hit but the incoming damage is reduced more.    I'd love to hear your opinions on this idea, does it sound anything like fun? Will the lack or different weapons become dull and boring?
  6. You could detect if the request is an AJAX request and redirect to the index.php if it's not. Altough as almost anything else, the header can be spoofed so it's not 100% proof. But for "legit" users it will most likely work.   http://davidwalsh.name/detect-ajax
  7. $('#result a').on('click', function() { $('#result').load($(this).attr('href')); return false; });   Something like that? That will load the page the anchor links to. This affects all anchors in the div though, you might want to change the selector to only affect a specific class.
  8. HTML5 game development tools

    JSLint can also help you find error and mistakes, although it's quite harsh.
  9. Creating an MMORPG - Connecting/Opening Ports?

    Here's a list of ports that are known to be used for various applications: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers I'd not recommend using port 80 though, or any other port that are known to be used for obvious reasons. It wont cause any troubles for the clients though.
  10. Well, it just adds 1 to y so removing 1 if y == 420 will just put it back at 420. You need to have some kind of variable indicating which way the ball is moving. I'd suggest you add a vector and they adding it to the position and changing the vector to a negative y-value whenever you hit the wall and vice versa for the other wall.
  11. Making a chat log for 2d turn based rpg

      I didn't mean you should just use it, but you can look at it and see how I did it.
  12. Making a chat log for 2d turn based rpg

    If you are looking for some help on implementation I've written a message list / box in C# and XNA which you can find here: https://github.com/albinodervall/Roguelike/blob/master/Roguelike/Interface/MessageList.cs   It uses some XNA specific stuff like measuring the length in pixels of a string and such but the general idea is there. It supports the ability to colour your text, for example: $Red Hello, $Green BaneTrapper Would come out as: Hello, BaneTrapper   It also support word-wrapping when a message becomes too long. I hope it will help you somewhere on your way.
  13. 2D - Loading different tilesets by map

    I don't see why you would need a second ContentManager, just use the one you already have and pass it into the class / method that reads the XML.
  14. My GDD

      I don't know if it's just Word 2013 screwing it up but you should really look into paragraphs. Everything is just a single line of text.