• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

DemonLord

Members
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

344 Neutral

About DemonLord

  • Rank
    Member
  1. I have a question about BlendState. Is it possible to make sprites outside of my spot light blend into dark ambient light with BlendState? [img]http://shrani.si/f/2g/xo/1uGIilZy/alpha.png[/img] I kinda made sprites in my spot light translucent and those far away normal but I don't really know if I can make them blend with the ambient light [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] This is what I use to make the effect on the screenschot: [CODE] private Color _ambientLight = new Color(.1f, .1f, .1f, .1f); // for HLSL public static BlendState BlendBlack = new BlendState { ColorBlendFunction = BlendFunction.Add, ColorSourceBlend = Blend.One, ColorDestinationBlend = Blend.One, AlphaBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; [/CODE] Any help or tip would be helpful. Thanx
  2. Hi. I want to make all sprites that are not in my spot light to be hardly visible. Only when I come near enough to light them up with my spot light should they be fully visible. This is how it looks: [media]http://www.youtube.com/watch?v=1IRtth-Ro2M[/media] Question is: How do I make sprites less visible when not in my spot light? Thanx for help.
  3. Hi. I have a problem with adding lights to my game (XNA 4.0). I've made an underwater effect (slight waving of the screen) but I can't get a spot light atop of my submarine to work. My goal is to attach a spot light in front of my submarine and darken the surroundings, to get more deep ocean feeling. I suspect I'm doing something wrong with RenderTarget2D, but don't know what (I'm not 100% sure how RenderTarget2D works) [media]http://www.youtube.com/watch?v=eixfVRMScq4[/media] Here's my Draw method and some other lights methods: [CODE] public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(Color.Transparent); // Set the render targets ScreenManager.GraphicsDevice.SetRenderTarget(colorMapRenderTarget); // Clear all render targets ScreenManager.GraphicsDevice.Clear(Color.Transparent); ScreenManager.GraphicsDevice.SetRenderTarget(null); ScreenManager.GraphicsDevice.SetRenderTarget(normalMapRenderTarget); // Clear all render targets ScreenManager.GraphicsDevice.Clear(Color.Transparent); DrawNormalMap(); // Deactive the rander targets to resolve them ScreenManager.GraphicsDevice.SetRenderTarget(null); GenerateShadowMap(); ScreenManager.GraphicsDevice.Clear(Color.Transparent); // Finally draw the combined Maps onto the screen DrawCombinedMaps(); /* Clear the screen */ ScreenManager.GraphicsDevice.SetRenderTarget(renderTarget); ScreenManager.GraphicsDevice.Clear(Color.Transparent); //Draw background DrawColorMap(); /********************* * Drawing all nodes * *********************/ //Drawing players spriteBatch.Begin(); foreach (Node node in Node.Nodes) node.Draw(spriteBatch); for (int i = 0; i < Player.Players.Length; i++) { PlayerShip ship = Player.Players[0].Ship; string text; if (ship != null) text = String.Format("Shield power: {1}", 0 + 1, ship.Health); else text = String.Format("P{0} <>", i + 1); spriteBatch.DrawString(font, text, new Vector2(10, 0 * 20 + 10), Color.White); } spriteBatch.End(); /* end drawing nodes */ /********************* * PostProcess.fx * * HLSL water effect * *********************/ ScreenManager.GraphicsDevice.SetRenderTarget(null); SceneTexture = renderTarget; ScreenManager.GraphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque); { effectPost.CurrentTechnique.Passes[0].Apply(); { effectPost.Parameters["fTimer"].SetValue(m_Timer); spriteBatch.Draw(SceneTexture, new Rectangle(0, 0, gfx.PreferredBackBufferWidth, gfx.PreferredBackBufferHeight), Color.White); } } spriteBatch.End(); /* end HLSL water effect */ // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } } #region Light Methods /***************************** * Combined Maps Draw method * *****************************/ private void DrawCombinedMaps() { lightCombinedEffect.CurrentTechnique = lightCombinedEffectTechnique; lightCombinedEffectParamAmbient.SetValue(1f); lightCombinedEffectParamLightAmbient.SetValue(4); lightCombinedEffectParamAmbientColor.SetValue(ambientLight.ToVector4()); lightCombinedEffectParamColorMap.SetValue(colorMapRenderTarget); lightCombinedEffectParamShadowMap.SetValue(shadowMapRenderTarget); lightCombinedEffectParamNormalMap.SetValue(normalMapRenderTarget); lightCombinedEffect.CurrentTechnique.Passes[0].Apply(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, lightCombinedEffect); spriteBatch.Draw(colorMapRenderTarget, Vector2.Zero, Color.White); spriteBatch.End(); } /* end Combined Maps Draw method */ /*************************** * Normals Map Draw method * ***************************/ private void DrawNormalMap() { spriteBatch.Begin(); spriteBatch.Draw(bgNormals, Vector2.Zero, Color.White); spriteBatch.End(); } /* end Normals Map Draw method */ /********************************************** * Color Map Draw method - regular background * **********************************************/ private void DrawColorMap() { spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); spriteBatch.Draw(bg, Vector2.Zero, new Rectangle(0, (int)(-scrollY), bg.Width, bg.Height), Color.White); spriteBatch.End(); } /* end Color Map Draw method */ /******************************** * Shadow Map Generation method * ********************************/ private Texture2D GenerateShadowMap() { ScreenManager.GraphicsDevice.SetRenderTarget(shadowMapRenderTarget); ScreenManager.GraphicsDevice.Clear(Color.Transparent); foreach (var light in lights) { if (!light.IsEnabled) continue; // Draw all the light sources lightEffectParameterStrength.SetValue(light.ActualPower); lightEffectParameterPosition.SetValue(light.Position); lightEffectParameterLightColor.SetValue(light.Color); lightEffectParameterLightDecay.SetValue(light.LightDecay); // Value between 0.00 and 2.00 lightEffect.Parameters["specularStrength"].SetValue(specularStrength); if (light.LightType == LightType.Point) { lightEffect.CurrentTechnique = lightEffectTechniquePointLight; } else { lightEffect.CurrentTechnique = lightEffectTechniqueSpotLight; lightEffectParameterConeAngle.SetValue(((SpotLight)light).SpotAngle); lightEffectParameterConeDecay.SetValue(((SpotLight)light).SpotDecayExponent); lightEffectParameterConeDirection.SetValue(((SpotLight)light).Direction); } lightEffectParameterScreenWidth.SetValue(ScreenManager.GraphicsDevice.Viewport.Width); lightEffectParameterScreenHeight.SetValue(ScreenManager.GraphicsDevice.Viewport.Height); lightEffect.Parameters["ambientColor"].SetValue(ambientLight.ToVector4()); lightEffectParameterNormapMap.SetValue(normalMapRenderTarget); lightEffect.Parameters["ColorMap"].SetValue(colorMapRenderTarget); lightEffect.CurrentTechnique.Passes[0].Apply(); // Add Belding (Black background) ScreenManager.GraphicsDevice.BlendState = BlendBlack; } // Deactive the rander targets to resolve them ScreenManager.GraphicsDevice.SetRenderTarget(null); return shadowMapRenderTarget; } /* end Shadow Map Generation method */ public static BlendState BlendBlack = new BlendState() { ColorBlendFunction = BlendFunction.Add, ColorSourceBlend = Blend.One, ColorDestinationBlend = Blend.One, AlphaBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; #endregion [/CODE] Am I missing something or am I doing this completely wrong? I'd be thankful if anyone could point me in the right direction. Thanx.
  4. I'm making a top-down shoot'em up / bullet hell game in XNA. The game doesn't have a name yet, but I have a story line and plans to make a trilogy. Base engine is near completion, but I'm still experimenting some things that I want to include in the game. I've made some clips: [media]http://www.youtube.com/watch?v=BcY2kADexfU[/media] [media]http://www.youtube.com/watch?v=Rn9DIL8Q1Mc[/media] [media]http://www.youtube.com/watch?v=J6DBv4psyGk[/media] It's still far from complete, but I think it might be finished by the end of the year. The game will have around 30 levels per difficulty, upgradable weapons (buying and upgrading weapons between levels), ship will have a shield which will be slowly repaired by a repairbot, but if too much damage is taken and shield is gone - one hit = death. If you find this interesting, check my youtube channel for new clips: [url="http://www.youtube.com/user/Demonsaso"]http://www.youtube.com/user/Demonsaso[/url]
  5. I'll use this topic for my new problem considering 3D model movement. Problem is when I move my model from center of the screen to the left (or right), model rolls nicely as I want it to, but when I reach the left side of the screen and start to move back towards the center, model moves right AND up towards the camera, what I don't want. [media]http://www.youtube.com/watch?v=2PhVdkTD6wc[/media] I don't know how to fix this. It seem as if the pivot point was somewhere below the model, but I imported the model into Maya and set pivot to center and export to FBX. (did I forgot something?) Here's the code for movement: [code] protected void UpdateInput(GameTime gameTime) { KeyboardState newState = Keyboard.GetState(); if (newState.IsKeyDown(Keys.Escape)) this.Exit(); float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds; float moveX = 0.0f; float moveZ = 0.0f; if (newState.IsKeyDown(Keys.W)) moveX += modelSpeed * time; if (newState.IsKeyDown(Keys.S)) moveX -= modelSpeed * time; if (newState.IsKeyDown(Keys.A)) { moveZ -= modelSpeed * time; modelRotation -= 0.01f; if (modelRotation < -0.5f) modelRotation = -0.5f; } if (newState.IsKeyDown(Keys.D)) { moveZ += modelSpeed * time; modelRotation += 0.01f; if (modelRotation > 0.5f) modelRotation = 0.5f; } oldState = newState; modelPosition += new Vector3(moveX, 0, moveZ); } [/code] If anyone knows what might be the problem, please do tell.
  6. Thanx a million! Man, I'm blind :[
  7. Hi. I have a problem moving 3D model, when I press two keys at the same time. Let's say I want to move my model from center of the screen (camera isn't moving) diagonaly to upper left corner. Even tho I press two keys, the model will move in the direction of the key pressed first or if I press A key after already holding down W key, the model will continue to travel upwards. Any ideas on how should I fix this? protected void UpdateInput(GameTime gameTime) { KeyboardState currentKeyState = Keyboard.GetState(); float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds; float moveX = 0.0f; float moveZ = 0.0f; if (currentKeyState.IsKeyDown(Keys.W)) moveX += 0.1f* time; else if (currentKeyState.IsKeyDown(Keys.S)) moveX -= 0.1f * time; else if (currentKeyState.IsKeyDown(Keys.A)) moveZ -= 0.1f * time; else if (currentKeyState.IsKeyDown(Keys.D)) moveZ += 0.1f * time; modelPosition += new Vector3(moveX, 0, moveZ); } protected override void Update(GameTime gameTime) { KeyboardState keyboardState = Keyboard.GetState(PlayerIndex.One); if (keyboardState.IsKeyDown(Keys.Escape)) this.Exit(); UpdateInput(gameTime); modelPosition += modelVelocity; modelVelocity *= 0.95f; base.Update(gameTime); } Thanx.
  8. Thanx for your help & tips guys.
  9. I want to make an underwater environment using XNA. If anyone would be so kind to point me in the right direction as how to begin to make water caustics. I made terrain using heightmap, refraction + reflection plane with HLSL and above water looks nice (Reimer's XNA tutorials). But now I'd like to make underwater look something like the picture below, but I don't know how. I think I need something like this, but I don't know where and how to use it: but don't know if it must be just a texture or must it be animated. So, if anyone can point me to a good theory web page or even better, a tutorial on how to make water caustics, it would be great. Thnax
  10. I'm learning C# + XNA for several months now and it's fairly easy to learn (and thanx goes to Andrew Russell for morale boosting on C# + XNA :) ). What I'd like to know is, what can be done in C++ more that in C# - I saw many times people refering to C++ as the mother of game dev - I'm interested in 2D games only (for now). [Edited by - DemonLord on April 6, 2010 6:42:23 AM]