Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 09:59:32 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Item Systems
Pages: [1]
Print
Author Topic: Item Systems  (Read 1250 times)
Mstrymt
Level 0
*


View Profile
« on: November 05, 2014, 02:16:12 PM »


Hello,

 Does anyone know of any standalone item systems/libraries.
 Or even any good tutorials on the architecture of item systems.
 Any programming language is fine.

 I'm looking into the design and architecture of such systems and wondered if there were any examples around already.


  Thank you in advance
Logged
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #1 on: November 05, 2014, 03:07:55 PM »

"Item systems" can mean a lot of different things. Could you describe what you're looking for in more detail?
Logged

Playaction
Level 0
***


Junkyard Robots


View Profile
« Reply #2 on: November 07, 2014, 05:44:40 AM »

Inventory system maybe? I don't know what language you use, but I think this AS3 example is pretty good:
http://www.freeactionscript.com/tag/as3-inventory-system/
Logged

s0
o
Level 10
*****


eurovision winner 2014


View Profile
« Reply #3 on: November 07, 2014, 06:44:38 AM »

i just use a bunch of nested arrays in my game

1 item is 1 array, all item indexes are saved in a master list (which is also an array). the player's inventory is also an array of item indexes.
« Last Edit: November 07, 2014, 06:52:16 AM by C.A. Silbereisen » Logged
Mstrymt
Level 0
*


View Profile
« Reply #4 on: November 07, 2014, 11:25:27 AM »

"Item systems" can mean a lot of different things. Could you describe what you're looking for in more detail?

Hello,

 Like a system that manages the creation of items, attribute assignment, balancing etc.
 Could also include systems that manage crafting with relation to generated items and/or item usage against other items/npc's.

 I'm finding it difficult to come up with a good description, which is one of the reasons i'm looking around, so i can see whats available in the general area.

 - Thank you
Logged
ubik
Level 0
***


View Profile
« Reply #5 on: November 18, 2014, 06:41:32 PM »

If you want to have creation of items in-game you will probably want to look into this:

http://en.wikipedia.org/wiki/Entity_component_system

Basically items are represented as a list of properties.  Properties can be dynamically added to or removed from the list at runtime.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #6 on: November 19, 2014, 12:22:23 AM »

If you want to have creation of items in-game you will probably want to look into this:

http://en.wikipedia.org/wiki/Entity_component_system

Basically items are represented as a list of properties.  Properties can be dynamically added to or removed from the list at runtime.

This is about the single best thing you can do.  Look into the Command pattern as well (function lambdas).  So you could bind a function to be called when a certain potion to be used.  For example (some simple Lua):

Code:
-- potion definition
potion.drink = function(drinker)
    drinker.health += potion.strength
end

-- somewhere in your game code
potion.drink(player)

Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #7 on: November 19, 2014, 09:51:20 AM »

Code:
-- somewhere in your game code
potion.drink(player)

In soviet Russia, potion drinks you!
Logged

ubik
Level 0
***


View Profile
« Reply #8 on: November 19, 2014, 10:57:30 AM »

The component thing is sort of a conceptual bear.  It can also be handled with an array of property flags and if/then statements.  "If (fire_resistance_flag) player_fire_resistance++"

That will get you the same effect in a less elegant way but if bundled up in a function the lack of elegance won't matter.
Logged
Krux
Level 2
**



View Profile
« Reply #9 on: November 19, 2014, 01:00:26 PM »

depends on what you want to do. Eg in diable items are totally different than in Zelda. Diable has a huge amount of items that are all basically the same. Equipment that changes your stats. While in Zelda you have much less items, but they are much more different.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #10 on: November 19, 2014, 01:51:28 PM »

depends on what you want to do. Eg in diable items are totally different than in Zelda. Diable has a huge amount of items that are all basically the same. Equipment that changes your stats. While in Zelda you have much less items, but they are much more different.

This is also a good point.  Finding the balance between configuration and programmability is key, even if it means splitting items up into two camps to make the code cleaner.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
oahda
Level 10
*****



View Profile
« Reply #11 on: November 19, 2014, 10:06:29 PM »

Code:
-- somewhere in your game code
potion.drink(player)

In soviet Russia, potion drinks you!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic