Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 13 Oct 2004
Offline Last Active Jul 01 2015 03:35 PM

#5236804 Cut-Scene using Directx11

Posted by cozzie on 25 June 2015 - 02:27 PM

Here's an example that might help:


#5236756 sprintf

Posted by cozzie on 25 June 2015 - 10:49 AM

Or you could keep your printf (sprintf preferred) code and just do this:

char myText[100];
sprintf(..... Fill your text);
string myString = myText;

95% sure this works, have to check my code if it doesn't. Let me know

#5235822 How does games manage different resolutions?

Posted by cozzie on 20 June 2015 - 03:15 AM

I use directX and have the following "strategy":

- pick 6 (or any other number you want to support) resolutions you want to support
- when creating the settings menu for resolutions, I check these resolutions on the used hardware (the way MJP mentioned), only the supported ones are added and visible in the menu
- make your hud and especially the positioning of the individual elements scalable, based on the active resolution
- don't forget to recreate your buffers and projection matrix

You can check out the result in my recent game:

#5234579 Starting out - making sure I am doing it right

Posted by cozzie on 13 June 2015 - 01:58 AM

I always find the question which language to start with, a bit "double".
The advice could be to start with c#, knowing you want to eventually learn and use c++. If this is the case, why not start learning c++ from start, especially since they "look a like".

And of course welcome and good luck on your journey :)

#5234525 Code Management in a Project

Posted by cozzie on 12 June 2015 - 04:33 PM

- rule of three
- a class should have only one purpose (no 'GOD' classes)
- optimize only when you need to, not because you "think", profile first
- ...

#5234492 Cut-Scene using Directx11

Posted by cozzie on 12 June 2015 - 12:26 PM

Hi. The first thing you have to do is decide what type of cutscene you want:
- rendered/ animated realtime
- playing a pre-recorded video

If it's option 1, you could store a list of absolute positions/ rotations etc. For your objects and camera (or incremental if you like), and then "play" that realtime to get the needed cutscene.

If you go for option 2 you could google for more information, for example "ingame video d3d11". I know aaa games use bink for example, not sure if that also works for us "hobby developers".

#5234353 Window title bar not updating after fullscreen and back to windowed

Posted by cozzie on 11 June 2015 - 01:59 PM

Found it.

This is in my main loop:

				if(framesPassed == 60 && _mainApp.mD3d.mSettings.GetWindowed())
					std::wstring winText = _mainApp.mTimer.GetFpsString();
					if(_mainApp.mD3d.mSettings.GetVsync()) winText.append(L" - VSYNC enabled");
					else winText.append(L" - VSYNC disabled");
					SetWindowText(_mainApp.mD3d.GetHwnd(), winText.c_str());
					framesPassed = 0;

In the time the device switches from/ to fullscreen, more then 60 frames are passed, so the condition will never be met again.

The solution is simple, replace == 60 by >= 60.

#5233932 My first (static) library

Posted by cozzie on 09 June 2015 - 04:44 PM

Hi guys,
I've reached the point that I want to "freeze" my engine/ framework, so I can start using it to make tools and demo's using my engine. Just some advantages I see:

- clean application overview in visual studio (versus big number of headers and cpp files as part of my project)
- see if the framework is "complete" for using it, so making applications without changing the engine/ interfaces
- interchangable, library for all aplications that I'll make using my own engine

So far I've read and learned that it's better to start off with a static library, to prevent incompatibility issues with function and class interfaces etc.

So here I am.

Now I have a visual studio project that has both the engine/ framework in it as well as a small demo application. The engine/ framework is nicely structured by namespaces that make up the engine/ framework. All demo application (non-generic) code is outside these namespaces and in separate h/cpp files.

My question is basically, what should I look out for?

What I think I should do:
- make a copy of the visual studio project
- strip out out all non framework/ engine code, files etc.
(do I need a main function to be able to compile a library?)
- compile the project and see if all is ok
- if so, use the vs wizard to create the lib/ static library

- create a new test project, link the created lib and include the headers
- have more fun

Is it really this "simple" or am I overlooking stuff?
Any input is appreciated.

#5233419 It is better for performance to use a lot of rectangles or a lot of vectors?

Posted by cozzie on 07 June 2015 - 02:09 PM

Depends on too much factors. I'd say pick the one that codes the finest for you and see if you eventually get performance issues.

It's tempting to start giving pro's and cons for both, but then again this depends on tour goal (like, can you do everything you want easily with rects or do you want flexibility).

You could also go hybrid and use vectors + make your own struct for a rect, that makes things easier interchangable if you get into performance issues in the future.

#5233418 Texturing a Minecraft-style cube

Posted by cozzie on 07 June 2015 - 02:05 PM

As you're experimenting, say you don't create a very dense and interactive scene, you could also simply model the whole set of cubes in a modelling tool (i.e. Max or blender), and render the set of cubes just as 1 mesh.

This ofcourse depends on i.e.:
- do you want to transform the cubes individually / do they need their own transform and/or world orientation
- does your engine cull only full objects or also children
- another plus: if it's one texture you can do it all with 1 draw call, no setting matrices, textures and other shader constants

The advantage could be that you can map the cubes nicely with the modelling tool.

#5233311 Re-getting into C++ again

Posted by cozzie on 07 June 2015 - 02:43 AM

The red line in all replies is that you should just get out there and create stuff.
Start small, expand and learn along the way. Start using std::vector for dynamic memory allocation etc.

#5233310 Writing some OBB code?

Posted by cozzie on 07 June 2015 - 02:42 AM

Somefirst thoughts:
- you are multipying the absolute size (max - min) by 2.0
- I would pass the obj as const ref because the OBB should not accidentally make changes in the object (this probably has nothing to do with the issue, but is just cleaner/ safer)

#5233094 What should I do now that I implemented a game mechanic that is not popular a...

Posted by cozzie on 06 June 2015 - 02:30 AM

Hi. It depends, what's your goal?
If it's getting a wide as possible player base, I'd simply listen to them (if most of them give this feedback). If you're trying to build up to a new game and gathering experience, you might wanna continue as you do, and explain them why you're going this way.

There's no universal answer to choosing between listening to players and following your gut feeling.

#5232999 Engine design, global interfaces

Posted by cozzie on 05 June 2015 - 01:09 PM

My share; this might soudn stupid, but would a singleton be the same as a regular class for which you just create one object? If so, I'd say there's no problem to have classes like these, for example my engine has 1 shadermanager class object, same for the renderer and scenemanager class.

It's more than that. A singleton is a class which has boilerplate explicitly preventing more than a single instance from being instantiated or used.

Thanks, that clears things up for me. In that case I don't advice to use singletons based on that I've never used them and have no experience with them.

#5232989 Engine design, global interfaces

Posted by cozzie on 05 June 2015 - 12:30 PM

Keep it nice guys, let's assume everyone's here to help by giving their opinion and thoughts.

My share; this might soudn stupid, but would a singleton be the same as a regular class for which you just create one object? If so, I'd say there's no problem to have classes like these, for example my engine has 1 shadermanager class object, same for the renderer and scenemanager class.

On design, I agree with josh. My engine is basically set up like this:

- namespaces per main "part" of the engine/ framework (renderer, d3drenderer, IO, audio, input etc.)
- within these namespaces classes are defined
- I have one main app base class which has one instance of the renderer, scenemanager, input class etc. (the members of this class could also have been globals)
- per application that uses the engine, I inherit a class from the base bame class and go from there
- when one of the classes needs to use one of the others, I first try to get away with getting a const ref to the object and if really needed, a pointer (with write access)
- when designing, I try to figure out in which class another class could be a member, looking at "who" has to be able to change things and who shouldn't. For example, the d3drenderer class should never modify the scenemanager, just use it to retrieve what should be rendered, etc.

So basically also passing around pointers here (and const ref preferably if possible)