Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » About the allegro provided coordinate system.

This thread is locked; no one can reply to it. rss feed Print
About the allegro provided coordinate system.
keprast
Member #16,794
January 2018

He is a linked list, which is very inconvenient.
Over time is too long.
How to change it into a hash table?
do you know? Similarly, can you help me?thanks.

--------------------------------

Of course, I hope it becomes a "map" structure.

--------------------------------

or,tell me 5.050*10^8 tick, need 1ghz cpu what time?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I don't really know what you're talking about.

The old SGI STL Template Guide is no longer being hosted by SGI since their acquisition by Hewlett Packard (which is BS).

Luckily, I've got a copy I downloaded for reference.
SGI STL Reference Guide

Extract the 7z archive, and then view STL_doc/index.html .

Look at std::vector, std::map, and std::list .

You can store an ALLEGRO_VERTEX in whatever data structure you wish, and then process it as an array.

keprast
Member #16,794
January 2018

I am sorry.Although I use Google Translate.But obviously not easy.
I will use the programmer's common language.code.

array[1000]{1,2,3...};

for(int i = 0;i < 1000;i++)
{
    if(array[i] == x){
    //something
    }
}

Like this, if the array is 10000? 100000?
It takes too much time.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

keprast
Member #16,794
January 2018

@Edgar Reynaldo

Projectile collision.This is the structure of my code.
But obviously, assuming I have 1000 objects and 1000 bullets, I need to count 1000 * 1000 times.
:o
Oh my god.
--------------------
I need a better algorithm.
But I can not find the literature at Baidu.
In Google, I can not find the location.Because it is English.

If you can, can you give me some information?

LennyLen
Member #5,313
December 2004
avatar

keprast said:

But obviously, assuming I have 1000 objects and 1000 bullets, I need to count 1000 * 1000 times.

The usual method is to divide your screen into sections and only check for collisions between objects in the same section.

Try looking up quadtrees.

keprast
Member #16,794
January 2018

@LennyLen

I lack relevant knowledge, need some literature.
On the Chinese search engine, only some useless crap.
Or, you tell me, what books have such knowledge.

LennyLen
Member #5,313
December 2004
avatar

I've never needed to use them, so I only know how they work in theory.

This might help, if you can translate it: Use Quadtrees to Detect Likely Collisions in 2D Space

keprast
Member #16,794
January 2018

Thanks! ;D

Go to: