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 8056785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:49:31+00:00 2026-06-05T08:49:31+00:00

In a WP7 game I’m building my Enemy classes are wrapped in an EnemyControl

  • 0

In a WP7 game I’m building my Enemy classes are wrapped in an EnemyControl.
The Enemy Control uses a spritesheet of all the different animation states for that enemy type. There are only 4 images which I statically cache the bitmaps for.

The problem I have is that despite both the image being cached (BitmapImage statically and CacheMode="BitmapCache"), when the Image is loaded by the control it adds approximately 2 meg of Texture/System memory per control.

This is a significant problem as it limits the number of enemies I can conceivably have on screen.

Does anyone have any ideas how I could improve this situation? or otherwise solve it?

Here’s the xaml if interested:

<Canvas x:Name="canEnemyControl">
    <Canvas.RenderTransform>
        <TranslateTransform x:Name="enemyControlTransform" X="0"/>
    </Canvas.RenderTransform>
    <Canvas.Clip>
        <RectangleGeometry x:Name="clipGeometry" Rect="0,0,60,60" />
    </Canvas.Clip>
    <Image x:Name="imgEnemy" Stretch="None" CacheMode="BitmapCache" >
        <Image.RenderTransform>
            <TranslateTransform x:Name="enemyImageTransform" X="0" Y="0" />
        </Image.RenderTransform>
    </Image>
</Canvas>
  • 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-05T08:49:33+00:00Added an answer on June 5, 2026 at 8:49 am

    I don’t think your implementation will scale because I don’t think the multiple Image elements know to share the same bitmap cache.

    Solution: CompositionTarget.Rendering and WriteableBitmapEx

    One possible solution would be to use CompositionTarget.Rendering for rendering like in my answer here. This fires an event before the screen is updated so you can do your own drawing. I believe this is how Krashlander and some other Silverlight games work (though I think he may have switched over to XNA in later versions).

    Then I think that you can use WriteableBitmapEx to use one instance of your source image to draw it into multiple places on a buffer. You should scale much better because you have your buffer the size of your screen/viewport, and you have your one copy of each image. The memory requirements for displaying 1 enemy and 1000 should be the same.


    I will add a disclaimer that I haven’t tried this exact approach, but I do use CompositionTarget.Rendering in one of my apps for smooth screen updates.

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

Sidebar

Related Questions

I'm building this WP7 app that uses a video game API to get the
I'm building a BattleShip game for WP7 that has board with 250 cells. I
I am building a WP7 application which heavily uses RX and I came across
i'm building a wp7 application for a game using silverlight & XNA i have
We are building a WP7 mobile game that will allow players to purchase game
I have a WP7 XNA game that needs to save the state whenever the
Is it possible to make a normal WP7 app as a game (simple flashcards)
Is there a scrollviewer WP7 control which have categories title? The category title can
In WP7 silverlight app, i wanted to use a storyboard animation on a particular
When I try to reference the project of farseer with a WP7 game targeted

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.