Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 28 Nov 2010
Offline Last Active Yesterday, 05:06 PM

#5149852 Random map with prebuild pieces

Posted by Postie on 27 April 2014 - 07:40 AM

One approach I've seen is to first generate the rooms without any doors or corridors between them. Then you go through a second pass adding doors to each room to connect them all to each other. Larger rooms could be allowed more doors, and you could easily verify how many dead ends you have by looking at rooms with only one connecting door.


I can't find the link right now, but I recall seeing a presentation on Path of Exile's random dungeon generation, where they place a Start room, an end Room and then a room in the very middle of the map. Then they randomly add rooms and doors using a similar technique I mentioned above, but ensuring that there's a path from the start room to the middle room, and then the middle room to the end room. This ensures the overall network of rooms is linear, which is better for guiding the player.


Another interesting technique is described here: http://www.reddit.com/r/gamedev/comments/1dlwc4/procedural_dungeon_generation_algorithm_explained/

That might be more complex than you're after, but it could give you some ideas. 

#5148106 How to stop users from manipulating Game Save Data

Posted by Postie on 19 April 2014 - 05:54 AM

For a non-online game It is impossible to prevent a dedicated, intelligent individual from altering your game files.


You can discourage a high proportion of players by making it difficult to do so. However, the dedicated and intelligent will figure out what you did and circumvent it. Guaranteed.


Its a matter of diminishing returns. Do nothing, and anyone that is curious can look in the game folder and make whatever changes they feel like. Hiding the files or obfuscating them in some way will eliminate some of those but not all. Its an unwinnable battle. The question you have to ask yourself is how much time are you willing to spend on it, and could I instead invest that time in making the game better?


With that in mind, something simple like computing an MD5 hash of the file and storing it in code somewhere will take care of the majority of users. But, I'd advise against it.


The game project I'm currently working on is likely going to ship with all of its game data files as plain text with non obfuscated key/value pairs. Why? Two reasons:

  1. The game isn't directly competitive, so "cheating" doesn't affect anyone else. 
  2. I want to encourage people to make (and share) interesting mods I wouldn't have thought of myself. 

#5147751 Component Entity and Data-Orientated Design

Posted by Postie on 17 April 2014 - 04:35 PM

Some interesting viewpoints in this post. I am at the tail end of converting my entire project from traditional OO-inheritance to component-entity, and my primary reason for doing so has nothing to do with speed or performance. I ran afoul of the diamond problem and the codebase was getting ridiculously complicated. Special cases hardcoded everywhere to handle unrelated entities having similar properties... yuck


If well implemented, CE systems can be slightly faster, yes. But certainly for me, better code organisation and partitioning of data was *the* reason for the switch.

#5120378 Why XML is all the rage now?

Posted by Postie on 31 December 2013 - 04:45 PM

I consider XML to be in the same category as COLLADA. ie, designed to reliably convey data between different systems, and nothing else.

  • They are both text-based and inefficient at storing data when compared to binary formats.
  • They can have complex structures that lead to slow parsing especially on larger files.
  • Despite what people say (and the original design intention), XML is absolutely not human readable.

The only difference I see is that people realised what COLLADA was intended for and treated it accordingly, whereas XML was (and still is) abused.


I've worked on a project where the original authors thought it would be a good idea to create an entire XML document on the fly using string concatentation, pass it to a stored procedure and query it as a table to pull out a few parameters.


Guess what brought down the entire system?... "&".


Granted, that's not XML's fault, but still...

#5115017 Bullet physics undefined behavior with a dummy simulation

Posted by Postie on 06 December 2013 - 08:34 PM

Isn't it generally considered a bad idea to explicitly set an objects velocity in a physics engine? I've always read that you should apply an appropriate force instead.

#5106163 Dividing by zero, on purpose

Posted by Postie on 31 October 2013 - 11:25 PM

If I'm about to head home for the day and I'm working on a piece of code that is incomplete but compilable, I'll type some garbage like: "dgsahjgda". That way when I come back to it in the morning If I forget where I was up to, it'll take me straight to the garbage when I try to compile. 


I'll do the same if I'm doing some manual refactoring involving a lot of copy and pasting.

#5068407 Models are missing half their triangles.

Posted by Postie on 09 June 2013 - 07:32 AM

The OBJ format is deceptive. It's pretty quick to write a parser for it, but it has plenty of gotchas, such as only being suitable for static meshes, since it has no support for bones or keyframes. Nor can it store what the X, Y and Z axes actually correspond to it, it's purely up to the exporting application, and a major headache if you're sourcing models from artists that use different 3d modellers.


I started with .OBJ, but more recently switched to a combination of COLLADA (exported from blender) and a custom binary format of my own making (created from the COLLADA file at build time), and I don't regret it for a second.

#5046083 Why is my Rotation not centered?

Posted by Postie on 23 March 2013 - 05:11 PM

Unless there's some matrix multiplication order difference between OpenGL and DirectX I'm not aware of, the construction of your MVP matrix seems backwards. Shouldn't it be mModel * mView * mProjection?


Similarly, to construct your mModel matrix, I believe the order of transforms should be (SRT) Scaling, Rotation, Translation. 

#5043550 Am I a bad programmer?

Posted by Postie on 15 March 2013 - 06:05 PM

A bad programmer is unwilling to learn and develop their craft. An inexperienced programmer is new to the craft. These are not the same.


I disagree with the mentality that you should be an expert in your field before offering advice or tutorials. Sharing information, (even small snippets) to help others get started is a key way of distributing knowledge in communities. Though, if you're going to offer advice, its your responsibility to amend that information if you discover it is wrong or "not the done thing".


Trying to teach other people what you know (especially through some sort of peer-reviewed process), is the surest way of finding out what you *really* know about a topic, as opposed to what you *think* you know.


I cannot fault the OP's attempts to pass information on. Even experts get started by reading someone else's tutorials.

#5033665 What exactly is paid for when making games?

Posted by Postie on 18 February 2013 - 02:08 AM

Remember that games studios are still businesses at the end of the day, and unless you're in some ridiculous high rent location and have token staff, the biggest cost by a long margin is going to be people's salaries.

#5026210 Different Ore types

Posted by Postie on 27 January 2013 - 05:02 PM

Take a look at the middle section of the periodic table of elements. You'll find metals like Iron, Cobalt, Nickel, Tungsten, Mercury, as well as radioactive ones like Uranium, Plutonium...


Also, don't neglect your alloys. You don't dig them out of the ground as ore, but they can exist as ingots. Bronze and steel were already mentioned, but there's a lot more out there.


#5026062 Getting Intersected Triangle

Posted by Postie on 27 January 2013 - 09:02 AM

You've called the 3rd parameter passed to D3DXIntersect, "rayTo", which worries me slightly. The 3rd parameter is actually the direction of the ray, which is a vector, not a point in space. If rayTo is actually a point, you'll need to pass in (rayTo - rayFrom).


Also, you shouldn't need to scan through the faces after the initial test, the output value in pFaceIndex should contain the index of the face hit, if D3DXIntersect returns a hit.

#5018404 drawing triangle using dx9

Posted by Postie on 06 January 2013 - 08:25 PM

Nice code, but did you have a question? :)

#5007239 Best practises for writing shaders

Posted by Postie on 04 December 2012 - 06:22 PM

Hey guys,

So I'm a few years into my part-time game project and have been learning HLSL and DirectX as I go. I'm pretty confident in my ability to write HLSL shaders to do pretty much everything I need currently but have a question about the general architecture of shaders and how they should fit together.

For example, I have a terrain shader that handles some funky texture, tile-based lighting stuff and shadow mapping as well as some special effects, like highlighting an individual tile or drawing some special construction lines.

I also have an entity shader that I use for all the objects in my game and can also do Blinn-Phong shading.

I also have many other specific use shaders, such as a water shader, a fire shader.. etc etc...

I've realised that I now want to add the shadow mapping code to the entity shader, as I originally only implemented it in the terrain shader. But then it occurred to me that I'll probably want that feature in some of the other shaders down the track.

So my first question is, should I be implementing a given feature (eg shadow mapping) multiple times for every shader that needs it, or should I be trying to create a "it-does-everything" shader? And as a follow up, could I be writing my shaders to be more modular? I'm currently not using the ability to have multiple techniques or passes as I don't follow how they should be used.

#5001032 Trouble texture mapping from font images (SlimDX, DX11)

Posted by Postie on 14 November 2012 - 04:44 PM

Yeah, the after transformation positions aren't right at all. I'm not sure how multiplying by the orthogonal matrix to get the texels has worked for you in the past. I recommend using the technique described by Auskennfuchs. Just be aware that if in future you use a non-square texture, you'll have to use width and height as divisors, not size.