For the sake of the question, imagine that I’m making a game engine from scratch by one of the popular programming languages and I would like to put an interactable crate in my game. How does the game know what a crate is? I’m thinking like they create a crate in one of the rendering software, but how do they translate that to a game? Do they do something like
`define “crate” crate.stl`
then refer to it only as “crate” to give it animation, physics and lighting properties by extra code, or does it work completely differently?
A follow up question, I want to give velocity to my crate when it’s propelled by the player. Let’s say I tell it moves on x axis by “5” when “interact” happens, how is x axis or velocity defined?
In: Technology
The question you’re asking is really a question of data structures, so I’m gonna answer that. I don’t mean it as an insult, but you’re working at the Computer Science 101 level, and you’re not ready to think about making a videogame engine.
You’ll need some kind of array to represent the entirety of the map of your game, and it exists so you can reference it as a coordinate system for the different pieces of your game. A chess board, for example, could be an 8×8 array. More complicated games need a much more complicated system for defining their coordinate system.
Once you have your grid system laid out, putting an object in that system means assigning it a location and dimensions based on that location… for example a 1×1 square located at (0,0).
You’re going to have to ask more specific questions if you want more specific answers.
Latest Answers