• Advertisement

# BenjaminSergent

Member

45

133 Neutral

• Rank
Member
1. ## Problems with Normal Mapping

Almost immediately after posting, I found a solution; however, I don't understand why I works.   I changed the line:   normalMap = normalMap * 2 - 1; // Normalize to [-1, 1] To normalMap.xy = normalMap.xy * 2 - 1; // Normalize to [-1, 1] So that the z value would stay in the range [0,1]. Now it looks like this:   If someone knows why that change worked and if it while cause problems later, I would be grateful for the insight.
2. ## Problems with Normal Mapping

Thank you for the replies.   Inverting the g channel first was definitely an issue. It led me to realising my light positions z-values were also too small, so I increased those and adjusted the falloff.   Now I have something much closer to my goal, but there is one more issue. Now I have a problem where only normals that are facing almost directly ahead seem to get lit:     I tried encircling one of the spots that isn't lighting, and it didn't change:     Then I tried moving the z- value of the light around and got a confusing result. If the z-value is very small (the background is effectively at z = 0), then some of the spots that were dark becomes lit to the up and right of the light while the normals facing the screen become darker in that area.     I'd be grateful for any ideas or suggestions.
3. ## Problems with Normal Mapping

Hello,   I'm trying to implement lighting with normal maps in my 2D prototype. I'm stuck on a strange issue where the lighting fades out below my lights. It looks like the dot product between the light direction and the normal must be negative below the light, but I can't get a grasp on why that's happening.   Here is an image of the problem:   No matter where I place the light(s), the area below each light stays dark. This is the code for my frag shader. I've simplified it to try and narrow the problem down: #version 130 in vec2 texCoords; in vec4 color; uniform float numPointLights; uniform sampler2D texture; uniform sampler2D textureN; uniform vec4 ambient; uniform vec4 pointLightInfo[100]; uniform vec2 resolution; void main() { vec4 diffuseColor = texture2D(texture, texCoords) * color; vec3 normalMap = texture2D(textureN, texCoords).rgb; normalMap.g = -normalMap.g; // Our normal map program produces an inverted y axis. normalMap = normalMap * 2 - 1; // Normalize to [-1, 1] vec2 screenPos = gl_FragCoord.xy; screenPos.x /= resolution.x; screenPos.y /= resolution.y; screenPos = screenPos * 2 - 1; // Convert to NDC vec3 finalColor = (ambient.rgb * ambient.a) * diffuseColor.rgb; for(int index = 0; index < numPointLights; index++) { vec4 lightScreenPos = pointLightInfo[2*index]; // Pre-transformed to NDC vec3 lightVector = vec3(lightScreenPos.xy - screenPos.xy, lightScreenPos.z); lightVector.x *= resolution.x / resolution.y; float lightDist = length(lightVector); vec3 normal = normalize(normalMap); vec3 lightDir = lightVector / lightDist; vec4 lightColor = pointLightInfo[2*index+1]; float normalIntensity = max(dot(normal, lightDir), 0.0); vec3 diffuse = (lightColor.rgb * lightColor.a) * normalIntensity; vec3 falloff = vec3(0.009,0.09,0.5); float attenuation = 1.0 / ( falloff.x + (falloff.y*lightDist) + (falloff.z*lightDist*lightDist) ); vec3 intensity = diffuse * attenuation; finalColor += diffuseColor.rgb * intensity; } gl_FragColor = vec4(finalColor, diffuseColor.a); } In case it's relevant, here is the level's normal map: I'm at a bit of a loss for how to proceed. I'm hoping I made a silly error that will be quickly obvious to someone. Thanks in advance for any help.
4. ## Direction Vector not working correctly

I think I understand your problem. Try normalizing the direction vector and multiplying it by the desired speed. [source lang="csharp"]Vector2 direction = target - position; direction.normalize( ); missleVelocity = missle_speed * direction[/source]
5. ## Can someone PLEASE test my game?

Edit: Opps, forgot to check the date.
6. ## Generating Large Maps Using Libnoise (Limits?)

I'm looking at the sample code's file "complexplanet.cpp". Here's some code around line 128 [source lang="cpp"] // Southernmost coordinate of elevation grid. const double SOUTH_COORD = -90; // Northernmost coordinate of elevation grid. const double NORTH_COORD = 90; // Westernmost coordinate of elevation grid. const double WEST_COORD = -180; // Easternmost coordinate of elevation grid. const double EAST_COORD = 180; // Width of elevation grid, in points. const int GRID_WIDTH = 4096; // Height of elevation grid, in points. const int GRID_HEIGHT = 2048;[/source] Then around line 1843 [source lang="cpp"] planet.SetBounds (SOUTH_COORD, NORTH_COORD, WEST_COORD, EAST_COORD); planet.SetDestSize (GRID_WIDTH, GRID_HEIGHT);[/source] Here is the 4096 by 2048 height map the site uses for the terrain sample pictures: [url="http://libnoise.sourceforge.net/examples/complexplanet/images/planet.jpg"]http://libnoise.sour...ages/planet.jpg[/url] So it's only about twice as large as what you found as your maximum, the sample just looks like it needs a much larger map because of the way Terragen renders it. Still, it seems you don't have as much memory as they expect people running the sample to have. Your main options are: 1. Find a way to make due with fewer points. 2. Get more memory. Note, this option will make the minumum system requirements for your game higher. 3. Make multiple smaller height maps and save them to disk, probably after compressing. Then, make your program try to anticipate which ones will be needed soon so it can decompress and load them before they need to be show.
7. ## BenjaminSergent

I have a website now: http://www.beyondbits.net/
8. ## Problem with Visual c++

Does this only happen in a certain project or does it happen with all new projects (like simple "hello world" programs) as well? Edit: Either way, check Tools->Options->Projects->VC++ Directories to see if everything is in order there. Having your directories set incorrectly can do this.
9. ## Features for an Island Survival Game

[quote]What would you want your character to be able to do? What kind of Items do you think should you be able to use/create?[/quote] Depends on if the game has a "real world" setting or if it can have monsters and such. Unreal beings would present a good additional sense of being exposed and defenseless. I'm imagining a game where you find things you weren't expecting and have to find ways to evade and run from them for the majority of the game, climbing up trees or getting in water if they can't swim. End-game items could give you a fighting chance. You can do this with normal animals too, but monsters add a lot more variety to the kind of experiences they offer. If you're going for a realistic cast-away experience, the game could focus on getting resources and experimenting to discover "recipes" for things. Probably a mix of an xp system and actually player experimentation. Rare materials that has to be gathered in an unusal way (eg: burning a substance off the ceiling of a cave) or that only exists in dangerous locations (eg: a flower that grows in the middle of steep cliffs) would give the player interesting goals and problems to solve. [quote]Would you like to see other intelligent life on the island, or do you want to be really alone?[/quote] I think it'd be most interesting if you felt alone for most of them game then discovered something intelligent late game, perhaps hidden in an area that's very hostile or something you meet if you follow a string of hints. [quote]What core stats would you like to manage? (Classic examples would be hunger & thirst)[/quote] Hunger, Thirst, and Stamina come to mind immediately. I think you should model health as a wound system rather than an hp system. eg: instead of "you took 5 damage", it'd be "You received a bruise on your head" or "you broke your left arm". Dealing with specific wounds give it a much stronger survival feeling than managing a health bar. You could also have skills (things like climbing, cooking, spear throwing, ect) to manage. If you wanted to try something rarely done, you could have to manage your character's mood and do things to make yourself happy (eat good tasting food, play instruments you crafted, go fishing, ect) to preform at your best. [quote]What do you NOT want to see in a game like this? Maybe you played a similar game and something about it really annoyed you.[/quote] I played an island survival game that had repetitive quests from the natives. If you do have quests, try to make them more unique and interesting than “Give us five banana because we're too lazy to go ourselves”. The game should give the player the opportunity to feel like you're slowly mastering the island, but make sure the player can never feel completely safe. They should be able to make parts of the island relatively safe, but if an area is 100% safe, it can alter the tone of the game in a negative way. Finally, make sure the player has some direction. Dropping them somewhere and saying “Have fun” usually won't work. If people want that, they'll probably go play Minecraft instead of your game. [quote]What kind of threats for the player do you think would be possible, apart from dying of thirst and hunger?[/quote] Dangerous creatures(either animals or monsters), illness/disease, dangerous weather, quicksand/quickmud, poisonous things, pissing off natives(if you choose to have them), active volcano, risk of down sharp drops (when exploring caves or gathering resources on a cliff), disturbing the ecosystem (eg: killings too many tigers increases the pig population which means pigs will be eating plants you might want), finding a safe place to sleep, drinking contaminated water, and the risk of wound infection come to mind. [quote]Any other suggestions for features you'd love to see?[/quote] If the island or some aspects were procedurally generated, that would do a lot to improve its longevity. Including roleplaying things that don't necessary relate to survival, like decorations for your shelter, would add a lot. If you aren't going fully realistic, I'd love to see something mythical and mysterious that you can unfold. Something strange and difficult to study that can be uncovered. That would fit perfectly with the isolated feeling of an island survival scenario.
10. ## XNA - Trapping the Mouse in Windowed Mode

Perfect, that does exactally what I want. For anyone who's curious: [code] //<Mouse handler class> [DllImport("user32.dll")] static extern bool ClipCursor(ref System.Drawing.Rectangle lpRect); //<In the relevant method> Mouse.SetPosition( gameWindow.ClientBounds.Width/2, gameWindow.ClientBounds.Height/2); System.Drawing.Rectangle window = new System.Drawing.Rectangle( gameWindow.ClientBounds.Left, gameWindow.ClientBounds.Top, gameWindow.ClientBounds.Right, gameWindow.ClientBounds.Bottom ); ClipCursor( ref window ); [/code] Obviously, this code only runs when the player is using the mouse for the camera. The mouse is unclipped with no position reseting in every other input state. Thanks for the help.
11. ## XNA - Trapping the Mouse in Windowed Mode

To imagine the camera controls, think of Minecraft, Skyrim or Counter-Strike. Those games all trap the mouse because they would be unplayable in windowed mode otherwise; in fact, such games can be unplayable full screen with dual monitors if they don't trap the mouse. The player would still be able to quickly switch out by tapping TAB, Alt-TAB or ESC (opening the menu, removing focus from the game window or pausing the game). blackbook: Unless I'm doing this wrong, changing the window handle doesn't seem to trap the mouse in that window.
12. ## XNA - Trapping the Mouse in Windowed Mode

I'm using XNA to make a game in which mouse movement controls the rotation of the camera. When running in windowed mode, I wanted to ensure that the cursor doesn't leave the screen if the game's not paused. I tried using Mouse.SetPosition, but the mouse still leaves the screen when moved quickly. This semi-frequently results in clicking off the screen, losing focus at undesirable times. What can I do to prevent this?
13. ## Controversial Policy Choices in Games

Thanks for your thoughts. The game is somewhat mature in tone; I don't think it would stick out as an unnecessary add-on. Prototypically putting in a social policy system and ensuring that other parts of the game don't rely on it until I've experimented is a good idea. The question of whether players who don't like it can ignore it somehow didn't occur to me. I think I might allow the player to abstain for making a stance and let the relevant citizens make personal decisions when the issues arise. Thanks again.
14. ## Controversial Policy Choices in Games

In games where you are the leader of an independent state (a civilization, city state, ect), do you think controversial policy issues should be avoided when possible? I'm asking because I was thinking about population control methods in the game I'm making and thought about the possibility of choosing to ban or promote birth control as a way the player could control growth. There are a number of other potential policy choices like this which would affect gameplay such as capital punishment policies and treatment of POWs; further, I'm already giving individual citizens enough personality to reasonably cause them to like or dislike your policies ( resistance to change, conscientiousness, ect ). The game's main focus is managing the expansion of a small young civilization, but not necessarily politics. That said, do you think those choices should be included in the game or would including such issues from the real world distract too much from the core content?
15. ## BenjaminSergent

• Advertisement