• 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.

plusnoir

Members
  • Content count

    25
  • Joined

  • Last visited

Community Reputation

106 Neutral

About plusnoir

  • Rank
    Member
  1. Hi there first I want to tell you about my situation.   Since I have been into game developement I used XNA. I know it is a little late but I recently realized that Microsoft stops further XNA developement. After I read that I decided that the best choice  would be to switch to openGL since it is crossplatform and would give me the opportunity to learn more C++.   Now that I started I had to realize what an overhead this whole new OpenGL thing implicates. Now I am wondering, how dead is XNA? I mean I can still use it in windows 7 (windows 8?). And as far as I know Steam Greenlight still accepts XNA projects. At the end of the day XNA has everything I ever needed.   So is it ok to continue with XNA or is it about time to switch frameworks?   Greets, plusnoir
  2. I guess, I am the champion in asking stupid questions [img]http://public.gamedev.net//public/style_emoticons/default/dry.png[/img]
  3. [color=#4A4A4A]Hi folks,[/color] [color=#4A4A4A] I'm not really new to programming or XNA but I still find it hard to completely understand the [url="http://create.msdn.com/en-US/education/catalog/sample/winforms_series_2"][b]"WinForms Series 2: Content Loading"[/b][/url].[/color] [color=#4A4A4A] As I get it, the MainForm.LoadModel(); Unloads the current model and loads the user specified model. So according to this There is always only one model on screen.[/color] [color=#4A4A4A] 1. My first question is, what if I want to draw several models? I guess I simply wouldn't call the Unload-method?[/color] [color=#4A4A4A] 2. The second and most important of my questions is, what to do if I want to load the same Model several times? [b]Let's say, three spaceships at a time? How would I tell the ContentBuilder that every time I pick a Model in the FileDialog he should create a completely new Model?[/b][/color] [color=#4A4A4A] F.e.: I already tried to Load several models of the same kind by putting them into Lists. But the Problem was I somehow always had only references to my First loaded model. So basically they all were the same. And changing one of them automatically changed the referenced models. [/color] [color=#4A4A4A] I hope you guys get my problem.[/color][color=#4A4A4A] I am pretty certain that is a noob question. Still I would be thankful for any advice.[/color] [color=#4A4A4A] Thanks in advance.[/color]
  4. Figured out, the offset is caused by the viewport being drawn into a PictureBox in a WinForm. Still don't know how to fix it.
  5. [color=#333333]I'm trying to implement Object picking. My BasicModel.cs has a function:[/color] [color="#333333"][CODE] public bool CheckRayIntersection(Ray ray) { //Where aabb is the BasicModel's BoundingBox if (ray.Intersects(aabb) != null) { return true; } else {[/color] [color="#333333"] return false; } } [/CODE][/color] [color=#333333]I create the Ray in my Camera.cs:[/color] [color=#333333][code]public Ray GetMouseRay(Vector2 mousePosition, Viewport viewport) { Vector3 near = new Vector3(mousePosition, 0); Vector3 far = new Vector3(mousePosition, 1);[/color] [color=#333333] near = viewport.Unproject(near, projection, view, Matrix.Identity); far = viewport.Unproject(far, projection, view, Matrix.Identity);[/color] [color=#333333] return new Ray(near, Vector3.Normalize(far - near)); }[/code][/color] [color=#333333]And finally in game1.cs I check for Intersection in every BasicModel and write "Intersects" to Console:[/color] [color=#333333][code]foreach(BasicModel model in assetManager._modelsOnscreen) { if(model.CheckRayIntersection(camera.GetMouseRay(mouseLocation,viewport))) { winForm.ConsoleWrite = "intersects"; } }[/code][/color] [color=#333333]Somehow it always returns true for intersection with offset (to the right) to the actual Boundingbox. I also don't have any clue how I could visualize the problem or step through it. Actually the Boundingbox is drawn correctly as seen [url="http://img19.imageshack.us/img19/9926/basica.png"]here[/url], so I don't think that aabb causes the problem.[/color] [color=#333333][size=4]Any advice is welcome,[/size][/color] [color=#333333][size=4]noir[/size][/color]
  6. Thanks a lot Tsus thats what I wanted to know. The problem is, the basic hlsl-tutorials always deal with the basic effect or a single effect at once. Now the BB and the model are drawn with correct shaders on them. The Lightsource still screws up it seems to somehow change position when I strafe around my object. As seen [url="http://www.youtube.com/watch?v=_ltrsVsH_qw&feature=youtu.be"]here[/url]. But I guess I somehow messed up the shader code ;) Thanks for taking the time and writing almost a tutorial
  7. Hey thanks for the response. I'm still learning, so could you tell me how I would declare and bind the vertices?
  8. I'm not really sure why nobody can help me with that problem. Is it a stupid or a hard question? Well after one week of messing around with that problem managed to finaly draw the bounding-boxes. The shader issue persists though. I will try to describe it more precise this time. Here is my BasicModel.cs. It is a little messy but the functionality should be clear. It is responsible for drawing the Model and the corresponding bounding-box. It contains a method called DrawModel. Here I have two possibilities implemented, drawing the model with basic effect and drawing it with a diffuse light (taken from [url="http://digitalerr0r.wordpress.com/2009/03/23/xna-shader-programming-tutorial-2-diffuse-light/"]here[/url]). I also have a method DebugDraw which uses a basic effect in order to draw the bounding box. (really sorry for posting the entire class, it is a mess I admit) [CODE] namespace XNA3Editor { public class BasicModel : DrawableGameComponent { public Model model { get; protected set; } public String name { get; set; } public String id { get; set; } public float yawAngle { get; set; } public float pitchAngle { get; set; } public float rollAngle { get; set; } Matrix rotation = Matrix.Identity; Vector3 vRotation = Vector3.Zero; Matrix translation = Matrix.Identity; Vector3 position = Vector3.Zero; Vector3 direction = new Vector3(0, 0, 0); private BasicEffect renderer; private Effect effect; private BoundingBox aabb { get; set; } //axis-aligned boundin box private Camera camera; private short[] indexData; //The index array used to render the AABB private VertexPositionColor[] aabbVertices; //The AABB vertex array used for rendering protected Matrix world = Matrix.Identity; public BasicModel(Game game,Model m, String name) : base(game) { model = m; this.name = name; // Vertex declaration for rendering our 3D model. Game.GraphicsDevice.VertexDeclaration = new VertexDeclaration(Game.GraphicsDevice, VertexPositionNormalTexture.VertexElements); camera = ((Editor)game).camera; } private void CreateAABB(Model model) { aabb = new BoundingBox(); foreach(ModelMesh mesh in model.Meshes) { //Create an array to store the vertex data. VertexPositionNormalTexture[] modelVertices = new VertexPositionNormalTexture[mesh.VertexBuffer.SizeInBytes / VertexPositionNormalTexture.SizeInBytes]; //Get the models vertices mesh.VertexBuffer.GetData<VertexPositionNormalTexture>(modelVertices); //Create a new array to store the position of each vertex Vector3[] vertices = new Vector3[modelVertices.Length]; //Loop throught the vertices for (int i = 0; i < vertices.Length;i++) { //Get the position of the vertex. vertices[i] = modelVertices[i].Position; } //Create a AABB from the model's vertices. aabb = BoundingBox.CreateMerged(aabb, BoundingBox.CreateFromPoints(vertices)); } } protected override void LoadContent() { effect = Game.Content.Load<Effect>("Effects/Diffuse"); //Create the bounding box from the model's vertices CreateAABB(model); base.LoadContent(); } public virtual void Update() { // Rotate model rotation *= Matrix.CreateFromYawPitchRoll(yawAngle, pitchAngle, rollAngle); } public override void Draw(GameTime gameTime) { //Create a new vertex declaration Game.GraphicsDevice.VertexDeclaration = new VertexDeclaration(Game.GraphicsDevice, VertexPositionColor.VertexElements); //Draw bounding box. DebugDraw(aabb,Color.White); //Draw model. DrawModel(model); base.Draw(gameTime); } private void DrawModel(Model model) { #region draw model with diffuse effect Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); // worldMatrix = Matrix.CreateWorld(position, rotationMatrix.Forward, rotationMatrix.Up); // Use the DiffuseLight technique from Shader.fx. You can have multiple techniques in a effect file. If you don't specify // what technique you want to use, it will choose the first one by default. effect.CurrentTechnique = effect.Techniques["DiffuseLight"]; // Begin our effect effect.Begin(); // A shader can have multiple passes, be sure to loop trough each of them. foreach (EffectPass pass in effect.CurrentTechnique.Passes) { // Begin current pass pass.Begin(); foreach (ModelMesh mesh in model.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { // calculate our worldMatrix.. //world = GetWorld() * mesh.ParentBone.Transform; world = Matrix.CreateWorld(position, rotation.Forward, rotation.Up); // .. and pass it into our shader. // To access a parameter defined in our shader file ( Shader.fx ), use effectObject.Parameters["variableName"] Matrix worldInverse = Matrix.Invert(world); Vector4 vLightDirection = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); effect.Parameters["matWorldViewProj"].SetValue(world * camera.view * camera.projection); effect.Parameters["matInverseWorld"].SetValue(worldInverse); effect.Parameters["vLightDirection"].SetValue(vLightDirection); // Render our meshpart Game.GraphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, part.StreamOffset, part.VertexStride); Game.GraphicsDevice.Indices = mesh.IndexBuffer; Game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, part.BaseVertex, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount); } } // Stop current pass pass.End(); } // Stop using this effect effect.End(); #endregion /* #region draw model using basic effect //Create a rotation matrix from GameModel's rotation. Matrix rotatioMatrix = Matrix.CreateFromYawPitchRoll( vRotation.X, vRotation.Y, vRotation.Z); //Create the world matrix from the GameModel's position and rotation. world = Matrix.CreateWorld(position,rotation.Forward, rotation.Up); foreach(ModelMesh mesh in model.Meshes) { foreach(BasicEffect Beffect in mesh.Effects) { //Set effect lightning. Beffect.EnableDefaultLighting(); Beffect.PreferPerPixelLighting = true; //Set effect matrices. Beffect.World = world; Beffect.View = camera.view; Beffect.Projection = camera.projection; } mesh.Draw(); } #endregion */ } public Matrix GetWorld() { return world;//* Matrix.CreateTranslation(position) } private void SetupRenderer() { //Create a new Basiceffect instance. renderer = new BasicEffect(Game.GraphicsDevice,null); //This lets you color the the AABB renderer.VertexColorEnabled = true; //Set renderer matrix. renderer.World = world; renderer.View = camera.view; renderer.Projection = camera.projection; } private void DebugDraw(BoundingBox aabb, Color color) { //Setup the debug renderer. SetupRenderer(); //Create an array to store the AABB's vertices. aabbVertices = new VertexPositionColor[8]; //Get an array of points that make up the corners of the AABB. Vector3[] corners = aabb.GetCorners(); //Fill the AABB vertex array. for (int i = 0; i < 8; i++ ) { aabbVertices[i].Position = corners[i]; aabbVertices[i].Color = color; } //Create the index array. indexData = new short[] { 0,1, 1,2, 2,3, 3,0, 0,4, 1,5, 2,6, 3,7, 4,5, 5,6, 6,7, 7,4, }; //Start drawing the AABB. renderer.Begin(); //Loop through each effect pass. foreach(EffectPass pass in renderer.CurrentTechnique.Passes) { //Start pass. pass.Begin(); //Draw AABB. Game.GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor> (PrimitiveType.LineList,aabbVertices,0,8,indexData,0,12); //End pass. pass.End(); } //End rendering. renderer.End(); } public Vector3 _position { get { return this.position; } set { world = Matrix.Identity; world *= Matrix.CreateTranslation(this.position = value); } } public Model _model { get { return model; } } } } [/CODE] Now my problem is, if I draw the model using basic effect, everything looks fine. The bounding box and the Model are drwan as expected. But if I try to apply the diffuse effect to the model, it is drawn wrong. Like there is no shader on it it just looks flat. Now the thing is in the Draw Method I have a vertex declaration. If I comment that out and remove the bounding box he actually draws the model with diffuse light on it. But it still looks wrong. I have no idea what is going wrong there! Maybe the vertex declaration somehow screws up between the basic effect for the BB and the diffuse effect on the model? Help would be great, Thanks.
  9. Thank you for taking the time and awnsering my questions. Actually my plan was to load a animated character. He will be visible from a top-down iso-perspective mostly. But he also will appear in some close up views where you can actually see his face.
  10. [color=#333333][size=4]I am working on a 3D mapeditor right now. Until yet I was working with some primitives (dummies) in order to check the functionality of my Editor. Now I have reached a point where The Editor is ready to be filled with actual content. f.e. Character and environment assets. As I am a one-man-army right now I have to do it by myself. There are some issues I don't have any clue about:[/size][/color] [list] [*]I guess assets should be as low-poly as possible. So when is a Mesh/Model considered low-poly? Or do I just have to adjust the Models to the performance of my Editor? [/list][list] [*] What other Information should be saved to the Models while it still is in the modeling software (3Ds-Max, in my case)? Materials, Light...? [/list][list] [*]How to choose the right scale for the Models? What is a reasonable size for models which are later loaded into xna? [/list] [color=#333333][size=4]Those are the questions I can think of. But if there should be something else that is important please don't hesitate to tell me.[/size][/color] [color=#333333][size=4]Thanks in advance,[/size][/color] [color=#333333][size=4]plusnoir[/size][/color]
  11. [color=#333333]Another issue that could be of interest is, that I also tried to draw some Spritefonts on the gamescreen. It had the same effect. Shaders were not applied to the meshes. [/color] [color=#333333]Is it possible that it somehow has to do with the order in which Shaders/Meshes, Sprotefonts, Colored vetices...are drawn? I mean, I use the BasicEffect in order to draw the BoundingBox (Vertices) and the Meshes are also being drawn with the BasicEffect applied, although they should be drawn with my Diffuse Shader.[/color] [color=#333333]I sence some kind of connection there [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img][/color] Also moved render code to draw method. Now I at least see the BB. Still some issues. 1. Shaders still not working properly, like described above. 2. The BB-lines behind the Model tend to be drawn in front of the model for a split moment [color=#333333]Thanks,[/color] [color=#333333]plusnoir[/color]
  12. Hi folks, I've got following problem. I have some .X models loaded via selfwritten assetManager that has Lists with models in it. I also Apply a Diffuse-shader to my models. All the models are "selfdrawing" in a BasicModel-class. [CODE] effect.CurrentTechnique = effect.Techniques["DiffuseLight"]; // Begin our effect effect.Begin(); // obvious renderstates //graphics.GraphicsDevice.RenderState.DepthBufferEnable = true; //graphics.GraphicsDevice.RenderState.DepthBufferWriteEnable = true; // A shader can have multiple passes, be sure to loop trough each of them. foreach (EffectPass pass in effect.CurrentTechnique.Passes) { // Begin current pass pass.Begin(); foreach (ModelMesh mesh in model.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { // calculate our worldMatrix.. world = GetWorld() * mesh.ParentBone.Transform; // .. and pass it into our shader. // To access a parameter defined in our shader file ( Shader.fx ), use effectObject.Parameters["variableName"] Matrix worldInverse = Matrix.Invert(world); Vector4 vLightDirection = new Vector4(0.0f, 0.0f, 1.0f, 1.0f); effect.Parameters["matWorldViewProj"].SetValue(world * camera.view * camera.projection); effect.Parameters["matInverseWorld"].SetValue(worldInverse); effect.Parameters["vLightDirection"].SetValue(vLightDirection); // Render our meshpart graphics.Vertices[0].SetSource(mesh.VertexBuffer, part.StreamOffset, part.VertexStride); graphics.Indices = mesh.IndexBuffer; graphics.DrawIndexedPrimitives(PrimitiveType.TriangleList, part.BaseVertex, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount); } } // Stop current pass pass.End(); } // Stop using this effect effect.End(); [/CODE] Now I checked out [url="http://www.xnawiki.com/index.php?title=Rendering_Bounding_Boxes"]this [/url]tutorial on how to create BoundingBoxes. Of course it doesn't work [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] 1. The render method needs a view and a projection-Matrix. Are those the view and projection-matrices I use in my Camera-class or what are they supposed to be? I just guessed that those are Matrices from my camera class. So I had to call the BoundingBoxRenderer.render() function in Game1.Update(). It looks like this: [CODE] if (assetManager._modelsOnscreen.Count != 0) { foreach (BasicModel model in assetManager._modelsOnscreen) { foreach(ModelMesh mesh in model._model.Meshes){ sphere = mesh.BoundingSphere; BoundingBoxRenderer.Render(BoundingBox.CreateFromSphere(sphere),this.GraphicsDevice,camera.view,camera.projection,Color.Red); } } } [/CODE] As you can see I also had to generate my BoundingBox out of the meshes BoundingSphere. No Idea why the Microsoft guys didn't implement mesh.BoundingBox just like they did with mesh.BoundingSphere. 2. If I just leave the code as it is there are no BoundingBoxes drawn at all. But As far as I can see no more Shaders are applied to the models. They are drawn with BasicEffect. I guess it somehow is caused by the Basic Effect that is used for theBoundingBoxRenderer. Any advice is welcome. Perhaps somebody experienced similar problems? I use XNA 3.1 if it is important. Thanks in advance!
  13. [color=#333333]I am attempting to use System.Windows.Forms objects within an XNA application (as opposed to using a XNA device in a System.Windows.Forms application) - which has no examples as far as the AppHub samples go.[/color] [color=#333333]When I attempted to resize the window I got an exception indicating that the thread was not a STA thread; so I updated my Main method as follows:[/color] [CODE][STAThread] // Added this static void Main(string[] args) { using (Game1 game = new Game1()) { game.Run(); } }[/CODE] [color=#333333]After I fixed this problem; as soon as I draw some models (using the 'X' format) into the XNA window and try to resize, another exception occurs.[/color] [quote] [color=#444444]An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Game.dll Additional information: [/color] [color=#444444]A previous Draw call threw an unhandled exception. See InnerException for details.[/color] [/quote] Any idea how i could handle this? Thanks in advance, noir
  14. [quote name='__sprite' timestamp='1322473324' post='4888371'] This page has instructions on how to use SOIL: [url="http://lonesock.net/soil.html"]http://lonesock.net/soil.html[/url] [/quote] I know that site. Thats where I got SOIL from. But it still doesn't give me any clue on how to link SOIL with Code::Blocks.
  15. [size="2"]Hi folks,[/size] [size="2"] [/size] [size="2"]I am using Code::Blocks for OpenGL development. Right now I am trying to load some textures. As suggested on NeHe I downloaded SOIL [url="http://www.lonesock.net/files/soil.zip"]here[/url].[/size] [size="2"]Unfortunately I didn't find any instruction on how to link all the headers and libs with Code::Blocks.[/size] [size="2"] [/size] [size="2"]So could anyone give me a step by step instruction or any helpful links on how to include SOIL with CB?[/size] [size="2"] [/size] [size="2"]Thanks,[/size] [size="2"] [/size] [size="2"]plusnoir[/size]