Object Oriented thinking in game development

Object oriented thinking is a way of modelling real world. Objects have attributes and methods. Attributes are variables. There are different kinds of variables and they always have a type. Different types can be, for example, integer, float, double, string and character. I am talking about Java now which is very good programming language for explaining object oriented thinking. Methods are functions of the object.

So different object can have values, such as Person would have height, weight, age and name. Height, weight and age can be numbers and name is a string or combination of characters. For a role playing game you could a Monster that has values like strength and chance to hit for determining if player is hit and how much damage does the player get.

When there’s types of enemies in our little game they have these basic abilities. So we must create instances of classes to generate more enemies that are of the same type. There are many enemies of a type, for example “ghost” or “zombie”. Player can also have abilities like health, armor class and so on. We can build worlds in thinking like this.

To build a game you need many other things than just object oriented programming. You need textures, 3d-models, sounds, music. and logic for the game to exist. So you can begin programming with Java but you must understand that it is a tool that can be used to create something. Plain Java doesn’t do so much. I have programmed a text adventure game. I still think it’s not a full game. It’s more like piece of code that gives you some output for your input. If you are interested in creating games, rather than playing them, I think you should sharpen your skills inside Blender, Unity and graphics design. And these aren’t only tools there can be.

Social media & sharing icons powered by UltimatelySocial