Efficient way to compare player X,Y with other objects X,Y from tables.
DanielDoe
Member Posts: 307
I've tried somethig like this:
Every 0.1second check If Player X,Y = X,Y from Table if YES DoSomething
Otherwise go to next raw and repeat behavour.
It works but it slows down everything, that the game drops a lot fps... It's useless. No matter how many rows you have.
Is there any way to make such massive comparison between player and X,Y from tables?
Every 0.1second check If Player X,Y = X,Y from Table if YES DoSomething
Otherwise go to next raw and repeat behavour.
It works but it slows down everything, that the game drops a lot fps... It's useless. No matter how many rows you have.
Is there any way to make such massive comparison between player and X,Y from tables?
Answers
@danielhalat
Hi Daniel, I'm thinking that to check a list would take far less time than 0.1 seconds (providing there weren't thousands of entries), so maybe try dispensing with the timer and put the checking on a loop; to see if that improves fps at all.
So make an integer, let's call it Loop
When Loop is 0
---your table check rules here, checking row rowCheck
When x,y = x,y
Change attribute Loop to 2
---do something, including Change attribute RowCheck to 1 presumably ---
Otherwise
Change attribute Loop to 1
----
Rule: When Loop = 1
Change attribute RowCheck to rowCheck+1
Change attribute Loop to 0
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
If rule once check the value e.x. If Rule=0 it don't execute next time when Rule=1, Rule=2, Rule=3.
I don't know if this is clear so please check the project:
https://www.dropbox.com/s/gxve8nevhzfj81c/thelastjourney 0.1.50.zip
The actor that compares positions is spaceSpawner.
I'll take a look at your gamefile and see what I can do; I'll try to get around to it tonight (it's 7.40pm UK time at the moment here) but if not tonight, tomorrow; hope that's OK with you.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi Daniel, I can't find your rules where it's checking every 0.1 secs....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks, but in the version you sent me, there's no Timer behaviour checking every 0.1 seconds as you said.... unless I'm going slightly crazy and it's there and I can't see it....
This is your second rule I'm seeing in the spaceSpawner actor:
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
So the Rule where is comparison between planetIndex and self.temp_index was de facto timer before. Hope this will help. Your screenshot shows the Rules that compares X,Y with tables and these are inside this general Loop/Timer Rule.
If you have few minutes please check the new project file:
https://www.dropbox.com/s/h9sd5jaywj1fi7v/thelastjourney 0.2.00.zip