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

cephalo

Members
  • Content count

    213
  • Joined

  • Last visited

Community Reputation

739 Good

About cephalo

  • Rank
    Member
  1. Thanks for the replies. I'm fairly decent at OOP, but for most of my programming life I've always dealt with graphics and system oriented stuff. I haven't done much actual 'this is what the game part of the game needs to do' programming.   Game states are something I forgot about. Really, map generation happens in it's own game state. Separating the states into different classes is a great start. There will be subdivisions of labor beyond that, but those will probably be somewhat fluid. When you're in uncharted territory, sometimes things that seem separate end up being intricately related, and things that seem related end up needing to be forcibly separated.
  2. So, I have a lot of the technical stuff in my game finished, such as graphics and pathfinding and it's all completely separated from the game itself. I am now starting to develop the game logic. Up until now, all of my game logic has been in a single class dealing mainly with game map generation. Now that I'm ready to experiment with actual game rules, AI and units moving around, I'm afraid my 'GameLogic' class is just going to become huge and unmanageable.   Is there any conventional wisdom regarding the division of labor at this stage that I should be aware of? I know I don't want a giant, confusing lump of code, but my predictions for what would make things cleaner often don't pan out.
  3. Thanks for the push in the right direction. I was foundering between option 1 and 2 in my setup, which was kinda painful and hopeless.   I'm intrigued by 'buffers go in a memory pool'. What is that exactly, a giant buffer that is maintained manually somehow? How do I put an instance buffer(misc data used by the shaders) into a memory pool and then use it in my shader?
  4. So I have this simple game engine that displays a 3D hex game board/map, that can support things like floating islands, river networks and cave systems. I have the map divided up geographically into cuboid chunks so that I can render only the parts that are near the camera and in the frustum. Each chunk has a series of dynamic buffers to draw the terrain, rivers, water levels etc. These buffers are often different sizes, as some map chunks have few rivers, or few water tiles, or sometimes in the case of floating islands there might be only one or two map tiles in the whole chunk, or the chunk might be completely empty space. This scheme is working great if I am just generating a map and displaying it. I draw what exists in my buffers each frame.   However, if this thing is ever going to be useful in a game, I need to be able to alter the map during the course of the game. It's time to make this thing change over time. But that means that I don't know the buffer's size needs at initialization time. I have to assume that every chunk is full of tiles, water and full of rivers, which in practice will be never the actual case. The problem is that not only will I have to waste memory (probably 5x as much) for empty fixed size buffers, but I'll also have to send a bunch of degenerate triangles for rendering, which is probably going to be some kind of performance hit.   All of a sudden my geographical partitioning makes a lot less sense. I wonder if any of you know of another way to handle resource data that changes in size in the described manner.
  5.  I did some experimentation mixing WPF with SharpDX and I found that it wasn't usable. For one thing, you can't use a swap chain, so any drawing that is done is visible irrespective of when your actual frame is finished rendering, so the result is a series of ugly, half finished frames. Only if your 3D scene is very simple will it work, and that of course is mostly machine dependent as to how simple it needs to be. MS was going to make WPF d3d compatible but they gave up, saying that WPF was just not designed for it and making it work was just too complex.   EDIT: The fix for all this stuff is Windows 8 and WinRT. :)
  6.  Yeah, 1 and 3 are potentially problematic as things are. 2 is as Josh said, you just need the right view matrix, no big deal.   As for thing 1, if you mean rendering to part of a window while other things go on the other parts of said window, there is no nice way to do it unless you go Windows 8 only.   As for item 2, Text rendering for Windows 7 requires some difficult solutions. I have an example to show, but it requires you to use the D3D 11_2 version of SharpDX, which luckily does work on Windows 7. For reasons I don't understand, you have to open your solution file, and in the first property tag add the line    <SharpDXDirectXVersion>DirectX11_2</SharpDXDirectXVersion>   If you do this, you might also have to use a specific version of the shader compiler for your other things, I have d3dcompiler_47.dll being copied to my output directory or else it won't be found. (I don't know why exactly)   Here is my crappy code for this, it's full of outdated comments and other nonsense, use at your own risk! The TextRenderer class draws text to my main screen. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SharpDX; using SharpDX.Direct3D; using SharpDX.D3DCompiler; //using SharpDX.DirectWrite; //using SharpDX.DXGI; //using SharpDX.Direct3D11; //using SharpDX.Direct3D10; using System.Runtime.InteropServices; using d2 = SharpDX.Direct2D1; using d3d = SharpDX.Direct3D11; using dxgi = SharpDX.DXGI; //using wic = SharpDX.WIC; using dw = SharpDX.DirectWrite; namespace TextWriterDX11 { public static class TextTextureRenderer { public static void DrawTextToTexture(IntPtr dx11DevicePtr, d3d.Texture2D texture, string text, Color4 color) { d3d.Device1 dx11Device; dxgi.Device dxgiDevice; d2.Device d2dDevice; dxgi.Surface surface; dw.TextFormat textFormat; d2.DeviceContext dwRenderTarget; d2.SolidColorBrush brushText; d3d.Device device110 = new SharpDX.Direct3D11.Device(dx11DevicePtr); dx11Device = device110.QueryInterface<d3d.Device1>(); // DirectX DXGI 1.1 factory SharpDX.DXGI.Factory1 factory1 = new SharpDX.DXGI.Factory1(); // The 1st graphics adapter dxgi.Adapter1 adapter1 = factory1.GetAdapter1(0); FeatureLevel fl = dx11Device.FeatureLevel; var factory2D = new d2.Factory1(); dxgiDevice = dx11Device.QueryInterface<dxgi.Device>(); d2dDevice = new d2.Device(dxgiDevice); surface = texture.QueryInterface<dxgi.Surface>(); d2.CreationProperties cp = new d2.CreationProperties { DebugLevel = d2.DebugLevel.Information, Options = d2.DeviceContextOptions.None, ThreadingMode = d2.ThreadingMode.SingleThreaded }; dwRenderTarget = new d2.DeviceContext(surface, cp); // srv = new d3d.ShaderResourceView(dx11Device, textureD3D11); // Direct Write factory SharpDX.DirectWrite.Factory dwFactory = new SharpDX.DirectWrite.Factory( SharpDX.DirectWrite.FactoryType.Isolated ); // The textFormat we will use to draw text with textFormat = new SharpDX.DirectWrite.TextFormat( dwFactory, "Code2000", SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, SharpDX.DirectWrite.FontStretch.Normal, 160 ); textFormat.TextAlignment = SharpDX.DirectWrite.TextAlignment.Center; textFormat.ParagraphAlignment = SharpDX.DirectWrite.ParagraphAlignment.Center; // Brush used to DrawText brushText = new SharpDX.Direct2D1.SolidColorBrush( dwRenderTarget, color ); dwRenderTarget.BeginDraw(); dwRenderTarget.DrawText(text, textFormat, new RectangleF(0, 0, dwRenderTarget.Size.Width, dwRenderTarget.Size.Height), brushText); dwRenderTarget.EndDraw(); adapter1.Dispose(); dxgiDevice.Dispose(); d2dDevice.Dispose(); textFormat.Dispose(); surface.Dispose(); dwRenderTarget.Dispose(); brushText.Dispose(); factory1.Dispose(); factory2D.Dispose(); dwFactory.Dispose(); } } public class TextRenderer { d3d.Device1 dx11Device; d3d.Texture2D textureD3D11; dw.TextFormat textFormat; d2.DeviceContext dwRenderTarget; d2.SolidColorBrush brushText; d3d.BlendState BlendState_Transparent; d3d.InputLayout layoutText; d3d.Buffer vertexBufferText; d3d.VertexShader textVertexShader; d3d.PixelShader textPixelShader; d3d.SamplerState samLinear; dxgi.Surface surface; d3d.ShaderResourceView srv; dxgi.Device dxgiDevice; d2.Device d2dDevice; SharpDX.DirectWrite.Factory dwFactory; d2.Factory1 factory2D; string debugString; string text; Color4 textColor; public string Text { get { return text; } set { textChanged = true; text = value; } } public Color4 TextColor { get { return textColor; } set { colorChanged = true; textColor = value; } } bool textChanged; bool colorChanged; public TextRenderer() { TextColor = new Color4(0.5f, 0, 0.5f, 1); } public void Initialize(IntPtr dx11DevicePtr, dxgi.Surface backBuffer) { d3d.Device device110 = new SharpDX.Direct3D11.Device(dx11DevicePtr); this.dx11Device = device110.QueryInterface<d3d.Device1>(); // DirectX DXGI 1.1 factory SharpDX.DXGI.Factory1 factory1 = new SharpDX.DXGI.Factory1(); // The 1st graphics adapter dxgi.Adapter1 adapter1 = factory1.GetAdapter1(0); FeatureLevel fl = dx11Device.FeatureLevel; factory2D = new d2.Factory1(); dxgiDevice = dx11Device.QueryInterface<dxgi.Device>(); d2dDevice = new d2.Device(dxgiDevice); //surface = swapChain.GetBackBuffer<dxgi.Surface>(0); surface = backBuffer; d2.CreationProperties cp = new d2.CreationProperties { DebugLevel = d2.DebugLevel.Information, Options = d2.DeviceContextOptions.None, ThreadingMode = d2.ThreadingMode.SingleThreaded }; dwRenderTarget = new d2.DeviceContext(surface,cp); // srv = new d3d.ShaderResourceView(dx11Device, textureD3D11); // Direct Write factory dwFactory = new SharpDX.DirectWrite.Factory( SharpDX.DirectWrite.FactoryType.Isolated ); // The textFormat we will use to draw text with textFormat = new SharpDX.DirectWrite.TextFormat( dwFactory, "Calibri", SharpDX.DirectWrite.FontWeight.Normal, SharpDX.DirectWrite.FontStyle.Normal, SharpDX.DirectWrite.FontStretch.Normal, 18 ); textFormat.TextAlignment = SharpDX.DirectWrite.TextAlignment.Justified; textFormat.ParagraphAlignment = SharpDX.DirectWrite.ParagraphAlignment.Near; // Brush used to DrawText brushText = new SharpDX.Direct2D1.SolidColorBrush( dwRenderTarget, TextColor ); Text = adapter1.Description1.Description; debugString = Text; textChanged = false; colorChanged = false; adapter1.Dispose(); //sharedResource.Dispose(); factory1.Dispose(); } public void Update() { // Brush used to DrawText if (colorChanged) { brushText.Dispose(); brushText = new SharpDX.Direct2D1.SolidColorBrush( dwRenderTarget, TextColor ); colorChanged = false; } if (textChanged) { debugString = Text; textChanged = false; } } public void Render() { dwRenderTarget.BeginDraw(); dwRenderTarget.DrawText(debugString, textFormat, new RectangleF(0, 0, dwRenderTarget.Size.Width, dwRenderTarget.Size.Height), brushText); dwRenderTarget.EndDraw(); } public void Dispose() { dxgiDevice.Dispose(); d2dDevice.Dispose(); surface.Dispose(); dwRenderTarget.Dispose(); brushText.Dispose(); factory2D.Dispose(); dwFactory.Dispose(); } } }
  7. Ok, I finally got my scene to render with WPF using the SharpDX.WPF library, and the results are not usable. It might work if your 3D scene is very simple, but you aren't using a swap chain, and the result when your framerate is too slow is that you get a random splattering of screens is various stages of completion.   It looks like mixing DirectX with XAML is a Windows 8+ only thing.   I don't know what to do.
  8.   Be aware that that isn't the proper way to do it. Doing it right is rather easy and a habit well worth getting into.
  9. buffer = new Buffer...   You're creating a new buffer every frame. Use map and unmap instead. You want to create a buffer on the GPU, and reuse that every frame.
  10. So I messed around with XAML last night, and it took me about ten minutes to throw together all the things I would need for a functional game UI. I friggen love it! Now I just need to put my dx rendertarget in there without killing my framerate too bad. I'm currently rendering to a SharpDX RenderForm, so hopefully WPF won't be a big step backwards from Windows Forms. I found this library https://sharpdxwpf.codeplex.com/ that will hopefully help out in that regard. I guess that it shares the dx11 render target with a dx9 one that WPF can use.   We'll see how it goes.   EDIT: Not going well. I tried to update SharpDX.WPF and it's samples to the latest SharpDX version and I broke it! It worked initially, but when I updated the nuget package the sample app no longer draws anything. The render target clears to the right color, but no geometry is drawn. Dang. I was hoping I wouldn't have to understand the whole library but I guess I will.
  11. Now that I think about it, I think I'm using DataStream for initializing buffers, but DataBox to map /unmap the dynamic ones, maybe that's why I didn't run into obvious problems.   I get the feeling from your posts that you are migrating from DX9 to DX11. Let me tell you that the change is not-at-all trivial. I was pretty comfortable with DX9 and though I'm just an amateur in any case, it took me a whole year to get that comfortable with DX11. They are so different from one another you almost have to forget what you know. Maybe you should put your project aside and implement some DX11 tutorials in SharpDX. Everything is different in DX11.
  12. When you say 'aspect or component based approach' rather than fixed objects. What do you mean by that?   Let's say I'm making a conquer the world game and I want to show the user a sortable list of cities they control with some relevant info for the status of each city, kind of like a spreadsheet. How would I do that? 
  13. So I'm at the point in my game development where I have to start deciding on a UI framework. Tablets are all the rage these days, but I don't use one myself. The reason why that is, is because I'm a PC gamer. I like strategy games and the occasional first person shooter, things like Crusader Kings 2, the Civilization series, that kind of thing. When I start making my game, it will be a strategy game of some complexity.   Every touchscreen game I have ever seen is a casual game where you poke at things and get a response. Have any of you ever seen a complex strategy game on a tablet? Please name them if you have.   What I'm wondering is, for the games I like to play and presumably make, whether keyboard and mouse is the only way, and that the touchscreen will never be a replacement for that. I worry that trying to turn a PC game into a tablet game is a fools errand to be strictly avoided.    What do you think?
  14. I personally use DataStream extremely irresponsibly. I only recently made sure to Close or Dispose of any of them, and I have never had this problem.
  15. Ok, after a couple of years I've finished with my graphics engine! It has everything I need to make a game prototype now. The only thing left is to decide how I want to present various game data. The games I like to play (and also presumably make) are fairly complex strategy games, so I will need to present possible sortable lists, tables and dialogs etc. over the top of and along side of my main graphics screen.   I think I've already made a decision, but I wanted some other opinions on the subject because for me this is uncharted territory.   All of my UI experience to date comes from WIndows Forms. That is what I am comfortable with even though it performs miserably for something like games. However, XAML seems to have some promise even though I have no experience with it. Microsoft seems to be pushing that with the new WinRT stuff, but I'm not ready to force a Windows 8+ platform. I am still using Windows 7 and will probably end up skipping 8 altogether. That leaves me with mixing SharpDX with WPF I think if I want to get familiar with XAML. My research is heading that direction.   What do you think? Is that just a big waste of time or is it feasible?