question on the architecture of the code

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • question on the architecture of the code

      hi,

      Im just curious since the current source code is built using DXUT and is using the dx 9 version of it.

      By looking at the code, it seems like it is very dependent on DXUT9 rendererer API, and thus upgrading or supporting a different version of DX or a diff API-OpenGL for example needs to modify all calls to to DXUT which can be found on more than one layer.

      My question, how can we modify the architecture or can you suggest some approach for easy flexibility to support diff graphics API like for example upgrading to DX 10?
    • RE: question on the architecture of the code

      Creating an architecture that makes DirectX replaceable with something else is certainly possible. First you have to create an abstraction layer that surrounds DirectX and provides an implentation independent API. Next you create implementation specific layers underneath that to call DirectX, OpenGL, or something more custom. Third, you create a system that lets you load those different implementations based on a user setting or some other deterministic switch.

      This is very similar to what DirectX does - create an abstraction layer for different hardware and creates a standard API so you can code once and not worry about whether the computer running the game has an ATI or Nvidia video card. The different video card companies create drivers that implement the DirectX API as best they can.

      The reason I didn't do that in the book is it creates additional complexity that a "training" game engine simply doesn't need.

      After all - could you imagine an extra two or three chapters in that book!
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • RE: question on the architecture of the code

      Originally posted by mrmike
      After all - could you imagine an extra two or three chapters in that book!


      Do I smell a 4th edition? Cause I'd LOVE to rewrite the AI chapter with more advanced topics! Utility-based AI, fuzzy logic, rule-based systems, influence maps, genetic algorithms.... What do you say?

      *ducks*

      -Rez
    • RE: question on the architecture of the code

      Hah you imight smell one - I was thinking mostly of updating the source code to be compatible with VS 2010, and DX10 without losing DX9 for any of those students or professionals still working in Windows XP.

      There are two people to convince - the publisher (which I've contacted), and my wife Robin - who just started shaking her fist at you!

      :)

      I'd like to clean up the initialization sequence to allow the network code to behave better, fix all the posted corrections, and perhaps improve the editor a bit.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • LOL - I haven't even heard from the publisher yet if an update is even a possibility....but even if that doesn't happen we can always update the code.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • I haven't really played with lambda expressions very much - but on Ultima VIII I think we actually added them to our scripting language. I think they ended up being verey useful.

      Not so sure about the syntax though - bleh - it made my eyes glaze over the same way they did when I first learned templates.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • I'm not really a huge fan of anything that obfuscates the code even more. Things like this can definitely be helpful in certain situations, but often I've found that developers use such tools to get around extra typing or just to look "smart". List comprehensions in Python are a good example. There are some places where it really makes sense and other places where it pretty much just serves the purpose of making your code incredibly awful to read. (Also, I hate Python....)

      Or take this real life example: When I was at Slipgate, one of the engineers (who was no longer there) would write these simple list iteration loops with all these unnecessary layers of abstraction. Instead of doing a basic for loop to iterate over the list and call a member function on the objects the list contained, he used the for_each() algorithm function passing in a functor object. The body of the for loop was ONE LINE, yet the code was like 20 lines of abstract garbage.

      I'm all for abstraction and sneaky little toys like this when they actually matter, but I've found those cases to be the rare exception.

      Just my two cents. ;)

      -Rez

      The post was edited 1 time, last by rezination ().

    • Amen brother. 90% of code doesn't have to brutal fast or efficient, but writing clearer (and slower) code helps the programming team move quickly and easily. Doing THAT will make your game better.
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • Oh man, I hope you have a comfortable chair....

      Yes, I hate Python. I hate untyped variables that are declared as they're defined, I hate list comprehensions (which are pretty much unreadable), I hate that it's not *really* supported by any editor I like, etc.

      But that's not the worst. I could forgive all of that... ALL of it if they didn't force whitespace as syntax. Epic fail. I will never forgive Python for that. And before anyone argues that it forces people to have the same style (a philosophy I disagree with) and makes the code more readable, I will point out that it DOESN'T make code more readable. It often does the OPPOSITE. The people I've met who love Python also tend to be the people who write the most obfuscated code I've ever had to deal with. I don't know if it's a culture thing left over from Perl (which had CONTESTS for obfuscated code), but it drives me nuts.
      bunny = n+R(p)*10/5+z # *facepalm*

      Still, programmers will always find ways to make their code completely unreadable so I guess I can't really blame that on Python. But for whatever reason, the average Python programmer I've met tends to write code I want to touch less than a turd lying in the street.

      And that's what Python is. <3

      [edit] Also, just a note to say that sometimes tone can get lost in text. Keep in mind that the above is born from the frustration of having to use a language I find excruciating. Most of my issues stem from the syntax and apparent culture of Python, not the core itself. I readily admit that it's the perfect tool for many tasks, I just don't want to have to code in it. ;)

      That having been said, guess what the gameplay language is for the project I'm going to?

      -Rez

      The post was edited 1 time, last by rezination ().

    • Whitespace isn't syntax, indentation is. Even then, it's only for defining blocks.

      It sounds like you guys in the games industry are abusing the hell out of poor Python.

      I don't use list comprehensions because they are indeed tough to read. They are really there to keep Lisp programmers happy, and I can't imagine you'd be happier if they were actually using Lisp instead of Python where you are.

      Anyway, I'm sorry you've had bad experiences with it, but there's no way I'm going back to C++ for personal projects.
      -Larrik Jaerico

      www.LarrikJ.com
    • I'm sure part of it is just the curmudgeon in me. I can't get over how broken my classes look with no physical closure. I also broke the build once when my tab-spaces were set up incorrectly. One of my friend actually programs Python like this:

      Source Code

      1. class SomeClass:
      2. def SomeFunction():
      3. something = 10
      4. #}
      5. #}


      As far as scripting languages go, the core of it is much better than something like Lua, which isn't particularly object oriented. I think it's a great little language... I just find it painful to code in.

      -Rez