How does less code affect a game?
Background (Skip to "problem" for the question): I really enjoy making games in Unity, but, even though I've been using it for months, I haven't finished a single game yet. It's mostly because I only use it when I have time, and being a science student doesn't give me much time. But another reason is that I'm a perfectionist and also an extremist. Whenever I do something, unless I do it in the best way possible, I don't get satisfied, and therefore get frustrated and stop doing it. I've worked on many projects so far, an FPS for the most part, but whenever I compare what I started working on like 3 days ago with something like Call of Duty, I get extremely disappointed and delete what I've done. I'm far from 100% in learning the coding language.
Problem: The same thing is also with coding, I always want to get something achieved with the least amount of code possible. But I'm wondering, does less code have an effect on the game in any way? For example, is there a difference in the effect on the game between 2 lines and 50 lines of code? Is it ok if I write a really long code instead of a short code, that has the same exact effect?
Answer by Owen-Reynolds · Nov 07, 2020 at 05:13 AM
The amount of code won't matter. It's only a few kilobytes compared to Megs and Megs if you have any pictures. It's like buying a diamond ring and worrying about how much the box costs.
But too many lines of code may cause problems in other ways. Suppose you have 30 bricks and you cut-and-paste the code for 1 brick 30 times. That will work. But it's going to be a huge pain if you want each to be 1.2 from the next, typing in 30 #'s by hand. Better to put the bricks into an array and use a loop with x=brickNum*1.2.
But none of that matters, since an actual perfectionist is screwed as far as programming and games. No matter what you do, it could always be faster, or more elegant, or whatever. And games are worse. You throw away lots of things that aren't fun until finally you've got something good enough. Look at MMO's. There's always a few classes and combos that are too good, get nerfed, then something else is too good -- those games are constantly broken in some way or another. But people play them when they're good enough.
Your answer
Follow this Question
Related Questions
Byte vs Int 3 Answers
Lights in Scene reduce farms per Second(FPS) 1 Answer
Unity Line renders taking up 80 ms 0 Answers
2D game - Really Huge Scrolling Background 0 Answers
Unity lags in play mode but works well after building the game ? over 100 fps ? 0 Answers