Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options answers only user 21890

Object-oriented programming. A paradigm using objects (instances of a class consisting of properties and methods) to design games. Techniques may include data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.

17
votes
As long as you keep your system relatively simple, this should work. But when you add things like temporary skill modifiers, you will soon see a lot of duplicate code. You will also run into problems …
answered Mar 19 '14 by Philipp
5
votes
A rule of thumb is that you use different classes when objects require different code and instances of the same class when the objects only require different values. So when ShortBow, HuntingBow, Com …
answered May 25 '16 by Philipp
12
votes
difference between object-oriented programming and procedural programming is how you treat your data. In OOP, data is smart. It manages and manipulates itself. But in procedural programming, data is dumb …
answered Feb 7 '14 by Philipp
1
vote
You are only presenting a very narrow view on your whole object hierarchy, but usually you have one object, let's call its class GameState, which in turn is a composite of all other objects that are c …
answered Jul 1 '13 by Philipp
5
votes
In object-oriented programming, you expose private data with getter-methods. When your player-class wants to know the terrain-type of a tile, it would call level.getTerrain(int x, int y). That public …
answered Nov 28 '13 by Philipp
-1
votes
When a Jeep is a Vehicle, then a Grenadier seems to differs from it by the fact that it moves on foot. So I would recommend to name the base-class for these units Infantry. Infantry comes from the l …
answered Mar 26 '13 by Philipp
0
votes
I would recommend you to decouple the graphic engine from the game logic. The classes for the game logic should not have any code which is related to drawing their visual representation. The drawing s …
answered Nov 18 '13 by Philipp
3
votes
Instead of having a TowerType enum and a lot of if/else/case constructs in your code which handle differences between types, you could make your types of towers separate classes which inherit from an …
answered Mar 4 '15 by Philipp
8
votes
In general, it's not a bad idea to separate the game mechanics from their visual representation. When you have a game logic which is completely oblivious to how it is displayed on the one hand, and a …
answered Oct 19 '12 by Philipp
1
vote
Should I use pointer to Tile or (x,y) coordinates for Unit class? When looking up the tile of a coordinate-pair is cheap (which it usually is if your map is an array of tiles with array indexes …
answered Sep 16 '18 by Philipp
3
votes
When you handle all item combinations in the Inventory class, that class will potentially grow to an enormous size because it needs to implement the combination logic to handle every single item combi …
answered Sep 29 '16 by Philipp
8
votes
It is perfectly possible to mix both styles. The same GameObject can have some of its functionality implemented with the new ECS system and other functionality in classic MonoBehaviour events. What U …
answered Jun 15 '18 by Philipp