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

ChaseRLewis

Members
  • Content count

    28
  • Joined

  • Last visited

Community Reputation

154 Neutral

About ChaseRLewis

  • Rank
    Member
  1.   Oh shit, this is exactly what is happening. Didn't think to check it, just assumed it was running on my 980M. Now just need to figure out how to make GLFW force use the 980M.   Edit: This was caused my Nvidia's Optimus software for laptops. The solution is super simple, just export a flag on windows. Just add this to your main file with window.h and it will work great.   extern "C"  { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; }
  2. Been trying to mess with this extension, but even the demos don't run. Says the extension is unsupported. I have a Nvidia 980M on my laptop and it should be supported on any CUDA video card. Anyone know of anything that wouldhelp me get stuff running?   https://developer.nvidia.com/nv-path-rendering    
  3. One note unless GUIWindow is this I recommend a UIPanel class. This is pretty much just a group of components that has a size and can organize children relative to its position. It lets you anchor points and you will need a margin / anchor property to make sure everything lines up unless you are only wanting to support 1 resolution. Another convenient figure is if you allow it to clip children. Then you can create scroll views. Most gui utilities support panels, grids, and other organizational items but you can get by with just a panel to be honest. Also by supporting children to organizational objects you can build together different parts to make more complicated components.  Also when you create your event system you can search through your items in a tree structure rather then a linear list. Also you NEED events / callbacks. If you are in c++ use FastDelegate as a base for your delegate system and build an event class. Most other languages have some sort of support for that otherwise.   Common components I use. 1. Textbox 2. Texture Button 3. Label 4. Progress Bar / Slider (these components internally will be very similar) 5. Scrollview
  4. I'm not wanting to get full type information or anything crazy. I just am interested in creating a data driven design for my entities. Thing is I have NO idea how to get an enumeration of the DLL function names in Windows. I'm looking at stuff like DbgHelp and other stuff, but the documentation is pretty poor and I'm having a hard time figuring out how to enumerate it.   What I'm trying to do: class GameComponent { protected: virtual void XMLSave(XMLDocument& doc,XMLElement* parent) = 0; virtual GameComponent* XMLLoad(XMLElement* node) = 0; public: virtual const int TypeID() = 0; virtual const char* Name() = 0; virtual void Update(){} virtual void Initialize(){} //etc... }; Idea is a search through the symbol list when the engine initializes so that I can build a list of XMLSave, XMLLoad functions without having to hard code a static list of them. Also will allow me to be able to make additional dlls in the future and extend it. class GameComponentFactory { private: map<const char*,delegate<GameComponent*(XMLElement*)>> ComponentLoadMap; public: void Initialize(const char* dllPath); Scene* LoadXMLFile(const char* path); } void GameObjectFactory::Initialize(const char* dllPath) { /* How do you load the table? */ vector<string> enumerations = LoadDLLExportTable(dllPath); /* Determine if class is derived from GameComponent ... if so add to the map functions that belong to the main game loop and xml load / save files. I've read papers that said they've done this ... I just have no clue how. */ } Scene* GameComponentFactory::LoadXMLFile(const char* path) { /* Psuedo-code would need to be much more safe */ XMLDocument doc; doc.Open(path); Scene* scene = ResourceManager::NewScene(); for(auto obj = doc->FirstChildElement();obj;obj->NextSiblingElement()) { GameObject* go = new GameObject(obj->Name()); for(auto component = obj->FirstChildElement();component;component->NextSiblingElement()) { go->AddComponent(ComponentLoadMap[component->Name()](component)); } scene->AddGameObject(go); } return scene; }
  5. Edit: I've gotten it from 5k to about 60 by only checking 100% opaque values and introducing floating point tolerances since Unity converts all the colors to floating point. But that's still about ~13-15x the number in the actual number in the photo ... that's with pretty generous tolerances of .1f which is is ~ +/- 25 in the 8-bit color scale. So I'm trying to write a tool for my Unity game that will allow me to make a color edit mode. I figured if I went the extra step to make sure my colors were all completed seperated that it would be fairly easy, but I'm still getting far more colors then I actually attempted using when I colored the picture. The picture was done with vector graphics so I know the precise color of each not including the aliased lines which are interpolated with a completely alpha color. I'm not 100% that aliasing is the problem but otherwise I am completely unsure why there would be in the realm of 4000 different colors showing in my photo. They all seem to be really similar versions of the same color so aliasing is the only thing that makes sense. The idea is have a color mask, a and a pallete to map use selected colors too at run time. This is just a sample file of peach from paper mario I'm using to test the system [attachment=11405:PrincessColor.png] The goal is to use this color map with the BW and a shade map to construct the final picture. I was separating the BW from the color to try and solve the aliasing issue but that isn't the solution. Hopefully looking like this in the end.[attachment=11406:ColorPrincess.png] I got it working in photoshop but need to find out how to export this to my game. I could do it by exporting each clip mask out as a picture then recombining them mathematically to guarantee they are exact, but exporting 6-12 pics per frame then recombining is more work then it should have to be. Any help would be appreciated. Code: [source lang="java"]public class ColorEditorWindow : EditorWindow { static ColorEditorWindow window = null; List<Color> ColorPallette = new List<Color>(); // Use this for initialization [MenuItem("Window/ColorEditor")] static public void Start () { if (window == null) window = EditorWindow.GetWindow<ColorEditorWindow>(); } public void GetPallette() { if (texture != null) { //Reset Pallette if previous one existed if(ColorPallette.Count != 0) ColorPallette.Clear(); Color temp = new Color(); //cache color value to use as temporary for (int i = 0; i < texture.height; i++) { for (int j = 0; j < texture.width; j++) { temp = texture.GetPixel(j, i); //Get pixel to test if (temp.a == 0)//Ignore pure alpha colors continue; //See if color is unique for (int k = 0; k < ColorPallette.Count; k++) //If color exists in pallette skip it -- goto is ugly consider something else { if (ColorPallette[k].r == temp.r && ColorPallette[k].g == temp.g && ColorPallette[k].b == temp.b) goto NEXT; } ColorPallette.Add(temp); //If not in pallette add to pallette NEXT: continue; //If temp exists go here and continue. } } } } public Texture2D texture = null; public void OnGUI() { texture = EditorGUILayout.ObjectField(texture, typeof(Texture2D)) as Texture2D; if (GUILayout.Button("Get Pallette")) { GetPallette(); } /* for (int i = 0; i < ColorPallette.Count; i++) ColorPallette[i] = EditorGUILayout.ColorField(ColorPallette[i]); */ EditorGUILayout.LabelField("Colors: " + ColorPallette.Count); } }[/source]
  6. Found out the issue. I changed this [CODE] pDev->CreateDepthStencilView(pDepthBuff,NULL,&pDepth); [/CODE] : /
  7. [quote name='MefistoManna' timestamp='1334942428' post='4933290'] I have already traslate a mesh with the function D3DXMatrixTranslation in a precise position of the 3D space. But how can i do to move the mesh in direction with a vector? Sorry for my english [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] . [/quote] Easiest way is to keep a hold of the position you want is in a vector than when it comes time to actually do the transformation transform it into a matrix. so in your game logic you can simply do position += velocity or something like that, but when your it comes time to render just do D3DXMatrixTranslation and multiply the mesh by the matrix.
  8. Been following a tutorial to try and learn C++ DirectX. So far so good, but depth buffer is giving me problems. I'll work this into classes after I have a better idea of how it all fits together but here's the code I have so far. The scene renders fine (well except depth buffer not clipping stuff) if I don't put my depth buffer pointer into OMSetRenderTargets() and comment out ClearDepthBuffer(); This makes it pretty obvious to me that it has to do something with how I'm creating the buffer. I've looked up at least 3 different tutorials and tried to adapt their code but none of it seems to work. I've tried everything I can think of and have been trolling forums for about an hour and nothing suggested seems to work. I know it's pretty bleh at the second. Just want to get a better idea of how everything works so I don't have to do to rebuild wrapper classes. //How I Initialize Stuff [CODE] void InitRenderTarget() { HRESULT hr; ID3D11Texture2D* pBackBuffer; pSwapChain->GetBuffer(0,__uuidof(ID3D11Texture2D),(LPVOID*)&pBackBuffer); hr = pDev->CreateRenderTargetView(pBackBuffer,NULL,&pRenderTargetView); pBackBuffer->Release(); pBackBuffer = nullptr; if(hr != S_OK) { isPlaying = false; return; } D3D11_TEXTURE2D_DESC texd; ZeroMemory(&texd,sizeof(texd)); texd.Width = 800.0f; texd.Height = 600.0f; texd.ArraySize = 1; texd.MipLevels = 1; texd.SampleDesc.Count = 1; texd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; texd.BindFlags = D3D11_BIND_DEPTH_STENCIL; texd.Usage = D3D11_USAGE_DEFAULT; hr = pDev->CreateTexture2D(&texd,NULL,&pDepthBuff); if(hr != S_OK) { isPlaying = false; return; } D3D11_DEPTH_STENCIL_VIEW_DESC ddesc; ZeroMemory(&ddesc,sizeof(ddesc)); ddesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; ddesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; pDev->CreateDepthStencilView(pDepthBuff,&ddesc,&pDepth); pDC->OMSetRenderTargets(1,&pRenderTargetView,pDepth); pDepthBuff->Release(); pDepthBuff = nullptr; D3D11_RASTERIZER_DESC rDesc; rDesc.FillMode = D3D11_FILL_SOLID; rDesc.CullMode = D3D11_CULL_NONE; rDesc.DepthClipEnable = true; rDesc.FrontCounterClockwise = false; rDesc.MultisampleEnable = false; rDesc.SlopeScaledDepthBias = false; rDesc.DepthBias = false; rDesc.DepthBiasClamp = false; rDesc.AntialiasedLineEnable = false; rDesc.ScissorEnable = false; pDev->CreateRasterizerState(&rDesc,&pRastState); pDC->RSSetState(pRastState); //SetupViewPort D3D11_VIEWPORT viewport; ZeroMemory(&viewport,sizeof(D3D11_VIEWPORT)); viewport.TopLeftX = 0; viewport.TopLeftY = 0; viewport.Width = 800; viewport.Height = 600; viewport.MinDepth = 0.0f; viewport.MaxDepth = 1.0f; pDC->RSSetViewports(1,&viewport); } [/CODE] //How I do some basic drawing [CODE] void RenderFrame() { pDC->ClearRenderTargetView(pRenderTargetView,ClearColor); pDC->ClearDepthStencilView(pDepth,D3D11_CLEAR_DEPTH,1.0f,0.0f); pDC->Draw(3,0); World2.MakeRotateY(VM_PI*gTimer.TotalTime()); World2.Translate(1.0f,0.0f,0.0f); World2.RotateY(VM_PI_4*gTimer.TotalTime()); Matrix4x4::MatrixMultiply(World2,View,World2); pDC->UpdateSubresource(pCBuffer,0,0,&World2,0,0); pDC->Draw(3,0); pSwapChain->Present(0,0); } [/CODE]
  9. [quote name='alvaro' timestamp='1334759253' post='4932483'] I don't understand what you use those "vectors" for or why they have a last coordinate 1 instead of 0... I am trying to fit what you are saying into the relevant math I know, and it's not working. [/quote] Model is centered at <0,0,0,1> 4-D vector or the origin. So x-axis is <1,0,0,1> and z-axis is <0,0,1,1,>. We arbitrarily define a given vector as "forward" or "backward" or "up" based on which way we preferred. The result is that if you want the "forward" of a model you can just take the "forward" vector and multiply it by the world matrix of a model and get the direction it's facing. Really 99% of the time we wanted rotation information from the model it was which way is "forward" or "up" or "down" or "left" so we would take the vector denoting the default forward and multiply it by the models world matrix to get which way it was facing. So before model->world transformation we know that forward is the same as the "forward" vector constant. So which way it is facing now is "forward" * WorldMatrix. Object transformations were simply handled by augmenting this matrix. So you want to rotate it along the Zaxis? Call matrix.RotateZ(float angle) and rotate the object. Want to Translate it? Call matrix.Translate(x,y,z). Was pretty easy overall. This one matrix inherently had all the information we needed readily available so we just used that. [ stuff stuff stuff 0] [stuff stuff stuff 0] [stuff stuff stuff 0] [x-pos, y-pos, z-pos 1] The only objects we needed that needed to know exact angles was the camera which was handled with a Quaternion. i really only use quaternion's interpolating rotation based animations, for character movement and whatnot matrices are easier imo. . Want the object to slowly move some direction? Get the vector pointing to the object and slerp all day.
  10. Since your objects are stored at the origin I recently worked with a group that did it a bit differently. You define a constant forward,right,left,up vectors up = <0,1,0,1> down = <0,-1,0,1> forward = <0,0,1,1> right = <1,0,0,1> left = <-1,0,0,1> To get your "forward" or "down" vector it was just a single matrix multiplication away. Just make sure your "forward" of your model is facing <0,0,1,1> and the rest is easy. There was than 1 matrix for local rotations and scaling, 1 World Matrix where the bottom 4 floats were the position, 1 vector for recording scale so you can use an absolute scale with models. Was a bit weird but was pretty easy to be honest.
  11. Hello, Alright I'm working on improving my current sprite rendering solution. Currently I have no support for batching textures I simply reference a large numbers of samplers and send over the texture data and the quad find the correct sampler based on data sent with it. Is there another way? I'm just curious if there's a better way, as it just seems clunky to me.
  12. [quote name='ChaseRLewis' timestamp='1301258035' post='4791070'] [quote name='__sprite' timestamp='1301257457' post='4791068'] [s]You don't actually describe what the problem is. Is it not drawing anything? is the texture not showing? is the texture wrong?[/s] Anyway, various things to think about: As with someone else recently, you have "varying in" and "varying out". Both varying and in / out are storage qualifiers - I'm pretty sure it's not meant to be valid to use both of them. I'd suggest using in / out since varying is deprecated (and I'm not actually sure you can use varying in anything other than vertex / fragment shaders). I assume "Texture" is a variable containing the location of the sampler retrieved via glGetUniformLocation, and that your BindTexture member correctly calls glActiveTexture and glBindTexture? Note that you don't have to bind the array buffer as well as the vertex array in the draw call. You don't appear to be calling glEnableVertexAttribArray anywhere. [/quote] Alright I looked into glEnableVertexAttribArray so that's fixed. However I still didn't get anything to show, so i messed with the shader. It seems that for some reason my final value of vec4 vPosition is getting overwritten somehow. If i manually set the height I get a perfect textured quad, but if i try to read it from the incoming vertex I can't see anything. [/quote] lol ok, found out the issue. I simply wasn't referencing my position through gl_in[] instead I was trying to reference through another variable. : P it's working perfectly now.
  13. [quote name='__sprite' timestamp='1301257457' post='4791068'] [s]You don't actually describe what the problem is. Is it not drawing anything? is the texture not showing? is the texture wrong?[/s] Anyway, various things to think about: As with someone else recently, you have "varying in" and "varying out". Both varying and in / out are storage qualifiers - I'm pretty sure it's not meant to be valid to use both of them. I'd suggest using in / out since varying is deprecated (and I'm not actually sure you can use varying in anything other than vertex / fragment shaders). I assume "Texture" is a variable containing the location of the sampler retrieved via glGetUniformLocation, and that your BindTexture member correctly calls glActiveTexture and glBindTexture? Note that you don't have to bind the array buffer as well as the vertex array in the draw call. You don't appear to be calling glEnableVertexAttribArray anywhere. [/quote] Alright I looked into glEnableVertexAttribArray so that's fixed. However I still didn't get anything to show, so i messed with the shader. It seems that for some reason my final value of vec4 vPosition is getting overwritten somehow. If i manually set the height I get a perfect textured quad, but if i try to read it from the incoming vertex I can't see anything.
  14. [quote name='karwosts' timestamp='1301255675' post='4791058'] [quote]This leaves me with the issue of not knowing whether the problem is...[/quote] And what is the problem exactly? [/quote] Oh my bad, nothing is being rendered. No compilation errors or anything like that. Just a complete failure to show anything on the screen.
  15. Alright teaching myself Opengl by going through the SuperBible 5th ed. However, after you get into the later chapters they kind of leave you hanging as they glossed over certain things that were taken care of by the GLTool Library earlier in the book. This leaves me with the issue of not knowing whether the problem is in how i'm creating the vertex array or if it's within my shader. My shader compiles and let's me assign uniforms and looks logically correct. How I'm trying to init my vertex array [code] const GLfloat data[] = {0.0f,0.0f,300.0f,400.0f}; glGenVertexArrays(1,&my_buffer); glBindVertexArray(my_buffer); glGenBuffers(1,&quadid); glBindBuffer(GL_ARRAY_BUFFER,quadid); glBufferData(GL_ARRAY_BUFFER,sizeof(data),data,GL_STATIC_DRAW); glVertexAttribPointer(0,4,GL_FLOAT,GL_FALSE,sizeof(float)*4,(const GLvoid*) 0); [/code] How I try to draw it [code] glUseProgram(program); glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); glUniformMatrix4fv(WVP,1,GL_FALSE,glm::gtc::type_ptr::value_ptr(Ortho)); texture.BindTexture(); glUniform1i(Texture,0); glBindVertexArray(my_buffer); glBindBuffer(GL_ARRAY_BUFFER,quadid); glDrawArrays(GL_POINTS,0,1); [/code] The idea is I send a single vec4 position with data organized <x,y,width,height>. Once I get this working I'll elaborate on it into a full-scale spritebatch system, but one step at a time. Vertex Shader [code] #version 330 varying in vec4 vPosition; void main(void) { gl_Position = vPosition; } [/code] Geometry Shader [code] #version 330 //LAYOUT layout (points) in; layout (triangle_strip) out; layout (max_vertices = 4) out; //IN varying in vec4 vPosition[1]; //OUT varying out vec2 UV; //UNIFORM uniform mat4 Ortho; void main(void) { gl_Position = Ortho*vec4(vPosition[0].x,vPosition[0].y,.01f,1.0f); UV = vec2(0.0f,0.0f); EmitVertex(); gl_Position = Ortho*vec4(vPosition[0].x + vPosition[0].z,vPosition[0].y + vPosition[0].w,0.01f,1.0f); UV = vec2(1.0f,1.0f); EmitVertex(); gl_Position = Ortho*vec4(vPosition[0].x,vPosition[0].y+vPosition[0].w,.01f,1.0f); UV = vec2(0.0f,1.0f); EmitVertex(); gl_Position = Ortho*vec4(vPosition[0].x + vPosition[0].z,vPosition[0].y,.01f,1.0f); UV = vec2(1.0f,0.0f); EmitVertex(); EndPrimitive(); } [/code] Basic Draw texture fragment shader. Fragment Shader [code] #version 330 varying in vec2 UV; varying out vec4 FragmentColor; uniform sampler2D Picture; void main(void) { FragmentColor = texture(Picture,UV); } [/code]