Jump to content
  • Advertisement

Algorithm TDD and Simple Game Math



In this Blog Entry I will translate examples from the tutorial Math for Game Developers from C++ to C# and TypeScript. I will add unit tests to the examples.

I use:

C# and TypeScript are very similar. TS has: properties and generics. TS has keywords like C#: interface, abstract (for classes and methods). Author of C# and TS is Anders Hejlsberg

001. Character Movement (Points and Vectors)





Recommended Comments

Cool! I just bought one book about Maths in Game Development and your channel is very interesting.

Share this comment

Link to comment
4 hours ago, Gidrek said:

Cool! I just bought one book about Maths in Game Development

I just rewrite these simple examples from the Youtube Channel of that guy to C# and TypeScript for practice in math, programming, and TDD (writing unit tests). I think it is good to have everyday practice with math because human brain has a property to forget something that you do not use.

4 hours ago, Gidrek said:

I just bought one book about Maths in Game Development

I have a lot of book in eBook format. I study a few of them:

  • 2011 - 06 - Mathematics for 3D Game Programming and Computer Graphics - 3-rd edition - Eric Lengyel -> description
  • 2011 - 11 - 3D Math Primer for Graphics and Game Development - Dunn F., Parberry I -> description
  • 2013 - 04 - Physics for Game Developers - 2nd Edition - David M. Bourg, Bryan Bywalec -> description -> source code
  • 2014 - 05 - Physics for JavaScript Games, Animation, and Simulations - Adrian Dobre, Dev Ramtal -> description and code

And I study these lessons:

Theory is important but practice using programming is more important. I think it must be: 20% theory and 80% everyday practice.

Edited by 8Observer8

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Alexander Nazarov
      Hello. I'm pretty new in Unity and I wonder how and what should I use in Unity to create smooth and physics-like tile moving in my match-3 game?
      This is example of game, where tile movements are most attractive for me 
    • By phil67rpg
      well I am able to draw a hexagon but I want to draw a whole screen of hexagons. here is my working code
      private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen whitePen = new Pen(Color.White, 1); float height = 50.0f; float width = (float)(4 * (height / 2 / Math.Sqrt(3))); float y = height / 2; float x = 0; float row = 0.0f; y += row * height; float col = 0.0f; if (col % 2 == 1) { y += height / 2; } x += col * (width * 0.75f); PointF pt1 = new PointF(x, y); PointF pt2 = new PointF(x + width * 0.25f, y - height / 2); PointF pt3 = new PointF(x + width * 0.75f, y - height / 2); PointF pt4 = new PointF(x + width, y); PointF pt5 = new PointF(x + width * 0.75f, y + height / 2); PointF pt6 = new PointF(x + width * 0.25f, y + height / 2); g.DrawLine(whitePen, pt1, pt2); g.DrawLine(whitePen, pt2, pt3); g.DrawLine(whitePen, pt3, pt4); g.DrawLine(whitePen, pt4, pt5); g.DrawLine(whitePen, pt5, pt6); g.DrawLine(whitePen, pt6, pt1); whitePen.Dispose(); g.Dispose(); }  
    • By Josheir
      I am trying to visualize if the attached diagram of data of triangles is correct for the attached hill image.  I used a nested for loop to find all triangles with any vertices having a height greater than zero.  The two triangles marked with an X surprisingly have no height values and the shape of the triangles is odd to me.  The triangles marked with A are left triangles and the triangles marked with B are right triangles.  The rendering was done in OpenGL with C++, and the X coordinates and  Z coordinates are by convention.  
      The one point with a height is shown here:
      void addHillsManually() { heightMapFromArray[20][20] = .5; } Thank you,

    • By Gautti
      I have integrated the sqlite data base in slot game which is build in Unity platform for windows. It is increasing drastically although it has only text data., it is showing size about 1.5 GB which is very annoying  and which will affect to my game's performance. so how can I reduce size of Sqlite database ?
    • By Jernej.L
      I've attached a timing graph. the "debug" spikes are actual swapBuffers calls measured with hires performance timers, red line is "whole" 1 single frame time. 
      I cannot seem to be able to solve this mistery, so what would cause stutter / spikes when calling swapbuffers? This is on windows 10, amd gpu and all drivers installed correctly, i will greatly appreciate any kind of help. 


Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!