Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Oct 2010
Offline Last Active Yesterday, 12:23 PM

#5291837 Fluid - Spatial Grid

Posted by on 16 May 2016 - 07:29 AM

You can look into pairing functions to create a hash from XY coordinates:




#5290175 Is it C# Territory?

Posted by on 04 May 2016 - 07:06 PM

Depends on the company, I think AutoDesk has some products that you can interop with C#. Others, like my company (e.g. https://www.bentley.com/en/products/brands/openroads) use a mix of C++ and C#...many of our power applications sit ontop of a C++ platform for graphics, element storage, etc but a lot of the business logic and UI are in C#.


C# is more than suitable for a robust graphics application however, you will need to care more about memory management than a typical C# programmer may (e.g., the upcoming language feature of "ref returns" is a big deal to us, but at the //BUILD conference this year it kind of just was shoehorned into the C# team's presentation).

#5286862 'External Code' taking up most of my CPU?

Posted by on 14 April 2016 - 08:48 AM


Ok, it looks like (from my own tests) calling ElementAt on the Dictionary's Values collection is really slow. I'm guessing it is an order-n operation that needs to iterate through items one by one, since the larger the index the longer it takes.


You probably want to use foreach instead (and hopefully the ValueCollection's iterator is a value type, to avoid unnecessary heap allocation)


In the little test I did, for a Dictionary of 10,000 items, this:


            for (int i = 0; i < blobs.Values.Count; i++)
                value += blobs.Values.ElementAt(i).a;
was more than a 1000x slower than this:
            foreach (Blob blob in blobs.Values)
                value += blob.a;



Just a FYI:


Dictionary, List, possibly a few others (except for Collection<T>) all have struct enumerators and explicitly implement the GetEnumerator() so the GetEnumerator that actually will be called in that foreach will return the struct enumerator and not do any boxing. 


With that said though, ElementAt is an extension method for IEnumerable<T> so the value collection is going to be treated as an IEnumerable<T> and the explicitly implemented GetEnumerator will be called, which means the struct enumerator will be boxed.

#5267841 Suggest a name for my game(15$)

Posted by on 24 December 2015 - 04:52 PM

For some reason while reading that description the phrase "Rock'em sock'em gangnam style" popped into my head. Not sure why.

#5259665 The model can't be showed completely when stl file exceeded 144MB.

Posted by on 29 October 2015 - 08:27 PM

Drake is right, you're hitting a limit with how big a single resource can be. Direct3D11 (guaranteed) limits can be found here. Direct3D10 had a 128 mb limit for vertex buffers, but I guess you can go higher in D3D11 depending on your hardware. SharpDX will follow these limits (think of it as a nearly 1-to-1 wrapper for the Direct3D libraries...all the documentation applies.


So split up the vertex data into two buffers and make two draw calls.

#5218172 proTile Map Editor 2 for Unity - released

Posted by on 21 March 2015 - 06:10 PM

Very cool!

#5208647 Alternatives to Wavefront Obj format for skinned models?

Posted by on 04 February 2015 - 10:34 AM

Collada (DAE) is another one that you can use. If you already have FBX models because you were using them in XNA, why not just use Assimp (.NET wrapper in my sig) to load them? It supports importing FBX model format now.

#5188303 Spritebatch With SharpDx

Posted by on 21 October 2014 - 08:01 AM

It looks like you're not specifying a Viewport to the device context. Aside from needing to define a viewport, SpriteBatch will internally use that to create a projection matrix as input for the sprite shader.

#5170410 will you buy this?

Posted by on 30 July 2014 - 12:41 PM

The problem is you're trying to write a one-size-fits all solution for an application. Not just a library that loads a model (like Assimp) but also gets it on the screen, so you're locking in users into how things are formatted and function. Basically you're offering a platform, which can be problematic if a user wants to do something different. And you aren't going to get buyers unless if there are a lot of features that sets it apart from free/open source competitors.


I think you'd do better if you wrote plugins (for profit) for an already established and mature platform. E.g. write something useful for Unity and sell that.

#5164373 How to transition into Game Dev with Java

Posted by on 02 July 2014 - 01:02 PM

Edit: Java is not a language to use for large scale 3D games. Attempting to render complex 3D shapes with texture mapping and lighting can bring your game to a screeching halt.

 (( Java is a perfectly fine language to use for 2D MMOs, and non graphic intensive 3D games ))


Eh, I wouldn't worry too much about "rendering complex 3D shapes and texture mapping and lighting", and so on as that's going to be hardware accelerated. It's not like your choice of language is going to greatly impact that.


The biggest pain point in my opinion is the lack of structs in Java. All your math "objects" are exactly that, objects allocated on the heap. So you're going to have to worry about allocations during updating/rendering (gotta be smart about it, e.g. extensive use of pooling). Then of course concerns about performance with a managed language where code is being JIT'ed on the fly. Certainly not going to get the performance of native in that regard, but that doesn't mean you can't do serious graphics programming. Far from it!


If you want a more comprehensive package, jMonkeyEngine is a good platform. I used to use it back in the day, but they've made some big strides the last time I used it (or used Java...heh I'm mainly a .NET developer and personally prefer using C# over Java and Direct3D over OpenGL, but that's me). It has a lot of stuff out of the box, so you may not be finding yourself right from the get go doing complex low-level stuff (or writing shaders).


But if you really want to learn graphics programming I would go with the low-level wrappers around OpenGL or Direct3D (although, are there any D3D wrappers out there for Java?) such as LWJGL. And like Glass said, search for "Modern OpenGL", e.g. programmable pipeline.... --> OpenGL Bible 6th Edition. There's a plethora of tutorials and material out there that use fixed function, which at this point is legacy, so it can be confusing and overwhelming when first starting.

#5144348 Is the era of C# for game programming gone?

Posted by on 04 April 2014 - 07:52 AM

And....apparently SIMD is coming to .NET:




Microsoft's new 64-bit JIT compiler....


Sweet jesus, I think I might faint from the excitement!

#5144154 c# loop

Posted by on 03 April 2014 - 11:34 AM

I disagree as well, google is a fine tool to answer such a question. Maybe take issue with the "let me google that for you", but honestly it's kind of annoying to see a post like this with a bunch of smileys, please help me I'm new, when you could very well have find the answer by googling the topic title alone.


Sometimes a great search tool however is useless when you don't know what to search for. So to that I say, a better question would be "Can the community recommend some good resources to learn C#?". The definition of a basic construct like a loop is going to be covered realitively early in a beginner's guide on programming. And to that, I answer:


The official Microsoft documentation on MSDN is always my first go-to resource. Mostly about framework API docs, but they also have programming guides and other resources, e.g the C# Programming Guide




If you prefer a book, C# in Depth by Jon Skeet sometimes gets referred:




I don't know if that's a right fit for an absolute beginner though, probably more for someone who knows programming but not C#, but there are a ton of tutorials (and other absolute beginner books) all a search result away.


Consequently, I used google for those links. But I knew what to search for ;)

#5144094 How to communicate between c++ and c#?

Posted by on 03 April 2014 - 07:58 AM



Use something like SWIG as Colin mentioned, it basically is automatically creating bindings for you. Personally I don't like added dependencies.


What dependency are you talking about? AFAIK swig does not add any runtime dependency to your bindings, it's just a tool that you can drop in your project folder, you can even invoke it automatically whenever you rebuild your c++ project and have always up to date bindings. (note that I only used swig for python bindings, not C#).



Sorry, meant a project dependency on a third party tool in general. Not runtime dependencies.

#5144078 How to communicate between c++ and c#?

Posted by on 03 April 2014 - 06:54 AM

Your options are pretty much:


1. Use something like SWIG as Colin mentioned, it basically is automatically creating bindings for you. Personally I don't like added project dependencies.


2. Use C++/CLI to talk directly between your core and your GUI platform. This isn't so bad, but does introduce essentially a third language with its own syntax that is different from C++ and C#. We do this at work (our apps are a blend between native and managed, and we have a lot of C++/CLI going on).


3. Write a C-API to essentially wrap your C++ objects, then use P/Invoke to call those. How much interaction is really going to go on between your core system and the GUI? A small C wrapper to call into probably is enough.


4. COM as DvDMan mentioned...which I wouldn't do for this, the above solutions in my opinion are more desirable.



Personally I'd go with #2 or #3 (leaning on the latter since it doesn't require learning anything new from what I presume you already know), if you wanted to write your core system in C++. But honestly, if I was doing this, both the core system and GUI would be all C#. E.g. use SharpDX for graphics.

#5134318 How to get good fast?

Posted by on 24 February 2014 - 09:53 PM

FYI I read the "its plain" as "its pain" lol. The road is painful in the sense of the amount of time and energy you need to spend on honing your skills. I too like the painter/craftsman parallel, as that's how I see software development in general. Something you hone over many years, and really never stop refining. There isn't anything "fast" about it.