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

Mr.Big

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

109 Neutral

About Mr.Big

  • Rank
    Newbie
  1. Yeah that's basically what i'm looking for. Just the characters/enemies are 2D yet all the surroundings 3D. That video illustrates what I'm trying to do exactly..   Now that I know the terminology for it, I'll take a look around at some resources. Thanks!   Edit: Wow. Looks tricky.. this should be fun...
  2. Basically I've come across a few games that use this convention, and I'm curious on how its done and want to implement it.   Something similar to this; This video seems to have accomplished it really well. There are a lot of pretty bad implementations of it too. http://www.youtube.com/watch?v=LedV_k2Nc6A   I just want to know where to start, what to look out for, any tips or advice.   Cheers
  3. The plan was to draw a 256x256 map, and have a "portal" somewhere on the map that leads to another map. So loading all the maps when the game loads is out of the question.   My plan was to have a text file for each map with a whole bunch of vertices, followed by objects on the map with a position to draw it at.   map1.map, "Home Town"; 0,1,0,3,1,0,0,4,3,5,6,2,0,2,3,8,4,2,0,28,169,474,935,742,42,36; "House.obj", 56,0,56; "Car.obj", 56,0,80;     I have absolutely no idea how XNA loads objects, but this was my thought on how to do it.   Edit: Oh, and didn't need collision detection as I was just going to define each tile as walkable or not-walkable.   Does this sound like a reasonable, efficient way to draw a map?   Edit2: Actually, since the maps will all be 256x256, there's really no point in storing the x and z vertices in a text file since they will all be quads (tiles). The only thing that needs to be stored is the height of each group of 3 vertices. Which I suppose could be done with a height map image?
  4. Ok cheers for the tips. I only chose triangle strip because I thought it was more efficient at drawing triangles. That was what they taught us at university anyway, but that was a long time ago. Haven't really done any game programming since I finished - this is my first foot back in the water.   Are there any tutorials on drawing triangle lists? Or some jumping-in-to-xna guides? I tried following the MSDN tutorials but they seem to miss out key important parts to get things done that a fresh person to XNA wouldn't have any idea about.   Edit: This is what I've come up with so far but its not drawing anything.   using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; namespace RO3 { /// <summary> /// This is the main type for your game /// </summary> public class Game1 : Microsoft.Xna.Framework.Game { Matrix worldMatrix; Matrix viewMatrix; Matrix projectionMatrix; GraphicsDeviceManager graphics; SpriteBatch spriteBatch; GraphicsDevice device; Effect basicEffect; VertexPositionColor[] primitiveList; int points = 8; short[] triangleListIndices; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { graphics.PreferredBackBufferWidth = 1000; graphics.PreferredBackBufferHeight = 1000; graphics.IsFullScreen = false; graphics.ApplyChanges(); Window.Title = "RO3"; InitializeTransform(); InitializeTriangleList(); base.Initialize(); } protected override void LoadContent() { device = graphics.GraphicsDevice; basicEffect = Content.Load<Effect>("effects"); } private void InitializeTransform() { worldMatrix = Matrix.CreateTranslation(new Vector3(-1.5f, -0.5f, 0.0f)); viewMatrix = Matrix.CreateLookAt( new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up ); projectionMatrix = Matrix.CreateOrthographicOffCenter( 0, (float)GraphicsDevice.Viewport.Width, (float)GraphicsDevice.Viewport.Height, 0, 1.0f, 1000.0f); } private void InitializeTriangleList() { primitiveList = new VertexPositionColor[points]; for (int x = 0; x < points / 2; x++) { for (int y = 0; y < 2; y++) { primitiveList[(x * 2) + y] = new VertexPositionColor(new Vector3(x * 100, y * 100, 0), Color.White); } } triangleListIndices = new short[18] { 0, 1, 2, 2, 1, 3, 2, 3, 4, 4, 3, 5, 4, 5, 6, 6, 5, 7 }; } protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } protected override void Update(GameTime gameTime) { base.Update(gameTime); } protected override void Draw(GameTime gameTime) { device.Clear(Color.DarkSlateBlue); basicEffect.CurrentTechnique = basicEffect.Techniques["ColoredNoShading"]; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); } RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; device.RasterizerState = rs; //drawing code goes after this DrawTriangleList(); base.Draw(gameTime); } private void DrawTriangleList() { GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>( PrimitiveType.TriangleList, primitiveList, 0, // vertex buffer offset to add to each element of the index buffer 8, // number of vertices to draw triangleListIndices, 0, // first index element to read 6 // number of primitives to draw ); } } }
  5. Hello everyone. First time XNA project here, so still learning the ropes.   My first idea for a starter project was to make a tile based game. Each movable terrain square would be one quad (or 2 triangles). Then use some method to determine which tile the mouse is over and clicking it moves the player there.     So what would be the ideal way to do this in XNA? My first thought was to create a triangle strip and a text file with all the vertices and heights and load it in and draw it.   Any other suggestions?
  6. I have no idea why this wont work. Needs a new set of (more experienced) eyes to take a look at it. Lua table; [code]maplist = {"sand.obj", "jungle.obj", "cubes.obj"}[/code] C++ [code] //populate the map list array stringw maplist[50]; int i = 0; lua_getglobal(L, "maplist"); lua_pushnil(L); while(lua_next(L, -2)) { maplist[i] = (stringw)lua_tostring(L, -1); i++; lua_pop(L, 1); } lua_pop(L, 1); [/code] Basically its just filling the array with random garbage. If i change it to maplist[0] it works. (obviously overwrites it twice though) Any tips? Maybe even a better way to do it? Edit: Ok? Not initializing the array was apparently the problem. *shrug* Resolved now, I guess?
  7. So its come to this. Posting a help topic on GameDev! I'm pretty new to CG, and my work is based on about 3 of my projects merged with mixed success. So whats happening is the fragment shader is sortof working, I can see its doing something. However when I try to add the textures into the mix it decides there is an Invalid Program Handle. The .cg file; [code] struct vertex { float4 position : POSITION; float4 normal : NORMAL; float4 color0 : COLOR0; float2 texCoord : TEXCOORD0; }; struct fragment { float4 position : POSITION; float4 color0 : COLOR0; }; fragment main( vertex IN, uniform float4x4 modelViewProjection, uniform float4x4 modelViewInverse, uniform float4 eyePosition, uniform float4 lightVector, uniform sampler2D decal : TEX0) { fragment OUT; OUT.position = mul( modelViewProjection, IN.position ); // Transform normal from model-space to view-space float4 normal = normalize( mul( modelViewInverse, IN.normal ).xyzz ); // Store normalized light vector float4 light = normalize( lightVector ); // Calculate half angle vector float4 eye = eyePosition; float4 half = normalize( light + eye ); // Calculate diffuse component float diffuse = dot( normal, light ); // Calculate specular component float specular = dot( normal, half ); specular = pow( specular, 32 ); // A little ambient color float4 ambientColor = float4( 0.2, 0.2, 0.2, 0.2 ); // White specular float4 specularMaterial = float4( 1.0, 1.0, 1.0, 1.0 ); // Combine diffuse and specular contributions and output final vertex color OUT.color0 = diffuse * IN.color0 + specular * specularMaterial + ambientColor; //OUT.color0 = diffuse * tex2D(decal,IN.texCoord) + specular * specularMaterial + ambientColor; return OUT; } [/code] So see where I commented out "OUT.color0 = diffuse * tex2D(decal,IN.texCoord) + specular * specularMaterial + ambientColor;". If i leave it uncommented I get the model rendered with what looks like some form of shading. If I uncomment, I get Invalid Program Handle. I dont know if this is the best way to be doing things, I've had very little theory on shaders and just reading others' code. Heres the rest of the code. Snippet from the Header file; [code] ... static CGparameter modelViewProjection; static CGparameter myCgFragmentParam_decal; static CGparameter modelViewInverse; static CGparameter CGeyePosition; static CGparameter CGlightVector; static CGprofile g_CGprofile; static CGcontext g_CGcontext; static CGprogram g_CGprogram; ... [/code] Snippet from the Initializer; [code] ... g_CGprofile = CG_PROFILE_ARBVP1; g_CGcontext = cgCreateContext(); checkForCgError("creating context"); g_CGprogram = cgCreateProgramFromFile( g_CGcontext, CG_SOURCE, "cg_lighting.cg", g_CGprofile, NULL, NULL ); checkForCgError("creating program"); cgGLLoadProgram( g_CGprogram ); checkForCgError("loading program"); modelViewProjection = cgGetNamedParameter( g_CGprogram, "modelViewProjection" ); modelViewInverse = cgGetNamedParameter( g_CGprogram, "modelViewInverse" ); CGeyePosition = cgGetNamedParameter( g_CGprogram, "eyePosition" ); CGlightVector = cgGetNamedParameter( g_CGprogram, "lightVector"); checkForCgError("naming params"); myCgFragmentParam_decal =cgGetNamedParameter(g_CGprogram, "decal"); //texture checkForCgError("getting decal parameter");//texture cgGLSetTextureParameter(myCgFragmentParam_decal, 1);//texture checkForCgError("setting decal 2D texture");//texture ... [/code] The error CG throws is "creating program" Invalid Program Handle. Snippet from the Rendering loop; [code] glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslatef( 0.0f, 0.0f, -200.0f ); glRotatef(-50,1,0,0); cgGLSetStateMatrixParameter(modelViewProjection, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY ); cgGLSetStateMatrixParameter( modelViewInverse, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_INVERSE_TRANSPOSE ); float fEyePosition[] = { 0.0f, 0.0f, 0.0f, 0.0f }; float fLightVector[] = { 0.0f, 0.0f, 1.0f, 0.0f }; // Normalize light vector float fLength = sqrtf( fLightVector[0]*fLightVector[0] + fLightVector[1]*fLightVector[1] + fLightVector[2]*fLightVector[2] ); fLightVector[0] /= fLength; fLightVector[1] /= fLength; fLightVector[2] /= fLength; cgGLSetParameter4fv( CGeyePosition, fEyePosition ); cgGLSetParameter4fv( CGlightVector, fLightVector ); cgGLBindProgram( g_CGprogram ); cgGLEnableProfile( g_CGprofile ); cgGLEnableTextureParameter(myCgFragmentParam_decal); checkForCgError("enable decal texture"); //now draw all the stuff glPushMatrix(); glTranslatef(md5.getxPos(),md5.getyPos(),md5.getzPos()); cgGLSetStateMatrixParameter(modelViewProjection,CG_GL_MODELVIEW_PROJECTION_MATRIX,CG_GL_MATRIX_IDENTITY); md5.render(); glPopMatrix(); cgGLDisableProfile( g_CGprofile ); checkForCgError("disabling decal texture"); cgGLDisableTextureParameter(myCgFragmentParam_decal); checkForCgError("disabling decal texture"); SwapBuffers(hDC); [/code] Any help here would be greatly appreciated. At least a point in the right direction. Originally I had a separate vertex and fragment shader but I was having some problems and ended up rewriting it like this. It was working all well and good until I decided to implement textures. I'm thinking this could be the problem, because at the creating program part there is no entry function declared - does there need to be one for it to work with textures? I can't do it the way I have it now?