Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

172 Neutral

About Treb

  • Rank
  1. Treb

    lua dofile issue

    I might try passing the full directory just to be sure that it isn't an issue with the relative directory. Other than that I'm not sure what would be wrong. I've used this function and it worked fine. edit: Also are you getting any error codes?
  2. Treb

    resource manager template

    My ResourceManager also uses reference counting, but I just use shared_ptr internally so that it can do the ref counting for me. This makes life easy. You can give shared_ptr a function to call when the ref count hits 0 in its alternate constructor.
  3. Treb

    Best Languages to start with?

    I don't recommend Java either. C# would be good, or even flat C would be better than C++. Going from C to C++ would be a smoother transition than jumping straight into C++.
  4. Treb

    Machine code?

    The book CODE the hidden language of computer hardware and software talks about machine language in addition to how logic gates are made. It doesn't talk about X86 assembly, so if you actually plan to write that you may want a different book. Assembly language directly translates into machine language. It's not very useful anymore as optimizers are so powerful.
  5. Treb

    Handling layered music

    I'm not sure how it was done back in the day, but I've been implementing FMOD Designer into our game and it will be capable of doing this. FMOD Designer is a program where you specify complex audio events, then the programmer loads in the Designer project and can start events by name and interact with them using parameters. You could have a parameter that controlled which track to play. ex. 0.0 = play track1 0.5 = mix tracks 1.0 = play track2 FMOD takes care of syncing up the audio, and the FMOD Designer program makes it easy to compose these events. Honestly I think that Designer has actually been easier to integrate with our program then a normal sound interface would be. So much of the customizing is controlled by FMOD Designer that I don't have to worry about having any in my sound engine.
  6. Treb

    Game engine design questions

    My engine is built for a team of 6 (4 programmers 1 designer 1 artist) for school. It's probably overbuilt for what you need, but I'll tell you what I did as it is working well for us. 1. Encapsulation I provide a scripting language within HLSL based off of Microsoft's SAS, and the language used withing NVidia's Shader Composer. This has hidden basic render target manipulation. Other than this it is hard to hide low level API functions. Using them is the only way to write the fastest code, and that's what we need for Graphics. The Graphics card hinders good architecture. Of course there is an interface for creating mesh that is easy to use for designers and non graphics programmers. I have what I consider a "core engine". This is comprised of: System Manager. Game Object Manager. Message Manager. Resource Manager. Output Manager(assertions, printing, perf timing). Serializer. Math Library. I do not allow these to be changed. They can be extended slightly, but the core of the engine is reliant upon them. In the non-core parts of my engine I have my systems: Audio Graphics Gameplay Input Physics They do not know about each other and communicate using messages and game objects. These can be customized however the programmer wishes. 2. Design Patterns The singleton pattern is horrible. I do use it, but with extreme caution. I prefer globals (also horrible, but they don't hide it). The primary issue I have with both is that it is impossible to guarantee order of deletion. I think having a singleton Application class is one of the few acceptable uses of singletons (given that there is only one Application). 3. Engine Subsystems I store all my systems within the system manager, it serializes, initializes, and updates them. scoped_ptr< OutputHandler > ohandler( new OutputHandler() ); g_outputHandler = ohandler.get(); SystemManager systems; Input input; Graphics graphics; Gameplay game; Physics physics; systems.AddSystem( input ); systems.AddSystem( game ); systems.AddSystem( physics ); systems.AddSystem( graphics ); systems.Run(); The whole GLUT thing is somewhat of a concern. It's been a while since I last used GLUT, but if I remember correctly you give it input callback functions. When Graphics initializes I would have it get input and set those callbacks. This is not an awesome answer because really Graphics shouldn't know about Input, but nothing is perfect when it comes to low level matters ( DX intercepts the windows message loop :P ). Still try to make is so that input could be switched out without changing Graphics. 4. What to put into the engine? What to script? Lua is good, but I do not use it for configuration purposes. We only use it for event callbacks, AI, and other game design material. ex. OnCollision OnCreation OnDestruction OnThisMessageBeingSentToThisPerson OnThisButtonDown OnXXX Lua can queue a message to be sent in X ms to give itself update capacity. Though Lua can be used for data entry I chose not to do this. I use XML and binary. We compose our files in XML, and they are compiled to binary for faster loading. The primary reason for this is that the level editor will be used for most content and it can easily output to XML or binary. That's a quick skim of what I did. Not perfect but my team seems to be fine with it, and that is all I can ask for. edit: fixed a few grammar things. Probably still hard to read though, sorry. [Edited by - Treb on August 6, 2010 4:53:01 PM]
  7. You didn't include handles. Most of the time they are used to achieve garbage collecting, but they can be used for other areas as well. I use handles for game objects. I could have every GameObject be a weak_ptr with one shared_ptr in the GameObjectManager. Then when I wanted to destroy the object the shared_ptr would be removed deleting the object. But imo this is just tedious, that strategy was used on my last project and I didn't like it. Then I use ref counting for resources so I can share a texture and know when everyone is done using it. Outside of this I have found little use for ref counting. I use boost::scoped_ptr and std::auto_ptr for RAII, but I rarely encounter a need for boost::shared_ptr. I would likely fall under Mix. Quote:the newbie may get confused when to use Raw and when to use RC. The only con here is that there is a newbie programming. Making code overly protective from inexperienced programmers only makes it convoluted and illegible, which doesn't help them (speaking from experience). Quote:And further more, messy up the system with mixed object management? Maybe, but like containers there is no single management solution for all situations.
  8. Treb

    Compile time signed shift?

    You are going to need template metaprogramming to ensure this is forced to compile time. template< int i, typename True, typename False > struct StaticIf { typedef True type; }; template< typename True, typename False > struct StaticIf< false, True, False > { typedef False type; }; template< int I > struct Value { enum{value=I}; }; template < int A, int B, int X > struct StaticShift { enum{ value = StaticIf< ( A < B ), Value< ( X << (B - A) ) >, StaticIf< ( A > B ), Value< ( X >> (A - B) ) >, Value< X > >::type >::type::value }; }; int main( ) { cout<<StaticShift<2,1,4>::value;//returns 2 return 0; } I have to jog to school I can explain this later if you want. You also may want to test it some more.
  9. Treb

    std::vector and other containers

    Interesting article on deque here Other than that the only other container I've used is list, and very rarely for reasons stated above. I also use tr1::unordered_map quite often.
  10. Treb

    Using pure directx 10 or not?

    There's nothing to stop you from writing your own DX10 wrapper or engine. For a large project you are going to want to deal with DX through a wrapper.
  11. IDs are nearly necessary in lock free multithreading as stated. They are also useful when you want to store entities in a variety of data structures. For example you may want entities organized in one fashion for quick render culling, and then in a different data structure for quick collision culling. These two data structures must have an ID system for them to communicate.
  12. Treb

    Poll Results [3.10.09 - 3.16.09]

    If you are working into the wee hours of the night, that probably means you are on a roll so that could be another way to view the results.
  13. If you disable conversion from int to enum, a way to generate a random enum would be nice. I second bit flag enums. I would take a look at Java enums, they're just classes so you can have fields and methods for them which can be useful.
  14. Treb

    3D collision at fast speeds

    There are a couple ways. You could iterate, so in the same frame move and test the sword multiple times. You could make a triangle out of the swing and test that. It may be worth your money to look into a collision detection book. I own Real Time Collision Detecting by Chris Erikson and it was well worth the cost. The easiest approach would probably be to iterate.
  15. Treb

    Singletons in Java

    She sounds about right to me. Nobody will disagree that singleton should be used with caution, but few will say never to use it. Part of the reason it is bad is because it is almost too useful, I have caught myself trying using singletons to smooth over deeper problems with program design. This approach is only a temporary fix and will backfire eventually. I use singletons in my program for "state" classes, used to represent the behavior single state in a finite state machine. These classes are just methods so I don't ever need more than one, and so they get to be singletons.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!