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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:18:43+00:00 2026-05-12T16:18:43+00:00

In XNA, is it acceptable to create a GameService for an object that isn’t

  • 0

In XNA, is it acceptable to create a GameService for an object that isn’t a GameComponent? I know that a GameService is intended to be a way to access a GameComponent, but what if the object that you’re trying to provide access to doesn’t need to update on every update cycle? For example, I have a Camera2D object that can calculate a Matrix for SpriteBatch.Begin(). The camera doesn’t need to update itself, as it’s position, rotation, etc., are updated by the game code.

All that you need to create a GameService is a type and a provider object, so the provider object doesn’t have to extend GameComponent, but is this an acceptable way of doing things? Is there a better way?

  • 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-05-12T16:18:43+00:00Added an answer on May 12, 2026 at 4:18 pm

    Services don’t have to also be a GameComponent. Just have a look at GraphicsDeviceManager, it provides the IGraphicsDeviceService and is not a GameComponent. The game services container is just a way of loosely coupling your objects.

    Create an interface ICamera2D, make your Camera2D class implement it, and then register an instance of Camera2D as the service provider for ICamera2D in Game.Services. You then use that interface to communicate with the Camera2D instance in your other classes. This means that if at some point you have to change to OtherCamera2D, you only have to register it instead of an instance of Camera2D in your services container and do not have to modify your other classes.

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

Sidebar

Related Questions

One interfaces with XNA through C#, but does anyone know what language the library
I'm starting with XNA and I want to know how do I create a
I have an XNA 3.1 program and would like to create an installer that
Using XNA, I'm trying to make an adventure game engine that lets you make
XNA games have an Unload() method, where content is supposed to be unloaded. But
In XNA I'm using MediaPlayer to play my music. I found that when playing
first time trying XNA Framework in C#.. followed this tutorial: http://www.uxmagic.com/blog/post/2010/08/17/e2809cHello-Worlde2809d-for-XNA-Game-Studio-40.aspx Everything's ok until
i have a simple xna game that i want to port that to silverlight,
I have to tell you, I'm completely NEW to XNA, and I know NOTHING
I'm using XNA 4.0 and Visual Studio 2010 and when I create an XNA

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.