Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

1018 Excellent

About havsmonstret

  • Rank

Personal Information

  • Role
  • Interests
  1. havsmonstret

    [Lua] Fill table with script file

    The easiest approach is probably to do: return { init: function() end, update: function() end } That will push the table onto the stack as a return value when you call the chunk (using luaL_dofile for example).
  2. havsmonstret

    STB Image

    Both stb_image.h and stb_image_write.h was updated a month ago: https://github.com/nothings/stb I use both without any problems. It has some limitations though that's specified in the files, perhaps you violate some of them?
  3. havsmonstret

    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!
  4. 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!
  5. havsmonstret

    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/
  6. havsmonstret

    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.
  7. 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?
  8. 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
  9. $('#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.
  10. havsmonstret

    Oh, your code structure isn't pefect?

    The problem with me creating stuff, generally, is that I am a perfectionist. And that doesn't only apply to the outcome but also the process of making something. Countless times I've looked at my projects and thought to myself; "That's a complete mess.." even though it was probably just fine. And this project is not an exception. I've redesigned and restructured the game code quite a few times, trying different ways I can put together namespaces, projects and classes to achieve a structure I'm genuinely satisfied with. And I've come to the conclusion that that is a total time waster (newsflash). So moving from XNA to MonoGame, or being even more ambitious and moving to SharpDX, will be the time I think the structure through thoroughly and just stick with it. As XNA's future doesn't look too bright I've decided to migrate to MonoGame, which also gives me the opportunity to port to Linux and a variety of other platforms as well when the time comes, or SharpDX which will be a lot tougher but might give me a bit more insight into DirectX development. So the current milestone I'm facing is just moving the game over to MonoGame or SharpDX and get it up and running. If I decide to go with MonoGame I will try to check out what has to be done to get it running on Linux and Mac and see if it's worth the work right now. In other news, I actually got some very... dull I guess, screenshots to show off. All graphics (except the message list) is courtesy of Oryx (http://oryxdesignlab.com/). Hopefully, next time I've moved over to MonoGame / SharpDX and have settled down on a code structure and can get into adding some real features!
  11. havsmonstret

    A ton of work

    Oh yes, this weekend has been filled with work. I've deviated a little bit from the tile and tile manager to do some more general stuff. I restructured a lot of my project and I feel I have most of my code where I want it and under control. GitHub's issues and milestones have really helped me get myself motivated, I've been up late nights just closing one more issue. I decided to go with the Nuclex Framework's TrueType processor and the Bitstream Vera Sans Mono font which I think renders just perfectly. I also made up my mind to go with Oryx's Lofi Fantasy sprites during the development. Some new features added are a debug overlay which shows the current FPS and the running game states. I also implemented the ability to load and save configuration options to an external file. Currently this only comprises of screen resolution, fullscreen option and keybindings though. There's not a lot to show at the moment, the source code is now up to date on GitHub if anyone would want to look at it. I'm planning on importing one of my old goes at a tile system the comming days and then gradually modify it into what I'm looking for. Then there will be a lot more to show off.
  12. havsmonstret

    Gitin' it done

      Well that was embarrassing, fixed now though.
  13. havsmonstret

    Gitin' it done

      Edit: Misunderstanding, no that wasn't intentional. Got it fixed :)
  14. havsmonstret

    Gitin' it done

    I've just been soaked in work last week but it's clearing up. Some spare time has shown itself allowing me to work a little bit on my game though. Some stuff has been changed around and I've finally gotten around to learn Git and got myself a GitHub account set up. I have decided to publish my code there in a public repository, for the time being at least. I got a small GameState system up and running and started with the message box as Ashaman73 pointed out would be smart in my last entry. After a bit of thinking I got the message box worked out just the way I want. I'm not really satisfied by the font rendering in XNA. I created my own SpriteFont texture of the Consolas font but it's not really there yet. I might try out some different font processors (such as the VectorFont processor in Nuclex Framework) and see if there's any difference for the better. Here's a demonstration of the message box in the current state: You can set different colours to every single letter, scroll through all the messages and they automaticly wrap depending on the width of the message box. The next step is the tiles and tile manager. I'm not the greatest artist so I will probably start out using some free sprites to spend the most time actually developing the game. Maybe Oryx's famous Lofi Fantasy set. I would probably be stuck forever trying to create some sprites as I'm pretty much a perfectionist. If anyone is interested in the source code you could look at it on GitHub. (EDIT: The repository is currently out of date as I'm shifting around some stuff in the project). I've done a lot of experimenting with tiles before so hopefully this next step will be a fairly quick and painless milestone
  15. havsmonstret

    Tiles, tiles, tiles...

    OMG, you don't want to write a GDD ... I'm too not a big fan of large documents either, but you should be really careful about feature-creep. Your vision will explode along while development your game, the desire to add all this little, but not really expensive, features will mount up ;) Best to define the core features first, reduce it as much as possible, and write all your other features to a separate list for later.   You should start with the following first: 1. This step will add a message box at the bottom of the screen 2. The first step is creating the tile manager and the tile 3. This step will make it possible to save the map to an external file and load it 4. This step will implement the actor and the player class.   The message box is important for debugging, which helps a lot. The save/load game feature should not be done too late (I've made this misstake). The hard part is not to load/save your maps, but to save a running game state (longer running actions etc.) and recover this game state again and it helps a lot when debugging (try to track down a bug which will only occur sporadically after 10 min into the game and that without save game support). The holy grail of save games is, from a technical perspective, save games, which will be valid even after you continued developing your game. This will not be 100% possible, but it helps a lot to keep this in mind while developing it.   As this is more of a hobby project I'm not to afraid of feature-creep stalling any release but I will try to limit myself to a core feature list, release the game and then build upon it adding other features in later updates.   What your are saying about the list is totally true, I will definitely take that into consideration and revise my list a bit.     That seems pretty much like what I am doing yeah, but in a different format. I might adopt the user design way of writing the features though. I will take a look at Agile, looks like it's something for me. Thanks :)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!