Quixo 3d game programming in net quixo3d ui
Download
1 / 26

Quixo 3D: Game Programming in .NET - PowerPoint PPT Presentation


  • 863 Views
  • Updated On :

Quixo 3D: Game Programming in .NET Quixo3D.UI. Mike Hodnick www.kindohm.com Jason Bock www.jasonbock.net Twin Cities Code Camp - October 27, 2007. On the docket…. [email protected] www.kindohm.com. Show the game Strategy for drawing the board Third party tools

Related searches for Quixo 3D: Game Programming in .NET

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Quixo 3D: Game Programming in .NET' - Sharon_Dale


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Quixo 3d game programming in net quixo3d ui l.jpg

Quixo 3D: Game Programming in .NETQuixo3D.UI

Mike Hodnick www.kindohm.com

Jason Bock www.jasonbock.net

Twin Cities Code Camp - October 27, 2007


On the docket l.jpg
On the docket…

[email protected]

www.kindohm.com

  • Show the game

  • Strategy for drawing the board

  • Third party tools

  • Strategy for game piece behavior

  • Neat features

  • Improvements

  • Giveaways…

National Quixo3D Team

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Show the game l.jpg
Show the game

demo

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Strategy for drawing the board l.jpg
Strategy for drawing the board

  • WPF App

  • Use WPF 3D features

  • Cube grid of game pieces

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Slide5 l.jpg

Y

4

3

2

1

0

X

2

3

4

0

1

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Slide6 l.jpg

Y

Piece Size = 1x1

X Translation = X CoordinateY Translation = Y Coordinate

4

3

2

1

0

X

2

3

4

0

1

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Slide7 l.jpg

Y

Piece Size = 1x1

X Translation = X Coordinate * X SpacingY Translation = Y Coordinate * Y Spacing

4

3

2

1

0

X

2

3

4

0

1

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Strategy for drawing the board8 l.jpg
Strategy for drawing the board

code

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Third party tools l.jpg
Third Party Tools

  • 3DTools

    • www.codeplex.com/3DTools

    • Trackball decorator

  • Petzold.Media3D

    • Charles Petzold (www.charlespetzold.com)

    • 3D model generation

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Using the trackball decorator l.jpg
Using the Trackball decorator

  • Reference the _3DTools CLR namespace in your XAML:

  • Wrap the Trackball around a Viewport3D in XAML:

xmlns:tools=“clr-namespace:_3DTools;assembly=3DTools”

<tools:TrackballDecorator> <Viewport3D /></tools:TrackballDecorator>

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Leveraging petzold media3d l.jpg
Leveraging Petzold.Media3D

  • CubeMesh

    • Creates a cube

    • Used to represent an empty game piece

  • TorusMesh

    • Creates a “donut”

    • Used to represent a placed “O” game piece

  • SolidText

    • Creates 3D text

    • Used to represent a placed “X” game piece

    • Used for axis labels

  • WirePath

    • Draws lines in 3D space

    • Used to outline a valid source piece

  • Cylinder

    • Used for X,Y,Z axes

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Petzold media3d l.jpg
Petzold.Media3D

code

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Strategy for game piece behavior l.jpg
Strategy for game piece behavior

  • GamePieceVisual class (GamePieceVisual:ModelVisual3D)

  • A composite visual model containing:

    • Cube mesh geometry

    • Torus mesh geometry

    • 3D Text visual model

    • Wireframe visual model

  • Changes appearance based on public properties:

    • Highlighted (mouse-overs)

    • IsValidSource (shows wireframe, indicates it can be clicked)

    • HighlightedAsValidSource (shows that you clicked it)

    • HighlightedAsValidDestination (shows you can click it)

    • PieceType (shows/hides the cube, torus, or text geometries/models)

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Game piece composite model challenges l.jpg
Game piece composite model challenges

  • Cube and torus are “geometries”

  • SolidText and wireframe are “visual models”

  • Hit testing when an empty or “O” piece is shown will result in the GamePieceVisual being returned

  • Hit testing when an “X” piece is shown will return a PlanarText object that is rendered by SolidText

  • Hit testing when the wireframe is shown will return a ModelVisual3D object.

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Slide15 l.jpg

GamePieceVisual : ModelVisual3D

Hit testing produces a ModelVisual3D!

Content

Children

Model3DGroup

xModel : ModelVisual3D

wireFrame: ModelVisual3D

emptyModel : GeometryModel3D

oModel : GeometryModel3D

When these visuals are shown, they themselves are the first ModelVisual3D objects found in the tree.

When these geometries are shown, GamePieceVisual is the first ModelVisual3D found up the tree.

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Gamepiecevisual hit testing code l.jpg
GamePieceVisual hit testing: code

code

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Gamepiecevisual ui effects l.jpg
GamePieceVisual UI Effects

  • Highlighting: change scale and color

  • Select as valid source or destination: change color

  • Show winning lines: change scale

  • System.Windows.Media.Animation.Animatable

    • Brush (SolidColorBrush)

    • ScaleTransform3D

  • Animation Types

    • DoubleAnimation

    • ColorAnimation

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Animation examples l.jpg
Animation examples

  • void AnimateBrushColor(SolidColorBrush brush)

  • {

    • Color startColor = Colors.Blue;

    • Color endColor = Colors.Red;

    • TimeSpan duration = TimeSpan.FromMilleseconds(200);

    • ColorAnimation animation = new ColorAnimation(startColor, endColor, duration);

    • brush.BeginAnimation(SolidColorBrush.ColorProperty, animation);

  • }

  • void AnimateScale(ScaleTransform3D scale)

  • {

    • double startScale = 1;

    • double endScale = 1.5;

    • TimeSpan duration = TimeSpan.FromSeconds(2);

    • DoubleAnimation animation = new DoubleAnimation(startScale, endScale, duration);

    • scale.BeginAnimation(ScaleTransform3D.ScaleXProperty, animation);

      • scale.BeginAnimation(ScaleTransform3D.ScaleYProperty, animation);

      • scale.BeginAnimation(ScaleTransform3D.ScaleZProperty, animation);

  • }

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Ui effects code l.jpg
UI Effects: code

code

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Neat features l.jpg
Neat Features

  • Move history data binding

  • Axes

  • Trackball enabling/disabling

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Future improvements l.jpg
Future Improvements

  • Make the game (framework, engine, UI, tests, etc.) size-agnostic

  • Create a Game class

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Future improvements22 l.jpg
Future Improvements

  • Algorithm optimizations

    • Parallel computations (FX/System.Concurrency?)

    • Trimming the tree

    • Opening book

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Future improvements23 l.jpg
Future Improvements

  • Algorithm optimizations (con’t)

    • Principal variation

    • Transposition tables

    • Iterative deepening

    • Evaluation improvements (genetic algorithms?)

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Future ui improvements l.jpg
Future UI Improvements

  • Multi-threading

  • Skinning and configuration

  • Use of dependency properties

  • VS 2005 vs. 2008

  • Board and piece representation

  • “Up direction”

  • Support “undo”

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Resources l.jpg
Resources

  • http://www.codeplex.com/3DTools

  • http://www.charlespetzold.com

  • http://www.kindohm.com/technical/toc.htm

  • http://rhizohm.net/irhetoric/

  • http://blogs.msdn.com/wpf3d/

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


Slide26 l.jpg

Quixo3D: Game Programming in .NET

Jason Bock – http://www.jasonbock.net

Mike Hodnick – http://www.kindohm.com

Quixo3D.UI - Twin Cities Code Camp - 2007.10.27


ad