Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Fr Jul 18, 2025 08:52

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Lists
BeitragVerfasst: Fr Mai 15, 2009 18:06 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Im wondering what people think is best for storing a list of textures that are currently loaded.

1. Using a TList
2. Using an Array
3. Using a record for each texture which contain a pointer to the next texture.
4. Something Else

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 15, 2009 20:05 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 05, 2002 10:35
Beiträge: 4234
Wohnort: Dortmund
I think this depends on the texturecount and usage. Alternative i can bet hashes. (sorry only german)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 15, 2009 23:02 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Im working on a map editor (Well remaking one which i never finished), so it will have more usage than a game which just loads X amount of textures once per level but at the same time for most of its "Life" it won't be doing much at all. It will only rearly be used to keep a global list of textures (So they can be free'd when the texture system is destroyed if they weren't already destroyed) and to keep the current count of how meny times a texture has been used(So that the system knows when its safe to free the texture). What is the benefit of hashes? Looks simmiler to number 3 on my list except that it also seems to have an array....

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 15, 2009 23:23 
Offline
DGL Member
Benutzeravatar

Registriert: Do Aug 25, 2005 16:00
Beiträge: 189
Programmiersprache: Java, C#
Stucuk hat geschrieben:
Im working on a map editor (Well remaking one which i never finished), so it will have more usage than a game which just loads X amount of textures once per level but at the same time for most of its "Life" it won't be doing much at all. It will only rearly be used to keep a global list of textures (So they can be free'd when the texture system is destroyed if they weren't already destroyed) and to keep the current count of how meny times a texture has been used(So that the system knows when its safe to free the texture). What is the benefit of hashes? Looks simmiler to number 3 on my list except that it also seems to have an array....


@hashes:
You have an array and an hash function. Every object has an key (i normally use texture name or something like that). The hash function takes the key and returns the index, where the object is located in the array.
So, the advantage is that you can find an entry very fast. You can also find out if an object is already in the data structure or not. You're also able to iterate over the whole set of entries.

It's my favourite data structure for texture managers and stuff like that, but i'm not sure if that structure is what you're looking for.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 16, 2009 12:31 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
I think, an array (or better, TList) is normaly a fine structure for textures. You load the textures only once and you delete them all at one time, so you do not need the performance bonus you get for deletion and addition when you use linked lists. Accessing could be done either by direct pointers or by indicies. For the first access you could use a "find by name" function, which returns a pointer to the texture object which may be stored for later usage.

greetings Lord Horazont

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 4 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.007s | 14 Queries | GZIP : On ]