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 de123
      Hi everyone, I'm trying to implement the displacement mapping technique by William Donnelly from GPU Gems 2: Chapter 8 for a project. I'm working in XNA/MonoGame and using HLSL for my shaders. The problem I'm having is how to create the distance map and I'm not really understanding how I would go in creating it. I know that Nvidia has released the code for that chapter but the files are in c++ and I'm not familiar with c++ so its been throwing me off on how to recreate it in c#. Any explanation on how I should go about in creating the distance map would be extremely helpful. Thanks for any help or suggestions.
    • By Gnollrunner
      I'm currently using Direct  X 11 for my procedural world/MMO project.  I've tried to find a freeish game engine or simply graphics engine that supports 64 bit coordinates (CPU side), but apparently there is no such animal.  Right now my investment in Direct X is very small as the vast majorly of the code is straight C++ and the graphics is isolated into an interface class. However now I'm going get more into the GPU stuff and I was wondering if it would be better to switch to something else that would give the program better portability.  I was leaning towards Vulkan for no other reason than it seems to be all the rage (ha, ha), but I wanted to get some opinions from folks with more GPU programming experience.
    • 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,


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!