Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

gdunbar

Member Since 22 Feb 2006
Offline Last Active May 21 2013 07:21 AM
-----

Posts I've Made

In Topic: How do you back up your stuff?

09 May 2013 - 03:55 PM

I use Mercurial to keep all of my source code and resources in. Once a week I make a .zip with everything in it and copy it to an external hard drive, and to Amazon Cloud drive. I'm sure I could do something fancier and more automatic. However, it really isn't much of an effort. I like that I understand exactly how my "backup system" works, and I'm confident that I could restore things easily.

 

Geoff


In Topic: Creating a class to load .x files

24 January 2013 - 01:19 PM

At the moment, D3DXLoadFromMeshX is returning D3DERR_INVALIDCALL, which means that my MeshObjectLoad() function returns false and the program halts/closes. The function succeeds though if I exchange 'renderdev' for 'd3ddev' which is my globally declared direct3d device.

 

Presumably you only have one DIRECT3DDEVICE9, correct? So the contents of renderdev and d3ddev should be the same. It is therefore suspicious that the function succeeds with one, but fails with the other. Look at the pointer values in the debugger. Are they the same? If not, why not?

 

If, on the other hand, you do have multiple DIRECT3DDEVICE9 objects, that probably isn't a good idea. Try using the same one everywhere. I would still pass it to your MeshObject constructor to avoid relying on global pointers, but don't create the device more than once.

 

Good luck!

Geoff


In Topic: Virtual still the bad way ?

16 November 2012 - 12:48 PM

OK, OK, maybe I went too far with "bedrock". "Indispensable", maybe? C++ certainly wouldn't be much of an object-oriented language without virtual functions!

In any case, my true point stands: Use virtual functions. Don't worry about it. Then, if at some point in the future you have performance issues or otherwise want to optimize performance, you should measure performance. In the event that you find that you are calling a virtual function in a tight loop or something, you should be able to target a fix there; it is _extremely_ unlikely any type of major architectural change will be needed. swiftcoder's method of moving the function call to surround the loop (instead of the other way) is certainly an excellent option.

Good luck,
Geoff

In Topic: Virtual still the bad way ?

14 November 2012 - 02:03 PM

Virtual functions are the bedrock of modern, object-oriented C++, and are unlikely to be a significant performance bottleneck on today's relatively fast processors. I recommend you proceed with using them. If at some point in the future, as a result of performance profiling, you do identify a virtual function or two that are slowing your code down (perhaps used very often in a tight loop), then address the problem locally at that time.

Good luck!
Geoff

In Topic: Lua integration into a game

14 September 2012 - 05:52 AM

A somewhat different perspective here. I use lua in my RPG, for scripting things like quests, conversations, etc. Every time I run a lua script, I actually create a whole new lua instance (by calling luaL_newstate(), luaL_openlibs(), luaL_loadstring(), and lua_pcall()). I implemented things this way at first because it was easy, with the intention that if performance was an issue, I could always go back and optimize.

To my pleasant surprise, the performance has been excellent, and no need to chance anything. I should note that I call scripts relatively rarely (a script won't be called every time through the game loop), and my scripts tend to be quite small and self-contained.

Hope that helps,
Geoff

PARTNERS