I am making a 2D game with SDL2. I made my Collider class, I assign colliders to my objects. Everything is okay, but I am wondering what way of handling collision check is more efficient. One way in my mind is making a global array that holds all colliders and every move the array will be checked by my main character iteratively. This has a O(n) complexity. Another way is making a hash table that is hashed with collider's positions. This way has a constant complexity but this way is too costly because of rehashing, I believe. What do you think about it? And do you know how unreal engine or other game engines handle collision checks?
How to handle collision detection (In terms of data structures)
241 views Asked by emrebaris At
0
There are 0 answers
Related Questions in DATA-STRUCTURES
- Why is the runtime for this O(n)?
- Purpose of last 2 while loops in the merge algorithm of merge sort sorting technique
- What is the problem in my "sumAtBis" code?
- Asking code suggestions about data structure and algorithm
- What would be the most efficient way to store multiple sets of fixed arrays (std::vector)?
- About Suffix Trees features
- Getting wrong answer in Binary Search solution
- Are there techniques to mathematically compute the amount of searching in greedy graph searching?
- AVL tree Nth largest operation - How to have all my tests pass? JAVA
- Why does the map size change?
- Complexity in Union of disjointed sets with lists
- Hash collisions in Golang map resolving
- C++ ordered map optimized with index access
- How to sort this list of strings along with the strings and output the result as expected?
- Why deleting an element in a linkedlist costs O(1)
Related Questions in GAME-ENGINE
- How can I get the inverse Transformation of in 2D
- Making mixins similar to FabricMC in Rust
- How to find the rotation of a quaternion along each of the 3 axes separately?
- Runge Kutta implementation is less accurate than Euler implementation
- Viewport namespace missing from SharpDX directive, please assist
- I’m not drawing cards from my decklist/JSON
- Unable to find GL_INT_2_10_10_10_REV define on Android GLES
- OpenGL moving objects have black trail
- Anyone else notcing delays of shared d3dtexture2D betweeen two processes?
- Flask Socket-IO custom objects getting added regardless of client action
- CLANG:"__declspec(dllimport) cannot be applied to a non-inline function" error in my C Program
- Game engine spawning objects from externally specified classes
- Grappling/Swinging System in Godot 4 3D
- Ursina Python Engine: Question about the Lighting System
- Confused about how Rotation works in vulkan
Related Questions in GAME-PHYSICS
- How would I code player jump physics, similar to "soccer physics", and make players collide with a ball in pygame?
- AI and Game physics
- How do I detect for collisions without immediately resolving them in Godot 3D?
- How to find the rotation of a quaternion along each of the 3 axes separately?
- Unity's HingeJoints: Door changes starting Position and AngleLimits on play mode
- Paddle and Ball Sync Problem in Multiplayer Air Hockey in Godot
- Movement value is reset before it can get cancelled by a UnityEvent
- How to make two kinematic objects in Unity detect overlap?
- Jump height and Gravity not consistent with fluctuating FPS (flappybird-like Javascript minigame)
- Game Collision Detection - Separating Axis Theorem Collision Resolution Issue
- Aligning mesh to a dynamic rapier 3D rigidbody
- Player looks like teleporting instead of moving smoothly when camera damping is enabled GODOT
- Collision Detection works only with two objects
- This Unity Jumping & Gravity script is a mess, how can I fix it?
- Grappling/Swinging System in Godot 4 3D
Related Questions in SDL-2
- Running SDL library in Qt Creator
- SDL create bordrerless window with rounded corner
- weird > thing when compiling for sdl2 in g++
- Buildozer building pygame error. Fatal error: 'longintrepr.h' file not found. sdl2.c
- setting window to fullscreen introduces delay
- SDL_ttf is missing when compiling SDL2
- fatal error: 'longintrepr.h' file not found
- Linking error for SDL2 on linux while building with cargo
- C/SDL program, render not working with my renderer
- How can I move my MSYS2 folder to another folder (both in the D driver) if possible?
- Loading image and Invert colors with SDL_Image
- Collision Detection works only with two objects
- Can't build project with SDL2 libraries near to it and cmake on Windows
- Visual studio 2019 C++ compiler error on release x64 with WinToast library
- Cannot link a C file that has an easy example with SDL2
Related Questions in UNREAL-ENGINE4
- How to solve "Project is not configured" problem when opening the Unreal Engine project in CLion?
- UE4: CodeSign Failed, get-task-allow entitlement doesn't match
- Troubleshooting Unreal Engine Integration with Quiche Library for QUIC Client Development
- How to correctly Save & Load a Boolean variable in UE
- How can I add physics such as gravity to CAD files that are imported during runtime in Unreal Engine?
- Does rendering/baking get rid of any Antialiasing ghosting?
- Send image over UDP to Unreal Engine and load it there
- UE4.27 spectator crach
- Create TArray dynamically in Unreal Engine
- Unreal Engine 4.18 Lobby Browser List is region locked to steam download region
- Actor moves towards the wrong axis in UnrealEngine
- how to match android device of player with the device name in android benchmark data?
- (Unreal) How can I draw on a UI image?
- Emulated mouse clicks with Win32 API not registering with game application
- How do I convert my html game into an executable file?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)