Jump to content

  • Log In with Google      Sign In   
  • Create Account


Subliminalman

Member Since 28 Dec 2010
Offline Last Active Mar 11 2013 06:29 PM

Posts I've Made

In Topic: Questions for a tester.

11 March 2013 - 03:01 AM

So the question is - are you truly at the Beta stage considering the questions you have mentioned up top? If you aren't then by all means suck every drop of feedback you can obtain.

 


I guess it's slightly both. We're preparing a demo to show off but I also want to get players impressions of how the game generally feels. 

So perhaps alpha would be a better term for this.

 

 

 

Any tips on what to google search? I have listened to some GDC talks before on the subject but never have found any questionnaires specifically for games

with the exception of club nintendo.


In Topic: Questions for a tester.

11 March 2013 - 02:25 AM

So the game is a platformer for mobile that is using a non virtual joypad control input and it will be coming out for both iOS and Android. It's

has the general theming of a Mario game, so not dark like a Castlevania title.

 

The only other person that is working on the title is my girlfriend and I believe most of the people that are coming are going to be game 

devs from my local IGDA chapter. We're also doing this at a local café so we may not be able to get webcam stuff going.

 

Also how many questions might be too many? We have them going through three levels that are approximately a minute and a half each 

so I don't want to overload them.


In Topic: My HLSL Not working on Xbox

16 November 2011 - 07:49 PM

The problem is when I put it to TEXCOORD1 it doesn't draw the thing at all. I'm trying to have it make a mask on the rendertarget to make it round.

In Topic: Using XNA RenderTargets

22 October 2011 - 09:20 PM

As far as I know, there are just some performance considerations with the Xbox and rendertargets. In XNA 4 they apparently changed the interface so that behavior (but not performance!) is the same across platforms. The usual advice is to get something working first, then make a determination if optimization is needed.

Of course, as I said, I'm not really the expert here, so maybe someone else can give a more detailed or accurate answer.


So I figured it out!





Here's the code so if anyone is doing something like this they can use it! Please though just site me in the credits as a Special Thanks and let me know :D





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;




class ViewFinder
    {
        #region Variables
        public bool isAlive = true;
        private float yPosition;
        private float seeRadius;
        private Point frameSize;
        private SpriteEffects spriteEffect = SpriteEffects.None;
        public Vector2 position;
        public Color viewFinderColor;
        private Matrix camera;
        private Camera2d cam, cam2;
        private Effect mask;
        private Texture2D pointer;
        private Texture2D lens;
        private Texture2D pointRender;
        private Texture2D maskTexture, finalMask, flippedFinalMask;
        private Texture2D texture;
        private RenderTarget2D renderTarget;
        private GraphicsDevice graphicsDevice;
        public PlayerIndex playerIndex;
        private FallingMan cat;
        static public bool[] playerView = new bool[4];
        public RenderTarget2D finalTarget;
        public Texture2D finalTexture;
        
        #endregion

        #region Constructors
        public ViewFinder(Game game,Vector2 position, Texture2D texture, Point frameSize, Color viewFinderColor, GraphicsDevice graphicsDevice, PlayerIndex playerIndex)
        {
            mask = game.Content.Load<Effect>(@"Shaders\viewMask");
            pointer = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\pointer");
            lens = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\lens");
            maskTexture = game.Content.Load<Texture2D>(@"Sprite\ViewFinder\mask");
            cam = new Camera2d();
            cam.Zoom = 3.5f;
            cam2 = new Camera2d();
            cam2.Zoom = 6;
            this.position = position;
            this.viewFinderColor = viewFinderColor;
            this.texture = texture;
            this.frameSize = frameSize;
            seeRadius = this.frameSize.X;
            this.graphicsDevice = graphicsDevice;
            this.playerIndex = playerIndex;
            PresentationParameters pp = graphicsDevice.PresentationParameters;
            renderTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24);
            finalTarget = new RenderTarget2D(graphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, true, graphicsDevice.DisplayMode.Format, DepthFormat.Depth24);            
        }
        #endregion 

        #region Update
        public void Update(GameTime gameTime, Vector2 position, Matrix camera)
        {
            //Update Postion
            this.position = position;

            //Update Cam1 Position
            cam.position.X = position.X + (frameSize.X / 4);
            cam.position.Y = position.Y + (frameSize.Y / 2); 
            if (position.Y < -camera.Translation.Y)
            {
                yPosition = 10;
                spriteEffect = SpriteEffects.FlipVertically;
                
            }
             	
            else if (position.Y > -camera.Translation.Y)
            {
                yPosition = graphicsDevice.Viewport.Height - pointer.Height;
           	
            }

            //Update Cam2 Position
            cam2.position.X = pointer.Width / 2;
            cam2.position.Y = pointer.Width / 2;
            this.camera = camera;
            
        }
        #endregion

        #region Draw
        //Call this first to draw the ViewFinder to a RenderTarget
        public void PreDraw(GameTime gameTime, SpriteBatch spriteBatch, params Object[] objects)
        {
            

            mask.CurrentTechnique = mask.Techniques["Technique1"];
            graphicsDevice.SetRenderTarget(renderTarget);

            graphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };

            // Draw the scene
            graphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(graphicsDevice));
            
                  
                spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height), Color.White);
                                 	
          
            foreach (Object obj in objects)
            {

                if (obj is List<Platform>)
                {
                    foreach (Platform platform in ((List<Platform>)obj))
                    {
                        if (Math.Abs(platform.position.X - position.X) < seeRadius && Math.Abs(platform.position.Y - position.Y) < seeRadius)
                        {
                            platform.Draw(gameTime, spriteBatch);
                        }
                    }
                }

                else if (obj is List<PowerUp>)
                {
                    foreach (PowerUp powerUp in ((List<PowerUp>)obj))
                    {
                        if (Math.Abs(powerUp.position.X - position.X) < seeRadius && Math.Abs(powerUp.position.Y - position.Y) < seeRadius)
                        {
                            powerUp.Draw(gameTime, spriteBatch);
                        }
                    }
                 }
            }   
            spriteBatch.End();



            graphicsDevice.SetRenderTarget(finalTarget);
            pointRender = (Texture2D)renderTarget;
            graphicsDevice.Clear(Color.CornflowerBlue);



            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask, camera);
            mask.Parameters["spherePort"].SetValue(pointRender);
            mask.Parameters["mask"].SetValue(maskTexture);
            spriteBatch.Draw(pointRender, new Rectangle(-50, -(int)camera.Translation.Y, pointRender.Width, pointRender.Height), Color.White);
            spriteBatch.End();

            
            
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam2.get_transformation(graphicsDevice));
            spriteBatch.Draw(pointer, new Rectangle(-19, 0, pointer.Width +39, pointer.Height), null, viewFinderColor, 0.0f, Vector2.Zero, spriteEffect, 0.1f); 
            spriteBatch.Draw(lens, new Rectangle(-19,0, lens.Width + 39, lens.Height), Color.White);
            spriteBatch.End();
            graphicsDevice.SetRenderTarget(null);
            
            finalTexture = (Texture2D)finalTarget;

       	
            
        }

        //Call this second to Mask the ViewFinder to have multiple on screen
        public void DrawViewFinder(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, mask);
            mask.Parameters["spherePort"].SetValue(finalTexture);
            if (spriteEffect == SpriteEffects.None)
            {
                mask.Parameters["mask"].SetValue(finalMask);
            }
            else
            {
                mask.Parameters["mask"].SetValue(flippedFinalMask);
            }
            spriteBatch.Draw(finalTexture, new Rectangle((int)position.X, (int)yPosition, 100, 100), Color.White);
            spriteBatch.End();
        }
        #endregion
    }








And then here's the Mask HLSL Code





texture spherePort;
texture mask;

sampler TextureSamplerSphere = sampler_state
{
	Texture = <spherePort>;
};

sampler TextureSamplerMask = sampler_state
{
	Texture = <mask>;
};

// TODO: add effect parameters here.


float4 PixelShaderFunction(float2 TextureCoordinateSphere : TEXCOORD0, float2 TextureCoordinateMask :TEXCOORD0 ) : COLOR0
{
    // TODO: add your pixel shader code here.
	
	
    return tex2D(TextureSamplerSphere, TextureCoordinateSphere) * tex2D(TextureSamplerMask, TextureCoordinateMask);
}

technique Technique1
{
    pass Pass1
    {
        // TODO: set renderstates here.

        
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}






Thanks for the Help :D

In Topic: Using XNA RenderTargets

16 October 2011 - 01:36 AM

No I haven't but doesnt that cause issues with the Xbox 360?

PARTNERS