Advertisement



Go Back   Zune Boards > Zune Discussions > Zune Games > Development Discussions

New Member?



 
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 06-18-2008, 02:26 PM   #61 (permalink)
Zuner
 
Join Date: Dec 2007
Posts: 56
Reputation: 26
Default


Quote:
Originally Posted by jackluo923 View Post
How do I add a framerate counter?
I used this :
http://blogs.msdn.com/shawnhar/archi...framerate.aspx
as a starting point. You have to change it, for example remove the loadAllContent checks and change the LoadGraphicsContent and Unload one to just LoadContent() methods. Also have to add Content.RootDirectory = "Content" to the constructor.




Last edited by sableholic : 06-18-2008 at 02:45 PM.



sableholic is offline   Reply With Quote
Old 06-18-2008, 02:51 PM   #62 (permalink)
Senior Zuner
 
jackluo923's Avatar
 
Join Date: Dec 2007
Location: Greater Vancouver BC
Posts: 1,275
Reputation: 122
Send a message via MSN to jackluo923
Default

Quote:
Originally Posted by sableholic View Post
I used this :
http://blogs.msdn.com/shawnhar/archi...framerate.aspx
as a starting point. You have to change it, for example remove the loadAllContent checks and change the LoadGraphicsContent and Unload one to just LoadContent() methods. Also have to add Content.RootDirectory = "Content" to the constructor.
Is it possible if you could just send the copy of game source code you have to me? I'm new to VS and XNA games studio.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




jackluo923 is offline   Reply With Quote
Old 06-18-2008, 03:24 PM   #63 (permalink)
Zuner
 
Join Date: Dec 2007
Posts: 56
Reputation: 26
Default

Quote:
Originally Posted by jackluo923 View Post
Is it possible if you could just send the copy of game source code you have to me? I'm new to VS and XNA games studio.
Right Click the RaycasterXDemo [zune] Project and choose Add->New Item->C# Class File
Rename it to FrameRateCounter.cs
Open that file and select all and then paste in the following:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace RaycasterXDemo
{
    public class FrameRateCounter : DrawableGameComponent
    {
        ContentManager Content;
        SpriteBatch spriteBatch;
        SpriteFont spriteFont;

        int frameRate = 0;
        int frameCounter = 0;
        TimeSpan elapsedTime = TimeSpan.Zero;


        public FrameRateCounter(Game game)
            : base(game)
        {
            Content = new ContentManager(game.Services);
            Content.RootDirectory = "Content";
        }


        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            spriteFont = Content.Load<SpriteFont>("Fonts\Font");
        }


        protected override void UnloadContent()
        {
            Content.Unload();
        }


        public override void Update(GameTime gameTime)
        {
            elapsedTime += gameTime.ElapsedGameTime;

            if (elapsedTime > TimeSpan.FromSeconds(1))
            {
                elapsedTime -= TimeSpan.FromSeconds(1);
                frameRate = frameCounter;
                frameCounter = 0;
            }
        }


        public override void Draw(GameTime gameTime)
        {
            frameCounter++;

            string fps = string.Format("fps: {0}", frameRate);

            spriteBatch.Begin();

            spriteBatch.DrawString(spriteFont, fps, new Vector2(33, 33), Color.Black);
            spriteBatch.DrawString(spriteFont, fps, new Vector2(32, 32), Color.White);

            spriteBatch.End();
        }
    }
}
and save it. Then open up Game1.cs and add the following line:
Code:
            Components.Add(new FrameRateCounter(this));
after the Content.RootDirectory = "Content"; line



sableholic is offline   Reply With Quote
Old 06-18-2008, 03:30 PM   #64 (permalink)
Senior Zuner
 
jackluo923's Avatar
 
Join Date: Dec 2007
Location: Greater Vancouver BC
Posts: 1,275
Reputation: 122
Send a message via MSN to jackluo923
Default

Ok.. that's pretty simple to do. I"ll post back the fps in 5 minutes.
I just learned something new today. YAY
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




jackluo923 is offline   Reply With Quote
Old 06-18-2008, 04:06 PM   #65 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Posts: 410
Reputation: 60
Default

I know this isn't related to the Zune, but I figured some of you might like this: http://nick.gravelyn.com/2008/06/18/...-in-three-dee/



SimReality is offline   Reply With Quote
Old 06-19-2008, 01:25 PM   #66 (permalink)
Senior Zuner
 
jackluo923's Avatar
 
Join Date: Dec 2007
Location: Greater Vancouver BC
Posts: 1,275
Reputation: 122
Send a message via MSN to jackluo923
Default

Nice, but even the raycasting engine runs faster on the zune compare to silver light. I might be that my comptuer is too slow though.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




jackluo923 is offline   Reply With Quote
Old 06-19-2008, 01:34 PM   #67 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Posts: 410
Reputation: 60
Default

Beats me. Silverlight is more event-driven than XNA, plus it doesn't get full hardware power and all the other things. But it seems rather close to the Zune (at least my 8GB) that it was worth porting. Maybe I'll make a Silverlight maze game like your Zune game.



SimReality is offline   Reply With Quote
Old 06-19-2008, 01:39 PM   #68 (permalink)
Senior Zuner
 
jackluo923's Avatar
 
Join Date: Dec 2007
Location: Greater Vancouver BC
Posts: 1,275
Reputation: 122
Send a message via MSN to jackluo923
Default

Wow.. i never knew 8GB zune was that slow. Do you need a map generating tool for the maze?

Also, I think i'm gona delay the release of the maze game. I think i'll add the zuneblade into this game so I can make different levels for the game while listening to some music. The problem is that I don't know how to get the zuneblade into this game and how to add levels. So i'll have to seek help from other developers from zuneboards.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Last edited by jackluo923 : 06-19-2008 at 01:42 PM.




jackluo923 is offline   Reply With Quote
Old 06-19-2008, 02:29 PM   #69 (permalink)
Zuner
 
Join Date: Dec 2007
Posts: 56
Reputation: 26
Default

Jackluo what kind of fps are you experiencing on your Zune 30?



sableholic is offline   Reply With Quote
Old 06-19-2008, 02:41 PM   #70 (permalink)
Senior Zuner
 
jackluo923's Avatar
 
Join Date: Dec 2007
Location: Greater Vancouver BC
Posts: 1,275
Reputation: 122
Send a message via MSN to jackluo923
Default

I found out a trick for optimizing the FPS. If you create the sprites bigger, like 300pixel length and width.. etc, it won't lag.

Anyways... with 2-3 large sprites, It's impossible for me to get it to lag I don't know the exact fps because the fpscounter doesn't work for me or I've done something wrong. When I have about 50 sprites showing at a time, it's pretty choppy (10fps~) for half a second before everything goes smooth again.
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.




jackluo923 is offline   Reply With Quote
Old 06-21-2008, 11:01 AM   #71 (permalink)
Jr. Member
 
SimReality's Avatar
 
Join Date: May 2008
Posts: 410
Reputation: 60
Default

There's a new download in the Source Code area for RaycasterX that includes some changes. It seemed (though I didn't test that thoroughly nor really measure the FPS) to help out on my 8GB Zune by moving all the math to Update instead of Draw. So anyone building with RaycasterX will likely want to update to the new version found here: http://www.codeplex.com/raycasterx/S...leCommits.aspx.



SimReality is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -8. The time now is 08:28 PM.

 
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC8
vB Ad Management by =RedTyger=
(C) ZuneBoards 2006-2007
Copyright © 2006 - 2008 Zune Boards | About Zune Boards | Legal | A member of the Crowdgather Forum Community