What amazing game things can you do in Unity with one line of code?
And what things take multiple lines of code?
Would the ideal game engine allow one line of code to do any in game action?
What amazing game things can you do in Unity with one line of code?
And what things take multiple lines of code?
Would the ideal game engine allow one line of code to do any in game action?
transform.position = Random.onUnitSphere;
That’s pretty amazing if you ask me. Consider how many assembler statements this used to be back in the 80s.
You may be interested in functional programming. F# for instance, or LINQ which uses this concept.
And you may want to consider not lines, which is a formatting concept, but statements. For example, this code example, even though it spans multiple lines, is a single statement:
from inter in
from thing in traceRayArgs.Scene.Things
select thing.Intersect(testRay)
where inter != null
orderby inter.Dist
select inter
This was taken from a raytrace renderer implemented entirely with LINQ.
Anyhow, the answer to your last question is: no.
Good point maybe the last question should be:
Should a great game engine let you build a small codebase that lets you do any in game action in one line of code?
The emphasis on the small codebase being key to a good to great game engine API.
Isn’t that what methods/functions effectively are in code though?
You hide complexity into a single function call.
For example a Walk action can be called in one line, and all the code required to make a character walk is all contained within that function.
But that has to be our job to implement, because a walk action in one game will require a different implementation to another game.
But is it a game engines job to make our code as easy as possible to work.
Or how many lines of code should a walk function have?
I can simulate application errors.
Application.Quit(1);
Above all else code should be easy to read, the number of lines doesn’t really matter as long as it all has purpose.
It’s precisely because there is no single answer to that question as to why Unity doesn’t try to solve that problem for you, it just gives you the tools to write your own implementation specific to your needs.
My point was really that once any function is written it is only one line to call it. Programming languages already do what you seem to be wanting them to do. The inner complexity in a function (specific to a given project) no longer matters once it’s written.
But if an engine tries to second guess what you mean and provide generic functions for complex tasks they wont be of use to most people anyway, because they wont do exactly what you need them to do.
This conversation reminds me of the theory as to why AI code generation has its limits for solving specifically defined computing tasks, because code itself is the best design specification and the only way to remove ambiguity.
In other words, hypothetically you could ask an advance AI machine to “build a Doom clone” and it would.
But the only way to get exactly the Doom clone you want from your imagination you would have to be so specific in your description as to need to write a detailed logical specification (so you are back to writing code!).
(You can replace “Doom Clone” with “Walk” function or anything else higher level then standard engine API functionality and the same applies).
to me, an ideal that i can visualize that i might expect to exist in my lifetime would be voice-commanded visual scripting, with something akin to auto-correct that might ask for clarification when needed.
The system must be designed so that every change you make provides immediate ability to test things out - ideally there is never a period where it cannot be tested.
Typing on keys is slow and requires too much brain power all on its own. When people are able to just sort of think out loud and the computer handles translation, that would be ideal.
pointless and off-topic.