Difference between revisions of "Game Programming Class2"
(→SVN Checkout) |
(→Texture2D and SpriteBatches) |
||
Line 108: | Line 108: | ||
Understanding GameTime We'll revisit game time when we talk about performance profiling. | Understanding GameTime We'll revisit game time when we talk about performance profiling. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Homework== | ==Homework== |
Revision as of 14:32, 12 September 2016
Contents
Objectives
- Time corrected move bases on elapsed game time Monogame
- Vector2 for direction with and without magnitude
- Single responsibility principal for methods
Skills
- Get samples from SVN and Git
Fonts
free game fonts XNA Redistributable Font Pack
note this font pack is now included in XNA 4
SVN Checkout
All of the examples for this class and the basic game library we wil be building is in our SVN repo this week we'll practice checking out a folder from the repo.
Tools
- Ahnk SVN for Visual Studio http://visualstudiogallery.msdn.microsoft.com/E721D830-7664-4E02-8D03-933C3F1477F2
- TortoiseSVN http://tortoisesvn.net/
Repo for Fall 2016
Trunk : this contains all the old student work as well as my demos so you probably don't want this at least not quite yet
https://iam.colum.edu:8443/svn/GPMonogame3.5/trunk
Just the Jeff folder
https://iam.colum.edu:8443/svn/GPMonogame3.5/trunk/jeff
Demos Projects : this is the link to my demos in SVN
https://iam.colum.edu:8443/svn/GPMonogame3.5/trunk/jeff
tortoisesvn http://tortoisesvn.tigris.org/
ankhsvn http://ankhsvn.open.collab.net/
SNV checkout demo.
In the coming weeks we'll learn how to commit to the SNV. Until then all you need to know is how to checkout.
SVN ingnore git and GIT ignore SVN
http://stackoverflow.com/questions/21156065/how-to-locally-ignore-git-and-gitignore-in-a-svn-repo
http://stackoverflow.com/questions/821895/exclude-svn-folders-within-git
Monogame Structures
Game Class
The MonogameGame class has two private properties
- GraphicsDeviceManager graphics;
- ContentManager content;
Graphics for windows and xbox are 60 fps. XBOx supports NTSC resolutions (480i, 480p, 720p, 1080i and 1080p 1080p is only on newer hdmi models).
//the game constuctor can be used to set some graphics settings. graphics.PreferredBackBufferHeight = 768; graphics.PreferredBackBufferWidth = 1024; //graphics.PreferredBackBufferHeight = 1080; //graphics.PreferredBackBufferWidth = 1920; //graphics.IsFullScreen = true;
Graphics for Mobile Game is 30 fps and 480 x 800.
// Frame rate is 30 fps by default for Windows Phone.
TargetElapsedTime = TimeSpan.FromTicks(333333);
// Pre-autoscale settings.
graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 800;
- Declare SpriteBatch spriteBatch;
- Initialize()
- LoadContent()
- UnloadContent()
- Update(GameTime gameTime)
GameTime
FrameRate and GameTime
Time and Timespan
Example of update using GameTime to calculate elapsed time
Demo
- SimpleUpdateMovement : move with Keyboard
- SimpleUpdateMovementWGravity: simple gravity moves sprite down
- SimpleUpdateMovementWState: better movement show different types with state selector
- SimpleMovementJump: Very simple Jump and Gravity
Understanding GameTime We'll revisit game time when we talk about performance profiling.
Homework
- Interesting Movement Monogame : Create a Monogame project the uses keyboard input to move a sprite. The movement should be more interesting than linear up, down, left right. There are several examples of this in the SimpleUpdateMovementWState project. The sprite movement should be time corrected and frame rate independant.
- Gravity and or Jump with 2 sprites
- Start with SimpleUpdateMovementWGravity or SimpleMovementJump
- How many sprites can you draw?
- Can they have different controls?
- Can you use a class to make the code more organized?
Optional Reading
- Read Chapter 2 in XNA 3.0
- Read Chapter 4 in XNA 3.0 (yes we skipped 3 we'll come back)
Extra Bonus
http://advances.realtimerendering.com/s2016/Siggraph2016_idTech6.pdf