- Viewing Profile: Reputation: Postie
Community Stats
- Group Members
- Active Posts 241
- Profile Views 2,411
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
Postie hasn't added any contacts yet.
#4930110 direct x9 project
Posted by Postie
on 10 April 2012 - 10:40 PM
#4922915 recommended ways of storing game entities and state game structure
Posted by Postie
on 17 March 2012 - 05:06 PM
You can then get a bit more advanced with reference counts to deallocate textures that you haven't used in a while to manage your video memory a bit better.
#4922780 WHAAAATT!
Posted by Postie
on 17 March 2012 - 03:32 AM
The issue is that a 3x3 Matrix can represent rotation and scaling, but can't include translation. To do that we need to use a 4x4 matrix. But in order for that to work, our original 3x1 point needs to be expanded to 4x1, since you can't multiply a 3x1 vector by a 4x4 matrix. The new coordinate, w, controls if the translation part of the 4x4 matrix is added to the result, so under most circumstances you want it to have a value of 1.0. However, if you're transforming a vector instead of a point, you don't want the translation applied, since a vector is an offset from 0,0,0 and the translation will change the vector's direction and magnitude, so you can use the same transformation matrix as before, but set the w coordinate of the vector to be 0.
I think that ordinarily, Direct3D takes care of adding that w=1.0f term automatically when it expands from a float3 to a float4, so when you use input.Pos, the value would be correct.
I don't fully understand the thing myself, but my explanation makes sense to me. Doesn't mean it's correct though. Maybe someone more knowledgeable like MJP can chime in and correct me if I'm wrong?
#4922767 WHAAAATT!
Posted by Postie
on 17 March 2012 - 01:07 AM
Your position value is incorrect. It most likely should be float4(5.0f, 5.0f, 5.0f, 1.0f)
#4922727 recommended ways of storing game entities and state game structure
Posted by Postie
on 16 March 2012 - 07:45 PM
Oh, I should have probably been more specific about this but the keyHandler and mouseHandler classes just hold a hashmap of which keys were pressed (for the keyHandler) and which location on the screen was clicked (for the mouseHandler). They don't handle the events (the JPanel uses key bindings and a mouse listener to do this), more so just store what event was triggered. Every game state would need access to these since I have to be able to processEvents in each game state. Same with each component of the screen (inventory, etc).
Ah ok, that makes more sense.
One of the things I've learnt in the last 15 months working on my current project is that I only ever come up with the "right" design for something at first attempt about 1% of the time. Sometimes it's not bad but needs tweaks. Other times it's awful. My current game engine has evolved a lot as I've added new functionality and decided some part of the design was flawed. I've actually spent a fair bit of time rewriting existing code, but each iteration the system becomes better and more logical in my opinion. So I've learnt to not stress too much about having a perfect design from day one.
Generally speaking though, one of the metrics I use to tell if something isn't "right" in my code is that there are ALOT of interdependencies going on, ie many references to other classes that are passed through into other classes. There's not always an obvious elegant solution however. Sometimes you just have to live with it.
#4910807 How To Block(Cost)Cells Based on the Terrain ready for A* path finding.
Posted by Postie
on 08 February 2012 - 01:21 AM
In my current project I actually use the height difference, since the slope is deltaHeight/deltaX and deltaX is always 1 in my case. If it exceeds 1m, which corresponds to a 45 degree angle, I consider the cell to be inaccessible. Otherwise I multiply the current movement cost (calculated from factors such as the terrain underfoot) by 1 + deltaHeight. So at maximum it increases the movement cost of that tile by about 2x. That might not be realistic, but in testing its behaviour looks ok to me at the moment.
I should mention this is for creatures walking around. Slope affects vehicles much more severely I believe.
#4910757 Fast way to calculate 2D signed distance field
Posted by Postie
on 07 February 2012 - 09:29 PM
http://infoscience.e...ch/record/86623 (This link proposes a few corrections to Danielsson's technique)
http://citeseerx.ist...p=rep1&type=pdf (The "dead reckoning" signed distance transform)
I ended up implementing the transform outlined in the second paper, which is pretty quick, but has a few flaws.
#4910293 What is shining?
Posted by Postie
on 06 February 2012 - 03:19 PM
#4910082 A* speed issues (C++)
Posted by Postie
on 06 February 2012 - 02:41 AM
That said, you may not need to go to the extent of implementing a binary heap if you can reduce the number of members in the closed list. I had some speed issues in my first attempt at an A* implementation and refactored my code to make better use of the spatial partitioning my engine was already using and the performance was good enough without needing the complexity of a binary heap.
My game world is broken down into zones which are 32x32 tiles, so instead of storing tiles in the closed list, I stored Zones and a 1024bit array representing the traversal of each tile for the zone. To check the closed list I simply find the zone through a list scan then do some simple bit twiddling to find the tile itself, thus reducing the size of the closed list by a factor of between 100 to 1000.
Basically I was too lazy to learn how to implement a binary heap.
Another option is to do the pathfinding on a much coarser grid first, then pathfind between adjacent grids.
#4903405 Constructive Criticism
Posted by Postie
on 16 January 2012 - 04:38 PM
A few quick thoughts:
- On the face of it your entity class seems ok, but since your Weapons class inherits from Entity, you end up with weapons having properties like boughtFreedom and isAlive.
- Since the hero is the only one who'd be buying their freedom, it would make more sense as an external variable.
- The way you've implemented the different weapons is a little odd. You'd be better off creating a weapon class with the properties Identity/Name, Strength and Price, and then instantiating one of those for each of the 3 weapons you want to support. Then you'd assign the appropriate weapon to the entity.
#4903400 When planning to make a game, should I cover everything before actually start...
Posted by Postie
on 16 January 2012 - 04:19 PM
To sum up, unless you're writing something simple that's a clone of another game I would argue that you can't possibly think of everything before you start. I've read design documents for some of the big games that clearly took months to write, and though they do cover the vast majority of the final game's mechanics, there are always differences, where the original idea simply didn't work in practise.
#4902601 Name for MMORPG
Posted by Postie
on 14 January 2012 - 02:31 AM
#4876998 [SlimDX - DX9] device.Reset returns error code
Posted by Postie
on 25 October 2011 - 07:25 PM
Try commenting out the creation of resources until the problem goes away, and then you've found the culprit.
#4870901 Precalculating values and storing them in variables, efficient?
Posted by Postie
on 09 October 2011 - 05:27 PM
In addition, Math.Sqrt(2*Math.PI) is a constant value, so you could get rid of the expensive square root by pre-calculating that somewhere else and passing in the value.
To address the issue of whether to have the calculation be done on the GPU or CPU, in general the GPU is going to have much faster, since its heavily optimised for crunching numbers, but it will depend on how utilised your CPU is. If you GPU is already grinding away on other shaders, but the CPU is mostly idle, it may be better to have the CPU do it instead.
The only way to know for sure is to try both approaches and see if there's a difference in frame rate. In short, benchmark!
#4863239 Books for SlimDX
Posted by Postie
on 18 September 2011 - 11:30 PM
I'm actually using directx 9 and shaders, so I bought a book on that topic, and despite all the code examples being written in c++, its very easy to translate directly to SlimDX.
- Home
- » Viewing Profile: Reputation: Postie

Find content