zaterdag 2 april 2011

Processing and storing and creating game data with java.

In a other programming language I learned to store game data in types. The types was a list wich could contain variables of different types per list item. You could iterate/loop thru the type to display and process game data. I was thinking how I would do this in Java. I have not found how to do it yet.

I was thinking of using a thread per game object.
I was also thinking of using array lists but I need to read more about these for I need to know if they can have double, integers per item.

I still need to do more information gathering.

Update:
I have been looking through the threads section of my Java book and see how it is used for a single animation and called a couple of times. I see no outside variables being used. I think that can be done. If I go with this method I will have hundreds(ai) and maybe thousands(explosions and effects) of threads running at the same time. Threads if I understand correctly automatically are executed in the computers multiple processor cores.

I am still not sure how fluent screen redrawing is done with threads. I see a repaint instruction in the books thread example so I guess per thread I need to redraw. I will look up more information on this.

Update :

I am not sure how to do collision detection between the threads. I started searching but could not find any information on how to do it.

Geen opmerkingen:

Een reactie posten

Opmerking: Alleen leden van deze blog kunnen een reactie posten.