Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


JWalsh

Member Since 04 Feb 2002
Offline Last Active Aug 26 2014 02:09 PM

#5122654 The most innovative development in First Person Play I've ever seen...

Posted by JWalsh on 10 January 2014 - 12:51 PM

Indeed. Another interesting take on this was from the 2012 DigiPen student project "Perspective". It's a 2D platformer, however you can rotate the camera and zoom in and out in order to change perspective. This allowed you to solve puzzles such as jumping over too large of gaps, or climbing under too small of walls just by changing the perspective.

 




#5066196 Is GLM fast enough for games?

Posted by JWalsh on 30 May 2013 - 11:54 AM

In your original post you asked about compatibility issues between GLM and Direct3D. If you're going to be using Direct3D for your graphics, just use DirectXMathfor your math library.

 

DirectXMath is the public version of XNA Math - the math library that's part of the Xbox 360 Dev Kit (XDK) used by game companies to develop Xbox 360 games. It already utilizes SSE and SSE2 instructions and is about as fast as you can get.

 

Cheers and good luck!




#5066189 Starting C#

Posted by JWalsh on 30 May 2013 - 11:38 AM

I find that all books on C# say about the same thing, as the language is well defined. The "information" is the same regardless of which book you read, it's just a matter of how the individual book presents it. With that in mind, it's often best to go straight to the source. Here are some informational links and online course which should hold the answers to all your questions. The first is the course, the second link is the homepage to the MVA course, and then the links get more and more technical from there, ending with the C# specification. It's the most terse to read, but there's no better authority than the language spec itself. And of course, as you learn more about C#, feel free to post your questions here and the community will be happy to answer your questions.

 

Programming in C# JumpStart (a MVA course)

C# Virtual Academy

C# Programming Guide

C# Developer Center

C# Reference

C# Specificiation




#4969894 Debugging (managed) DX11

Posted by JWalsh on 15 August 2012 - 12:22 PM

<br />What is this, an advertisement for WinDbg? I know what it does, I don't need you to start throwing random commands at me.<br />


No. It's not an advertisement. It was my validation for why I think WinDbg is the best tool for doing low-level debugging of .NET. It was no more an advertisement than your mentioning ANTS or dotTrace. The commands weren't for you, I wrongly assumed you were an expert at WinDbg and didn't need them. The commands are for any readers who want to research why WinDbg is so powerful.

<br />I'm glad you get some weird orgasmic glow when using it...<br />


It amazes me how, in spite of how small the industry is, people still feel like it makes sense to treat others with disrespect. Rather than being a douche, why not say "interesting... you seem to feel this tool is very powerful, and you work closely with some of the original .NET developers, perhaps there's something I may be missing." But instead, you jump right to "that's ridiculous". I guess your perspective changes with age and experience. /sigh


#4969743 Debugging (managed) DX11

Posted by JWalsh on 14 August 2012 - 11:41 PM

Using WinDbg here is overkill, and claiming that it's the "only good way to view the garbage collected heap" is a little ridiculous;


You don't really know if it's overkill. At this point we don't know what exactly he's trying to do. DebugView works great if he's just wanting to see the Debug messages, but if he wants to set breakpoints, step, make changes to memory, etc... he's back to needing a debugger.

My aim was to point out the WinDBG is better at debugging certain problems than Visual Studio (and other tools). It's all about using the right tool for the job. If you're not particularly fond of WinDBG's !DumpHeap or !EEHeap commands, that's cool. You're entitled to think my opinion is ridiculous.

But I say that WinDBG is the only good way because WinDBG has tons of support for working with the heap. Being able to see how much memory is in each generation, where the pages start and end, being able to see how many objects of each type are in the heap (and where), and cross-reference them to see how much memory is being used by each and in total. Additionally, you can evaluate the class table for each type, etc... Heck, you can even investigate the LOH. And that's not to speak of any of WinDBG's other great commands. !Analyze, DumpStack, EEStack, DO, GCRoot, etc... I never feel more in control of the run-time and what it's up to than when using WinDBG. If you know of another tools that gives you that, I'm more than happy to change my perspective.

there are plenty of excellent tools available that can visualize the GC heap in a much more intuitive fashion than WinDbg.


I honestly haven't ever seen one, but would love some recommendations. I'm always interested in learning about new tools. Mark's tools are fantastic.


#4969735 Debugging (managed) DX11

Posted by JWalsh on 14 August 2012 - 11:06 PM

Hey Shane,

I see what you mean about not supporting mixed mode debugging. With the DX debug mode enabled, are you still seeing debug output in the output console? what do the exceptions look like that you're receiving?

Also, you may try installing Visual C++ 2010 Express edition. Having both on your machine may give you more options. When an exception is thrown, you may just try attaching with the Visual C++ Native debugger if you can.

And if all else fails, there is WinDBG. It's a difficult, somewhat cumbersome tool to learn to use (especially with managed code as it requires using the SOS extension), but is by far the most powerful debugger in the world. It is in fact the only good way to view the garbage collected heap for your application while running.


#4966388 Deferred rendering tutorials for DirectX 11?

Posted by JWalsh on 05 August 2012 - 10:11 AM

You're right. I don't see a lot of examples online. I'll add deferred shading with DirectX 11 to my list of upcoming tutorials.

Cheers!


#4966192 Struggling With Rotations

Posted by JWalsh on 04 August 2012 - 04:09 PM

That makes sense, so where should I put the responsibility of inversing everything? Should Object automatically inverse everything or should I change the way my camera works?


As I said before, it appears as though the problem is correcting itself. Even though you're calculating the world transform of the camera, you're not actually using that to build a matrix for the view transform. Instead, you're using the gluLookAt function, which should calculate the correct inverse view matrix.

So another possibility is the multiplication order. gluLookAt post-multiplies the matrices it works on. So you need to make sure you're calling your camera::Transform() as soon as you load the ModelView matrix and set it to the identity matrix. If you set the world matrix of your model first, then multiply it by the view matrix second, this will have the effect of multiplying it by the transpose of the view matrix, which will also invert it.

In what order do you actually set the matrices?


#4966157 Struggling With Rotations

Posted by JWalsh on 04 August 2012 - 12:46 PM

Hi Rarge,

It appears you're trying to use your Object's calculateDirections method to calculate the directions of your camera. This doesn't actually work.

The purpose of an object's transformation matrix (and thus Right/Forward vectors), is to figure out its orientation in the world, relative to the root of the world. Given that, your calculateDirections method appears correct.

The purpose of a camera's transformation matrix is not to locate the camera in the world, but to transform other objects into camera space. To do that, you actually need the inverse of the camera's matrix. Think about it this way, if I move my camera to the right, relative to the camera, everything else moved left. Similarly if I move my camera in the -Z direction to get closer to my objects, it's as if they moved in the +Z direction to get closer to my camera.

You're using the gluLookAt method to actually set the View Matrix, which calculates the view matrix for you correctly, however the fact that SetTarget uses the forward vector which is going to be computed backward is a likely area of concern.


#4965733 DirectX11 which programming language?

Posted by JWalsh on 02 August 2012 - 09:04 PM

it's obvious that C# gives you more tools out of the box (bigger standard library) and it requires far less programmer skill to use correctly.


Agree with everything but the last part of this line. It gives you more tools out of the box, but the tools don't necessarily require less skill to use. Like any trade, it takes a certain amount of knowledge/skill to know which is the proper tool at the proper time, and with more tools comes a greater need for discrimination.

I really like the carpentry analogy. With C++ you're building a house one 2x4 at a time. With C#, you're given a collection of frames, joists, and maybe even a pre-built ceiling. Heck, you might even be given pre-made cabinets. But it doesn't mean you don't need to know how to use a hammer. It makes the process easier, faster, and more enjoyable, but if you don't measure carefully, haven't engineered a proper blue-print to begin with, or if you're over-zealous with your cutting tools, you can still end up with a fragile, expensive, and/or unattractive final project.

Ultimately, the language you use is the least important element of software engineering. So if one language makes the least significant part a little easier, it doesn't really say much about a person's overall capabilities as an architect or problem solver.


#4965666 So I want to be a game developer....

Posted by JWalsh on 02 August 2012 - 04:54 PM

Originally you had suggested I use Unity to make pong next and then move to more complicated XNA 2D games. Do you still think that's a good idea? Or should I stick with XNA after pong and try to make a more complicated 2D game before using Unity all together? Should I spend a good amount of time in 2D, or should I try and jump after completing ... say a clone of an older "arcade" type game?


I do not recommend using Unity for any 2D games. I recommend using XNA to do your 2D stuff, then move on to Unity and do some 3D games when you've mastered 2D, feel very comfortable in C#, and are able to get your hands on 3D artwork.

Haha this is where I start to feel hope, and then I become a little overwhelmed. I honestly have no idea how that step happens. What do I have to do to make that jump? It seems huge. The biggest as an outsider looking in at least. I figure I'd learn a little about it by using Unity, so it won't be such a shock?


You do it slowly. When you're making your own 2D games with XNA you'll just be using the SpriteBatch class, so there's no real "graphics" programming involved. But you'll still need to handle user input, playing sound effects, and basic 2D collision detection. All of which there is plenty of documentation & tutorials for. When you move on to 3D and Unity you'll learn about the 3D environment, place sound points, identify collision shapes & boundaries, etc... all of which will be a stepping stone to the next part of your learning.

The transition to developing your own engine will come once you're fairly comfortable with many of the game areas already. You'll know when it's time. It'll be when you're complaining about the limitations of the current system you're using.

So if I understand it correctly, XNA is still doing some sort of background setup even though I basically am righting my own engine? So now I'm doing the full setup at this step?


Yep. XNA is still hiding a lot of the startup & shutdown code required when using DirectX. This also happens to be when a lot of the advanced configuration happens. But even more than that, since it's based on DirectX 9, it doesn't support geometry shaders, any of the DX 10 tessellation stuff, generalized processing of vectorized data by the GPU, support for multi-threaded rendering, and several other features. Basically, XNA exposes the subset of functionality common between DirectX 9c on the PC, and that which was made available to managed programmers on the Xbox 360. But the Xbox 360 is 6 years old now, and DirectX on the PC has evolved quite a bit since then.

This final step is just me and notepad basically? I am writing native C++ and using DirectX?


Haha, not quite. The final step is using native C++ with Visual C++ or another compiler and DirectX 11.1. Most people begin by writing their own tool set, like their own world builder so they have a way to place objects in the world. So in summary, by the time you get to the last stage, you'll be making your own Unity.

I'll make sure I put it on here right away for feedback!


Great!


#4965626 So I want to be a game developer....

Posted by JWalsh on 02 August 2012 - 01:28 PM

JWalsh, hopefully you still follow this thread or will see this but I have a few more questions for you.


I am, but you can always send me a PM. :)

I'm currently finishing up my summer internship and because of downtime and completing a project faster than expected I'm basically killing time. We have access to Visual Studio C++ so I decided to hammer through my first big 700 page C book. I'm about 3/4 of the way through, and will most likely power through and finish it within today and the 8 hours I have tomorrow.


Fantastic! Nice work. Note, all of the Visual languages (VC++, VC#, and VB) are available as Express Editions from Microsoft and are free to download. Also, Visual Studio 2012 is currently in beta and is available to download to test - even the Ultimate Edition. Also, the Express Editions of 2012 will be available for free in August.

I'm hearing from a lot of people that I should spend a good amount of time with the Win32 API before I tackle the DirectX API. Is this true?


No. The Win32 API is the native ASM/C (not C++) framework Microsoft used to build Win95+, though many of the frameworks that exist today still use it "under-the-hood". Which is to stay, they still listen for Win32 events, and they still handle the Win32 message pump. However, the Win32 API is not object-oriented, not easy to read, and full understanding is only important if you're interested in knowing the Windows UI at a very deep level. Most programmers today either use WPF, which doesn't require knowing the Win32 API at all, or WinForms, which only requires knowing parts of the Win32 API for advanced functionality. There's no reason to dive into the Win32 API right away. Save that for when you've mastered your current needs and are ready to go more advanced.

Can you explain a little more about step 4 where you reference the wrapper around DirectX that you suggested?


Sure, but bear with me while I take you there in a fun, roundabout way... If you've been learning C# and making some 2D games with XNA for a while, at some point you'll decide you're ready to move on to 3D. At which point, moving on to Unity is a great suggestion, because it lets you get familiar with the "rules" of working in 3D, without having to worry about the complex math involved in performing 3D collision detection or 3D rendering.

But, at some point you'll have mastered that as well and really want to get into the guts of 3D, so to speak. At which point you can pick up 3D rendering in XNA. With XNA, you'll be doing the 3D transformations and collision detection yourself, as there's no "engine" to do it for you. You'll be responsible for implementing each of the primary areas of game development yourself: graphics, audio, input, AI, physics & animation, I/O, etc...You'll be writing your own Real-Time Shaders for the GPU, and you'll be doing the complex math yourself. But, you'll be doing them with XNA. XNA is a managed wrapper around DirectX 9c, and only exposes a limited amount of functionality. Granted, it exposes 90% of the best functionality, but there are still things that it hides from you and things you cannot do. Not least of which is that we're now on DirectX 11.1. XNA doesn't allow you to interact with anything newer than DirectX 9c.

So... at some point you may decide you don't want XNA around to do all the device setup and stuff for you. You want complete control over your hardware, and you want to do so using DirectX 11. At which point, SlimDX and SharpDX (I recommend SharpDX), are light-weight wrappers and/or bindings to the native DirectX 11 API's. This allows you to continue using C#, but to have access to all the interfaces, structs, and enumerations which are used by C++ programmers when writing native DirectX applications. At this point, all the tutorials for creating devices, setting up shaders & effects, accessing and using surfaces, etc.. will all be valid. You'll just be doing it in a different language with slightly different names.

Finally, you may get around to the point where your games are as technically capable as they're going to be. You've maxed out the GPU entirely, and your games are now shifting their logic to the CPU. This generally means you're doing complex physics and/or intersection testing, AI, path-finding, etc... At which point, you'll need to move away from C# w/ Managed DirectX wrappers, and into the world of native C++ with COM-based DirectX. At this point, you're essentially a Jr. Programmer in the game industry.

I took you in this roundabout method because I wanted to stress the importance of doing this in phases. When you are ready to be using managed wrappers around DirectX 11, you'll already know what it means and how to do it. :)

At home I've started a book on XNA, and so far I am understanding the basics. I understand the game loop, why it makes sense and how basic 2D sprites sheets work along with moving graphics around the screen. Hopefully I can make pong in XNA in a week or so when I have time. I don't see it as being too challenging, but a milestone and "completed" "game" none the less.


Absolutely! Pong is a great way to start, and I look forward to playing your Pong game.


#4965615 DirectX11 which programming language?

Posted by JWalsh on 02 August 2012 - 12:49 PM

I do have a question though. Why is C# a "productivity language"? I've searched a bit and read couple threads on stack overflow but haven't found huge advantages in using C# over let's say C++ & QT. I've been programming with C++ for a loooong time now. Why should I pick up C# to further my productivity?


Two reasons:

1. The language itself has many features that makes it easier to be productive. You can do more with less lines of code, and the code that you do have to write tends to be less repetitive and more direct. Simplicity and elegance have been major design goals throughout the lifetime of the language. As a result, it's just easier and more enjoyable to use C# than C++. I always find it a little tedious having to go back to C++.

2. The ability to access the .NET Framework Library and all of the related frameworks means a whole lot of code is written for you when using C#. If you just look at some of the namespaces of the .NET Framework Library there is MS Build integration, all the container classes, language generation, SQL Server bindings, OO wrappers around Win32 API Library Functions, CodeDOM, Diagnostics, Drawing, Enterprise Services, IO, Isolated Storage, Ports, Media, Messaging, Network programming, Reflection, RPC, Security, Authentication, Cryptography, Threading, Transactions, XML parsers & Serializers, XPath queries, and tons of Web stuff: Complete HTTP engines, Email classes, various protocols, etc...

In addition to all the basic classes in the .NET Framework Library you also have WinForms for creating GUI Windows applications, WPF, WF, WCF, and ASP.NET.

So I guess the better question is, when you want to write a complex Windows Application with multiple windows, tab controls, tree controls, animations, etc... How do you do it in C++? Likewise, if I asked you to create a database application that made connections to multiple databases, performed transacted queries against the databases and displayed results in a GUI application, how would you go about doing it? How about, write a GUI application that lets you enter in the email address of multiple people, subject, and a message body and then send the message out to all the people in the email list in formatted HTML over TLS secured SMTP?

Most of these things would make the average C++ programmer shiver. At the very least they'd be searching the interwebs for available libraries, and at worst they'd be looking for RFCs on protocols to begin implementing them themselves. In C#, the above programs range from a couple dozen lines of code to a couple hundred (maybe some in the low thousands), because most of the boilerplate stuff is done for you. It's literally half a dozen lines of code or less to open a database connection to SQL database and make a query. The support provided to programmers to develop "every-day" applications is just amazing to me.


#4965250 Dynamically hiding walls that block the camera

Posted by JWalsh on 01 August 2012 - 11:14 AM

This can be done in a couple of different ways.

1. You can do as Radikalizm stated above. You can cast a ray or some kind of bounding volume into your scene that encompasses your character model. Any models or meshes that intersect this primitive can then be disabled during draw call, or drawn with a special alpha shader that causes it to be partially transparent.

2. If you want to avoid doing any kind of ray casting and/or collision detection a more naive method is to transform your on-screen objects into screen space. Then, any object which are within a certain radius from the center of the screen can be alpha blended. This can be done on a per-vertex basis (hiding certain primitives), or even on a per-pixel basis. In truth, since you know your character is always within the 1/4 middle of the screen, you can just add code to your pixel shader to return a fully transparent pixel if the pixel coordinate is in the inner circle of the screen.

3. And yet a third way is to leverage the stencil buffer. Either using a circular stencil, or the character model as a stencil itself, you can either prevent the drawing of pixels which are over the stencil, or instead draw a red shape where your stencil is. This has the effect of not hiding objects in the foreground, but instead making it obvious where your character is behind the object. If I recall correctly, this was done very well in Torchlight.

Cheers and Good Luck!


#4965222 DirectX11 which programming language?

Posted by JWalsh on 01 August 2012 - 09:24 AM

It clearly shows that c++ is faster in the most of cases.


If you pay special attention to the actual code being used, you'll see that he's intentionally using the slowest parts of C#, vs. the fastest parts of C++, even writing his own HashTable class when the C++ STL version is too slow for him. He's also not doing any dynamic memory allocation as part of his tests, which happens to be the part where C# shines. The end result is his tests are too narrowly defined to simulate any real application, and his choice of implementation suggests a specific goal of proving that C# is slower. I wouldn't view this as a legitimate benchmark.




PARTNERS