Here's a philosophical question for you.
Let there be a roguelike game. Let this game have mobs, which are mobile objects; Examples include the player, goblins, slimes, etc. Let this game also have items, e.g. swords, food, armor, potions.
From the player's point of view, obviously these things are different. They can't necessarily pick up and eat or equip other mobs (though maybe that's a fun game too).
But from the point of view of the code, are these things different? Or rather, do they necessarily have to be?
Are items just mobs that don't call their Move method ever? Is picking up an item the same as despawning a mob? Or should these things be separated out into different classes?
We're working in Lua here, so our answers are going to vary pretty widely, I think. What's your reasoning for your particular answer? How would YOU do this, if the above roguelike were yours to make? I've left this pretty wide open because I'm not trying to solve any particular problem, just interested in how we all think. Feel free to take this idea and run with it outside the original scope of the question, too.
[Philosophy] Are items just mobs that don't move?
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [Philosophy] Are items just mobs that don't move?
You could also think of it the other way around; are mobs just items that can move?
Then again, if the game was funny, would a piece of mold be both? since it could be an item, but it might be one that moves... why wouldn't it be a mob then? How about an immobile mob, like an evil tree or posessed statue or something?
If anything, i'd consider both of those to be entities, as opposed to the unmoving, unchanging, unpocketable world... whether tile-based or not.
Then again, if the game was funny, would a piece of mold be both? since it could be an item, but it might be one that moves... why wouldn't it be a mob then? How about an immobile mob, like an evil tree or posessed statue or something?
If anything, i'd consider both of those to be entities, as opposed to the unmoving, unchanging, unpocketable world... whether tile-based or not.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: [Philosophy] Are items just mobs that don't move?
Spikes are mobs, that cannot move, but hit you.
Re: [Philosophy] Are items just mobs that don't move?
You can think of it like this... Every thing, or "entity", in your game is just a container with other things in it. On a high level, an enemy might be an entity with a position, an AI, and a model. An item might be an entity with some graphics, and something that says it can be picked up. On a low level, an enemy might be a table, where one field is the x position, and another field is an array of other tables, each representing an animated sprite. An item might be a table with an type field that says what kind of item it is (which e.g. the rendering system would use to determine what graphics to render for it), and a boolean field that says whether or not the entity can collide with the player and thus be picked up.
It is very common for games to a single system that contains most things in the game (including objects in the game world, but also more abstract things like logic that connects other entities). Usually there are some properties that are common; that all entities have (like a position in space, and a unique ID), but then there are properties which are only used by some types of entities. There are several ways to deal with this. Some complex game engines, like Unity, allows you to attach "components" to entities. Each component would contain logic or data for specific things, like a sprite, or AI. In a different system you could simply stores all properties in existence on all entities and then just have a field that specifies what type of thing the entity is supposed to be (and what fields are relevant) and code everywhere has to check that field to determine how the entity should be treated.
In my games I aim to have systems that are as "flat" as possible (i.e. no components or nested entities, and very little "inheritance" of logic) because it makes things simple. If I were to make a rogue-like I would make mobs and pickups part of the same entity system. They would both have common properties like a position, but also have properties that are unique to their type of entity. The inventory of the player would be stored on the player entity, and when the player collides with a pickup I would simply remove the pickup entity, probably spawn an effect entity, and increase some item counter on the player.
So to answer the question in the title... Sure, items can be mobs that don't move!
It is very common for games to a single system that contains most things in the game (including objects in the game world, but also more abstract things like logic that connects other entities). Usually there are some properties that are common; that all entities have (like a position in space, and a unique ID), but then there are properties which are only used by some types of entities. There are several ways to deal with this. Some complex game engines, like Unity, allows you to attach "components" to entities. Each component would contain logic or data for specific things, like a sprite, or AI. In a different system you could simply stores all properties in existence on all entities and then just have a field that specifies what type of thing the entity is supposed to be (and what fields are relevant) and code everywhere has to check that field to determine how the entity should be treated.
In my games I aim to have systems that are as "flat" as possible (i.e. no components or nested entities, and very little "inheritance" of logic) because it makes things simple. If I were to make a rogue-like I would make mobs and pickups part of the same entity system. They would both have common properties like a position, but also have properties that are unique to their type of entity. The inventory of the player would be stored on the player entity, and when the player collides with a pickup I would simply remove the pickup entity, probably spawn an effect entity, and increase some item counter on the player.
So to answer the question in the title... Sure, items can be mobs that don't move!
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: [Philosophy] Are items just mobs that don't move?
As idea: Items are move from player's character, but not faster than half of max player's speed.
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Re: [Philosophy] Are items just mobs that don't move?
Items can be mobs, or be items, depending on your game. A more dynamic game would have items inherit from mobs so that in a nutshell they can do everything mobs can do, like becoming animated, etc. But most just make items seperate from mobs, since they have different behaviours like corrode instead of illness, break instead of die and repair instead of heal .
Mostly, yeah, that entity thing. All just inherited from entity with basic position and drawable sprite. Then split up and do their own thing
Mostly, yeah, that entity thing. All just inherited from entity with basic position and drawable sprite. Then split up and do their own thing
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [Philosophy] Are items just mobs that don't move?
Depending on the game, they'd not be mobs, but rather tiles that can inflict damage... i.e. not really entities.
To me, this seems a bit more like animate vs. inanimate or organic vs. inorganic to be honest. robots would be mobs that could corrode, and star trek, as an example, had bio-neural gel packs that were items embedded into a starship... but could be infected and "be ill". same with healing vs. repairing.Gunroar:Cannon() wrote: ↑Wed Jul 14, 2021 11:19 am Items can be mobs, or be items, depending on your game. A more dynamic game would have items inherit from mobs so that in a nutshell they can do everything mobs can do, like becoming animated, etc. But most just make items seperate from mobs, since they have different behaviours like corrode instead of illness, break instead of die and repair instead of heal .
Mostly, yeah, that entity thing. All just inherited from entity with basic position and drawable sprite. Then split up and do their own thing
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Prole
- Posts: 37
- Joined: Thu Jun 24, 2021 5:49 pm
Re: [Philosophy] Are items just mobs that don't move?
Agreed! We can always set those distinctions at the UI / user level, whereas in the code, it can be more "flat".zorg wrote: ↑Wed Jul 14, 2021 1:10 pm To me, this seems a bit more like animate vs. inanimate or organic vs. inorganic to be honest. robots would be mobs that could corrode, and star trek, as an example, had bio-neural gel packs that were items embedded into a starship... but could be infected and "be ill". same with healing vs. repairing.
- Gunroar:Cannon()
- Party member
- Posts: 1144
- Joined: Thu Dec 10, 2020 1:57 am
Re: [Philosophy] Are items just mobs that don't move?
Nice view on it! Maybe robots could be items ... yeah, I know...I know.zorg wrote: ↑Wed Jul 14, 2021 1:10 pm To me, this seems a bit more like animate vs. inanimate or organic vs. inorganic to be honest. robots would be mobs that could corrode, and star trek, as an example, had bio-neural gel packs that were items embedded into a starship... but could be infected and "be ill". same with healing vs. repairing.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: [Philosophy] Are items just mobs that don't move?
This is how it works in old games like Wolfenstein and DOOM. "Sprites" in those games are just all the same "thing" class with different flags applied. A thing can be flagged as being able to move and attack, or it might have those flags turned off and just ends up being stationary.
Basically mobs are objects with AI attached to it.
Basically mobs are objects with AI attached to it.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests