Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualAndy474

Posted 24 June 2013 - 01:53 AM


If I have one million cubes, is it faster to draw them from one big list, or 20 smaller lists?

 

Neither, your still doing 1,000,000 draw calls wither way. what you need to-do is only draw them if they are onscreen and through the use of Culling or instancing.

 

 


Is there a method that can change how a texture looks depending on player color? For example, if player ones color is red, part of the texture will be red. I don't remember what the exact word for it is...maybe alpha blending or something like that.

 

No, Make one smile.png you will need to use RenderTargets to modify the texture. here is a snippet how to use a rendertarget:

 

RenderTarget2D target = new RenderTarger2D(...); 
//I cant remeber the arguments off the top of my head.
//I think its GraphicsDevice, Width, Height, GenerateMipmap, SurfaceFormat, Depthformat

GraphicsDevice.SetRenderTarget(target);
GraphicsDevice.Clear(Color.Black); //any colour will do
using(SpriteBatch b = new SpriteBatch(GraphicsDevice))
{
b.Begin();

//Draw anything here to draw onto a new texture E.g.
//Draw the Basic non-coloured texture
//Draw the players colour where we are supposed too.

b.End();
}

GraphicsDevice.SetRenderTarget(null);

//Then to access your new Texture, just do 
Texture newTexture = target; //Target inherits from Texture2D so no casting needed

 

 


In a multiplayer game, I'm assuming it's correct to create a camera for each player. Is this easiest to do through the player class?

 

Depends, Local multiplayer, E.g. on the same PC? s this the design you want? I would probally have 1 camera class (Singleton maybe?) which contained ALL the informatio

 

 


What's the difference between the LoadContent and Initialize method created for you? I use both of them while initializing variables, although I'm not really sure why

 

GraphicsDevice ... Initialize() ... is called just after the constructor, that's it. it is never called again until you create another instance of the class.

Whereas LoadContent<T>() ... is called on starup AND whenever the graphics device is Lost or Reset recovering your ingame assets.

 

This means that LoadContent is called when the Game Window is minimized and reopened, or something takes control of the screen (E.g. UAC) and everything run in loaded is run again, this means it is not a good idea to put any data initialization in here, as it will be "reset" when your device is reset / lost.


#1Andy474

Posted 24 June 2013 - 01:51 AM


If I have one million cubes, is it faster to draw them from one big list, or 20 smaller lists?

 

Neither, your still doing 1,000,000 draw calls wither way. what you need todo is only draw them if they are onscreen and through the use of Culling.

 


Is there a method that can change how a texture looks depending on player color? For example, if player ones color is red, part of the texture will be red. I don't remember what the exact word for it is...maybe alpha blending or something like that.

 

No, Make one :) you will need to use RenderTargets to modify the texture. 

 


In a multiplayer game, I'm assuming it's correct to create a camera for each player. Is this easiest to do through the player class?

 

Depends, Local multiplayer, E.g. on the same PC? s this the design you want? I would probally have 1 camera class (Singleton maybe?) which contained ALL the informatio

 


What's the difference between the LoadContent and Initialize method created for you? I use both of them while initializing variables, although I'm not really sure why

 

GraphicsDevice ... Initialize() ... is called just after the constructor, that's it. it is never called again until you create another instance of the class.

Whereas LoadContent<T>() ... is called on starup AND whenever the graphics device is Lost or Reset recovering your ingame assets.

 

This means that LoadContent is called when the Game Window is minimized and reopened, or something takes control of the screen (E.g. UAC) and everything run in loaded is run again, this means it is not a good idea to put any data initialization in here, as it will be "reset" when your device is reset / lost.


PARTNERS