require more better method???

Started by
0 comments, last by doublin_ken 21 years, 8 months ago
I want to design a 2d RTS game that make up with a piece of rhombus.I can transform game coordinates to array position. But whenever the increasingly object above the map, each object will calculate their position again. Thus seriously affect the game speed and effective. In other words, one hundred objects will figure out one hundred times that the object located at which position. Does anyone have better way to solve the problem? my program(not include any object, only the base map): http://us.f1.yahoofs.com/users/ce0ce007/bc/0807.rar?bc_g7Y9AnHKI_EE2
Advertisement
quote:Original post by doublin_ken
I want to design a 2d RTS game that make up with a piece of rhombus.


This statement is unclear. Please clarify how the rhombus is related to the game.

quote:Original post by doublin_ken
I can transform game coordinates to array position. But whenever the increasingly object above the map, each object will calculate their position again. Thus seriously affect the game speed and effective.


I''m trying to understand. Are you saying that when new objects are added to the map, every object recalculates its position? Why not store a flag with each object indicating that its position is valid or invalid. When new objects are added, their position flag is invalid. Then, when you update positions, only calculate the position of objects with an invalid flag. After the position is calculated, validate the flag.

quote:Original post by doublin_ken
In other words, one hundred objects will figure out one hundred times that the object located at which position. Does anyone have better way to solve the problem?


My flag solution is, I think, one valid approach to solve the problem. Using the flags, instead of each object calculating its position one hundred times, each object would calculates its position only one time.

quote:Original post by doublin_ken
my program(not include any object, only the base map):
http://us.f1.yahoofs.com/users/ce0ce007/bc/0807.rar?bc_g7Y9AnHKI_EE2


This link does not work.



Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement