Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 May 2006
Offline Last Active Apr 29 2016 12:18 AM

#5288106 Question about adding bullets to arraylists

Posted by GuyWithBeard on 22 April 2016 - 02:40 AM

Also, it's not really good forum etiquette to remove your questions and replace them with "[solved]". That way no-one else can benefit from the question and answer later on. When your issue is solved, reply to the thread letting other people know what the problem was. Then try to learn from the experience.

#5280933 How do you generate a Navigation Grid for 3D environments?

Posted by GuyWithBeard on 12 March 2016 - 02:37 PM

Well they are hardly squares since we are talking about a 3D environment here. Anyway, the voxels produced by Recast should be exactly what you need.


If you cannot figure out where the generation is then you haven't looked very thoroughly at the code (in the file that I suggested earlier).




The complete navmesh generation is in Sample_SoloMesh::handleBuild(), but you don't necessarily need to do all steps 1-7. Step 2 is concerned with creating the voxel height field. Search for duDebugDrawHeightfieldSolid() to see how the demo app draws the voxels.

#5280919 How do you generate a Navigation Grid for 3D environments?

Posted by GuyWithBeard on 12 March 2016 - 12:44 PM

Not exactly sure what you mean by squares, but Recast does indeed generate a voxel mold out of the geometry as a intermediate step when generating a nav mesh. I haven't used the voxel mold directly but I don't see why that wouldn't be possible. Try out the recast demo with some of your geometry to see if the results look like something you could use. The demo app can draw the voxels for you.


What exactly don't you understand about the generation phase? The samples that come with Recast are very well documented. Check out Sample_SoloMesh for example.

#5275706 What are you guys using to simulate packet loss/latency while testing?

Posted by GuyWithBeard on 15 February 2016 - 01:33 AM

This tool works fairly well:




It does not allow you to mess with the loopback interface though, so you basically have to have two boxes (or two physical network interfaces). Some people build this sort of thing right into their network layer. That way you don't need any separate software at all.


EDIT: I almost forgot. There is this thing as well: https://github.com/jagt/clumsy I have not used it though.

#5273448 Good tutorial's for 2D voxel engine development with unity5

Posted by GuyWithBeard on 31 January 2016 - 04:52 AM

2D voxel? Wouldn't that just be a pixel?

#5273275 Drawin Mesh (without model file)

Posted by GuyWithBeard on 29 January 2016 - 04:08 PM

You can certainly do this. The rendering API has no idea where the data originally came from (model file, network stream or even defined at runtime).


You just need a way to define each vertex (a vertex buffer) and some way to define the ordering the vertices into triangles (an index buffer) and fill those with the data you want. For texturing, just make sure your vertices have UV coordinates and set the texture you want to use. The exact details of this depend on the engine/framework you are using and on the shaders used.


In theory you could even generate the data on the GPU completely using eg. the geometry shader, but lets' not go there. My point is just that the CPU does not even need to know about your meshes.

#5273270 Game Command Console

Posted by GuyWithBeard on 29 January 2016 - 03:50 PM

I have a similar system set up. I use fastdelegates for hooking up executable functions to console commands (you can just as easily use std::functions if you want). A very simple system would look like:


  typedef FastDelegate0<void> CommandCallback;

  void registerCommand(const std::string& commandName, const CommandCallback& cbck)
    // Add to map here...


  std::map<std::string, CommandCallback> mRegisteredCommands;

After parsing a command you just look up the correct callback in the mRegisteredCommands map and execute it. You can even support passing arguments to the callbacks. If you use fastdelegates you can save all mementos to the same map regardless of the number and types of arguments. You just need a way to recreate the proper callback before doing the actual call.


Another way (and the way I am doing it) is have all registered functions be FastDelegate0<void>:s, ie. parameterless functions, but allowing (and indeed requiring) the functions that are registered with arguments to pop them off a temp storage stack that is filled by the console during the command parsing phase.

#5271039 3D Editor Transform Gizmos(Handles)

Posted by GuyWithBeard on 14 January 2016 - 07:16 AM

I do something similar to Daixiwen. If you want the gizmo to remain the same size onscreen with a perspective camera you can use the following code to set the scale:

const float gizmoSize = 0.2f;
float scale = gizmoSize * ((camPos - gizmoPos).length() / tanf(cam->getFovY() / 2.0f));

You probably want to clamp the scale between some values that make sense for you. The gizmoSize depends on how large the gizmo mesh is, how large you want it to be etc.

#5269562 good Game Development resources

Posted by GuyWithBeard on 06 January 2016 - 12:12 AM

Since you want to create you own 3D engine I am going to recommend Frank Luna's Introduction to 3D Game Programming with DirectX11. Awesome book:




It assumes you have a farily good understanding of C++ but nothing too advanced. It also teaches you a fair bit of 3D math that is the same regardless of API, language of platform.

#5269561 Which development kit to use for my new project?

Posted by GuyWithBeard on 06 January 2016 - 12:06 AM

You should never use the term “dev kit” to refer to anything but specialized hardware and related development tools


Well, Wikipedia says the following about SDKs: "A software development kit (SDK or "devkit") is typically a set of software development tools that allows the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar development platform." I don't agree that devkit necessarily means hardware.


Anyway, that's beside the point. Like Nypyren said, sounds like you are better off using an API such as winforms (or wpf) for what you have in mind. The database connection is easy enough with an ADO.net connector and you can still hook into the GPU if you want to use the hardware for bitmap manipulation with something like SharpDX. As for rendering, in my level editor I am drawing using DirectX into a winforms panel and it works like a charm. It can then obviously be used like any other winforms control.


Hope that helps.

#5269356 Win32 Borderless Fullscreen Window

Posted by GuyWithBeard on 05 January 2016 - 01:27 AM

What about just rendering a fake title bar inside the client area when the mouse is close enough to the top of the window?

#5268795 Deferred rendering questions

Posted by GuyWithBeard on 02 January 2016 - 01:14 AM

Regarding the AA, remember that you can always do AA as a post processing full screen effect, like with FXAA.

#5260074 Need help with level design workflow

Posted by GuyWithBeard on 02 November 2015 - 01:49 AM


#5250615 C# 3D graphics engine needed - with polygon picking? Where to start?

Posted by GuyWithBeard on 04 September 2015 - 03:34 PM

Again i am surprised that picking is not a more commonly available feature, if not the graphics library then something els.


It's not that it isn't "available". It's just that it's such a small and specific thing that it's not advertised as a "major feature" of any given game engine or toolkit. It's the same as car manufacturers not making a deal out of their cars featuring blinkers.


I would think that any half decent game engine allows you to select polygons by picking, so just select the one that you fine nice otherwise and then find out how to do the picking. It helps if the engine has a user community as then you can usually find tutorials or code snippets on the internet but, as I said the picking could be done completely separately, bypassing the graphics engine completely.


I have worked with a couple of in-house game engines that actually provide ray casting (which can be used for picking among other things) only against the physics objects, rather than the graphical objects. The physics objects are usually a lot simpler than their graphical counterparts, in terms of number of polygons and vertices, so they don't line up perfectly with what you see on the screen. This is another reason that I tend to think of picking as not being part of the graphics engine.


That said, if you really want to select visual polygons you can do it with the technique I described above. If you are unsure about the math just ask, or do a google search using the steps I provided as search terms. Also, depending on how complex your scene is, you might be able to skip the AABB test completely as it is just an optimization and go straight from the ray construction to ray-triangle intersection, iterating over all triangles in the scene.

#5250450 C# 3D graphics engine needed - with polygon picking? Where to start?

Posted by GuyWithBeard on 03 September 2015 - 12:08 PM

To be honest I don't know why you make such a big deal out of the polygon picking. I don't even consider that part of the graphics engine. You can do that with a little bit of math, for example a simple way would be:

  • Construct a picking ray with an origin and direction. For this you need the camera view and projection matrices and a way to select a 2D screen coordinate on the window (which should be easy enough in Winforms)
  • Iterate over the objects in the scene and do a ray-AABB intersection test against their bounding boxes
  • Select the object with the closest hit
  • Do a ray-triangle intersection against the triangles of the object
  • Select the triangle with the closest hit

The above technique can be optimized in a number of ways, but that is generally what you need, and it is the same regardless of the graphics engine or API used.


As for rendering into Winforms, that can be done with almost anything. For example, my engine is a standard Win32 application but I can attach it to a Winforms app and run it as an editor, basically rendering into a Panel Control in winforms, the window handle of which is passed to the engine process. In the past I have used Ogre through the Mogre wrapper to render into a winforms application.


If you like one of the toolkits that you listed but you were missing the picking code I suggest writing that yourself. It is only a couple hundred lines of code. And you should be able to find tutorials for doing that on the internet. Eg. Frank Luna's DX11 book has a chapter on picking and the code can be downloaded from this site: