Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8450359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:56:54+00:00 2026-06-10T10:56:54+00:00

Currently, each level has 3 layers : background collisions(walls, invisible walls, ground, etc) foreground

  • 0

Currently, each level has 3 layers :

  • background
  • collisions(walls, invisible walls, ground, etc)
  • foreground

My character sprite has 1 pixel to detect the collision.
In this character class, there is a Color[] contains every pixels of the collision layer.

I calculate the position of the Character’s pixel detection, and obtain an int that i can use with the Color[] (“CharactersPixel”)

if ( Color[CharactersPixel].A != 0 )
    Then collision.

It works perfectly.

But the collision layer has to be used by every others objects like particles, monsters etc.

The collision layer has about 3.800.000 pixels. so the Color[] has the same.

If I add this Color[] to every objects, this will use too much RAM, right ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:56:56+00:00Added an answer on June 10, 2026 at 10:56 am

    You’d only add a reference to your collision layer to the objects. You are not copying the entire thing to each object. Adding a reference will not add much memory to your objects.

    However, I would suggest making the collision available in some more general fashion by exposing some level data in a place accessible to any object. Perhaps you could add the data to your Game class as a property CurrentLevel with CollisionData as an accessible property.

    Normally you keep the collision data separate from the actual rendering colours, and perform a more simplistic collision with boxes and the like instead that approximately match the shape of the collision data. This would in the end make it easier to calculate things like the angle which you impact the environment and calculation of appropriate physics. Pixel to pixel collisions are rare, and might also be problematic from a performance perspective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some hierarchical data (currently 6 levels). Each level has different attributes. I
One of my sites has a lot of users. They currently each have one
I have a 2-level nested models: country <- state <- city Currently, in each
I've got a database of historical records from WW2 and currently each recorded event's
I'm building an events listing site. Currently each event is entered for a specific
Bing maps currently simplifies each polygon shape that gets put on the map. While
SQL Server 2005 Standard 64x, with 300+ tiny databases currently (5MB each), user base
Currently I have two tests that each individually test for a button_click within a
Currently we use separate a drop statements for each stored procedure in the script
Currently, each td../td prints in just 1 line which makes the source code very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.