Showing posts with label XNA. Show all posts
Showing posts with label XNA. Show all posts

Sunday, 15 August 2010

Shader Based 2D Shadowing



Those who know me know I used to do quite abit of development in c# using Microsoft's XNA platform.

Well I like to check back in every now and then with some of the big players in the community to see what's going on.

One of those players is Catalin Zima, who is famous for producing many great shader and effect samples.

One of Catalin's reccent project particularly caught my eye however as I had tried to tackle the same problem several years ago when I was in my final year of university. That is, Dynamic 2D Shadows Calculated on the GPU (http://mikecann.co.uk/university-projects/shadowshader-in-rendermonkey/)

Catalin's approach to the problem is far more elegant that my brute force iterative approach. He uses a clever technique of distorting the desired casting image about the light in such a way as not to require iterative pixel lookups.

If you are interested in the more details in the technique I encourage you to check it out over on Catalin's blog: http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/

Saturday, 1 August 2009

LieroXNA - Digging up the past..

I received a very pleasant email yesterday from a fine chap Michael Lindholm. He was enquiring about my old project LieroXNA and whether I was still working on it. As it sound like some people are still interested in the project Ill copy / pase the email for the record here:

Hi mike :)

I have read your blog several times now over the last few months(about LieroXNA) and thought i should just let you know i find your LieroXNA project very interesting :)
very impressive work with those particles aswell, very nice work :)
infact... not to long ago i was in the IRC channel #XNA and people was talking about "that XNA liero game with all the particles" so apparently you have made an impression on the world ;) hehe

but the last post seems to be from 2007, are you still working on the project?

Also, One thing that makes me very interested in Liero and XNA related projects is the fact that i am my self working on a Liero3D game in XNA, if you are interested you can find info about it here:
http://liero3d.blogspot.com/

PS: Sorry about my bad spelling (Dyslexia)

take care
/Michael
------- and my reply: --------

Hi Mike,

Firstly its great to hear from someone who appreciates my work. Im surprised that people know about my old little project. Unfortunately it is a dead project now :(

I actually took the game to a high standard, and took it to eidos publishers in Wimbledon to see if they were interested in the game. Unfortunately, despite the backing of my employers Eidos werent interested in an XBLA game not after their other XBLA disasters. From that point on I lost heart in the project, I dont know why but I didnt want to continue it on any more.

Whats worse is I have actually lost everything! I have lost the source code and the binary everything, I cant believe my own stupidity. All I have left is a power point presentation and some screenshots :(

lieroxna1lieroxna2

The game play was actually very good fun, we played quite a few 4-man games in the office.

I may pick up the project again some point in the future, but it wont be for profit, it will be for fun.

I just checked out your 3d-liero project and I must say it looks very interesting! How are you doing the 3d destructibility? Voxels with a polygon mapping algorithm? Have you ever heard of voxlap? http://advsys.net/ken/voxlap.htm very interesting project from a while back, was very interested for a while, was thinking of woking on a voxel engine for my university, but decided against it in the end, the complexity is immense.

Well anyways, im starting to ramble, its good to see you continuing on with liero and I wish you best of luck, ill be watching with keen interest.

Mike
Well the result of this is I have been digging around and have found "some" old source code, its not complete, but over the coming weeks im going to take a look at it and see if I can get it in a state where I can post it up here, it would be a shame to let this one rot.

Wednesday, 11 March 2009

XNA Archive

I just realised some of my old XNAGPUParticles project videos have gone walkies. So I have reposted them on youtube. These are my old projects from my final year of uni, binary and source code can be found in the relevant post for each video.

http://www.mikecann.co.uk/?p=163
httpvh://www.youtube.com/watch?v=vxrg1YavBIg

http://www.mikecann.co.uk/?p=169

httpvh://www.youtube.com/watch?v=3wdIiCCAb9U

I have another reason for these old re-posts, something a little more flash orientated.. Stay tuned for more info ;)

Sunday, 3 February 2008

PlaceEd 3

Recently I have been working on some small tools for the lads at work to aid them in designing mobile phone games.


One project I have been working on for a while (in my spare time at work and in the evenings at home) is a new version of PlaceEd. PlaceEd is a small app used by people at work who need to design levels with objects and paths in them.


The reason for making this new version was because the original was starting to show its age and after several modifications to customise it to certain projects it has become unreliable. A second version (PlaceEd2) was half coded by one of the other employees at rockpool though they ran out of time and didn’t complete it.


So that’s where I come in, and I wrote from scratch a new app and called it PlaceEd 3 (even though there wasn’t really a fully released version of PlaceEd 2).

Wednesday, 30 January 2008

XNALiquids 03

Well i was just thinking in work today that it may be possible to detect the bounds of the the particle "clusters" and then line drawing the boundry and then you wouldnt notice the compression that the particles tend to suffer from.


When i got home i tested out my theroy and the results can be seen below. Its pretty obvious that its not perfect but as i say it was just me messing.


Oh BTW grant kot has been working on his polluted planet some more, and its starting to look quite impressive now its over in XNA: link1, link2



Thursday, 17 January 2008

XNALiquids02

Okay well i have been playing around with my particles AGAIN :P

I started this time from some work done by the CUDA team over at NVidia. As im running windows Vista i couldnt get CUDA to work so i read through the source and adapted it to my needs.

As you can see from the video below its better than my last attempt but still not perfect, it also still runs on  the CPU on a single core and has had no optomisations applied to it.

Hopefully tho i can build on this to make it better.

Saturday, 5 January 2008

XNALiquids 01

Well after seeing what Polluted Planet did with large numbers of interactive particles in java, it got me interested.

So i have decided to have a go at implementing it myself in XNA.

So here it is, my first attempt at it. Currently the algorithm is very rough as you can see from the video there are still some problems that cause the particle to behave a little... umm.. erratic ;)

Hopefully with abit more time and effort ill get it sorted. At the moment there are 5000 interacting particle on one CPU, hopefully i will beable to push that figue up soon and take advantage of my quad-core system :)

Tuesday, 18 December 2007

XNA 2.0 && Silicon Minds


Well its that time again. XNA 2.0 has been released and with it a new Dream Build Play competition.


As a warm up to the competition Microsoft have launched a smaller contest named Silicon Minds. The central idea behind this contest is to encourage A.I. in games and as such 60% of the marks will be given to the quality of the AI in the game a further 20% given to how fun the game is and a final 20% given to the polish of the game.


I have been wracking my brain trying to think of a good project to do for this contest, some of the ideas i came up with were:



  • Bee Swarm Game

  • Dynamic FPS Difficulty

  • Particle Flocking

  • Learning Geometry Wars

  • Predictive Multiplayer

  • Adaptive Level Design

  • DNA Designer

  • Design a Positronic Brain


In the end i decided that due to how short the competition is (ends jan 27th) and my lack of any A.I. experience I would stick with what I have learnt in the past and develop on that. So using the work i have done on LieroXNA so far im planning on writing an A.I. for a deformable 2d landscape.


Sorry i cant say any more at this stage but stay tuned and ill update in the near future.

Wednesday, 5 December 2007

Project Technology (Deformable Terrains)

Well i got asked a question in a comment on how the terrains work in the LieroXNA project so I thought i would do a quick post on this rather than reply in the comments.


The way the terrains work has changed a few times over the course of development of the project for various reasons mostly related to the incompatabilities of the 360 and my previous methods. I wont go into those previous methods here but if anyone reading this has any questions dont hesitate to ask in a comment or email me. I would also like to say this may not be the most efficient method as I was only getting the terrains up as a proof of concept first then was planning on refining later.


Sunday, 11 November 2007

Project Update

Well its been a while since i have posted an update regarding the LieroXNA project. I havent been slacking. 


I have been spending the majority of my time getting it to run on the 360. I ran into many problems, the majority of which were due to the different ways render targets work on the 360 and the fact that you cant use 128bit floating point textures (Vector4 textures).


Ill be going into more depth on the problems i faced on the 360 in a different post. But what i can say is that it works almost perfectly on the 360 now and im very happy with it.


For now you can see a new video of the engine with some fancy bloom effects added :)


Sunday, 30 September 2007

LieroXNA - Improvements and Additions

Been a while since I have posted about LieroXNA but I havent been doing nothing. Changes and things:

+ Added a destroyed layer to the game which is just the initial map but darker.
+ Added a shadow to the foreground to give it a more 3D appearence.
+ Added an indestructable layer, so that maps can have abit of structure even after a long battle.
+ Added the ability to zoom in and out. This was a big one and took most of last weekend to sort out.
+ Added player spawning.
+ Added the ability to control the player with the 360 controller.
+ Started to add other gameplay features such as player jumps, crosshair, weapon switching things and others.

Anyways you can see all these new features in action in the video below. Again, you can download a higher quality one if you wish: [download#1]



<

Sunday, 16 September 2007

LieroXNA - Weapons and Forces

I have been working hard on LieroXNA this weekend and have managed to get quite abit of what I wanted done.

Firstly I worked on setting up a framework for weapons that allows them to be described by an external xml. This should reduce the effort involved in creating new weapons in the future. Taking a quick look at the XML that describes the rocket weapon you can see its straight forward but also pretty powerful:


<?xml version="1.0" encoding="utf-8" ?>

<weapon name="Rocket" type="projectile">
    <properties>
        <texture>rocket</texture>
        <trail>smoke</trail>
    </properties>

    <events>
        <onTerrainCollide>
            <spawn type="explosion" size="64"  where="this" velocity="this" />
            <spawn type="shrapnel" quantity="10"  where="this" velocity="this" />
            <die/>
        </onTerrainCollide>
    </events>
</weapon>


In addition I have been working on adding forces into the game. It took abit of tweaking but now explosions have a force which repels particles around it, you can see this in action in the video below. I have also added a "vortex" special weapon that sucks particles towards it which then swirl around until the vortex implodes expelling all the particles.

The size of the world has now been expanded and a simple camera has been added. Previously the intention was the world was to be split into multiple tiles of 1024x768 textures but i have now decided against that due to the level of complexity involved and gone for a system that uses one large texture (2048x2048 currently) instead. I have also changed the texture so its a little less "programmer art" as I was getting some stick for that :P

There is still alot of work to be done but im happy with the way it looks at the moment. You will have to excuse the video quality below, flash isnt the best compression for alot of fast moving small particles.

If you want to see a larger less compressed video (35meg) you can download it HERE.

Wednesday, 12 September 2007

I cant stop playing with particles..

Well I have been at it again, tweaking and altering the particles in LieroXNA. You can see a video of my results below.

+ Particles now represent the pixel they exploded from. i.e. if the terrain was green the particle is green, if it was blue the particle is blue etc.
+ Particles are now more white (hot) depending on how fast and how old they are.
+ Particles now explode in a circular direction and less randomly (looks more like an explosion).
+ Particles now have a direction from which they are exploded, at the moment is just current mouse position - last mouse position but in the future this will be used to blow particles away from a high energy collision.
+ Particles now react to the player. I realised that instead of just passing in the terrain texture to the particle update routine i could pass the entire back buffer allowing the player and any other objects in the scene to have particle reactions, yey!
+ Particles now have a bit of alpha blending to make them look a little less in focus, not sure if this works well, let me know :)

Monday, 10 September 2007

Liero Update - Console & ATi

Well I took Liero into work today just to show to a few people who were interested and to test it on another machine other than my own. And low and behold it didnt work on my work machine which was no surprise as it doesnt have a graphics card so it fell down at the first hurdle. I then went to test it on an artists ATi based machine expecting it to work. It did but sadly there were no particles.

Well after digging around abit, I discovered that it was the same problem I encountered before when I released my 1,000,000 particles demo a few months ago. The problem is that ATi dont include the ability to use Vertex Textures in their graphics hardware (the core technology allowing me to get many particles on the screen). I knew the solution from previous work was to use ATi's alternative Renter To Vertex Buffer (R2VB) unfortunately I could not find anyone else that had done this in XNA before which led me to the suspicion that it wasnt possible. I posted on the XNA forum about this, you can see the replies here.

Anyways to cut a long story short I have not been able to implement R2VB for ATi cards but I have instead done the next best thing which is to implement a CPU particle system instead. This means that people with realy old cards (or like my work machine without a card atall) or people with ATi cards they can still play the game and still have particles, just not as many (200-400k on nVidia, 10-50k on CPU).

Also something I implemented over the weekend was this fancy console which, makes life alot easier for me when developing, isnt it nice ;)

Sunday, 9 September 2007

Liero + 200,000 Particles

Been workin on this abit this weekend and managed to intergrate my earlier work on GPU particles with the game to create some nice effects. See the video below to see thousands of particles being blown in many different directions.


Thursday, 6 September 2007

LieroXNA - A Tentative Beginning

Okay I have decided to start a new mini pet project. As you may have guessed by now I have stopped work on the TDProject. The reason is that it is too large of a project to take on at the same time as having a job, should I ever find myself without a job in the future I may pick it up again.

So the new project is designed to be alot smaller than the last and should give a more immediate sense of achievement. The project is going to be a clone of the popular game Liero but for XNA (so xbox eventualy). For those that havent played it, its a real-time 2D action game (basically worms without the turn based tedium).

So far im just playing around with getting the core of the engine up and running. The original Liero and its successive clones were all done in C/C++. In those languages you have the ability to pixel blit, that is write directly to the back buffer one pixel at a time. In XNA/C# however you dont have that ability, so you have to do some funky stuff with shaders. The advantage of doing it this way however is that GPU particles that have physics (can bounce around the level) should fall out of the code nicely allowing for large numbers of particles.

Anyways, as I said its just a beginning for now. So far I have a level rendered with a terrain map, an explosion map (renders explosions to the texture each frame if any occurred) and a collision map which allows objects to collide. With the left mouse button you can blow holes in the terrain which in turn updates the collision map allowing the worm to move around more of the level.


Tuesday, 29 May 2007

Picking and Bounding Boxes



Got the next essential small step of the project in today, picking, that is selecting an object that exists within a 3D world from a mouse click in the 2D world. Found some really good resources for this including the Hazy Mind site again and a new one I discovered by accident by Charles Humphrey. I had a little trouble at first with working out how to calculate a bounding box, but yet again the XNA community came to my rescue. Thanks to Andy and his blog I now have a custom content pipeline that generates a bounding box for my mesh automatically.

Now that you can select a unit on the map the next step will be to add the ability to add properties and *gulp* custom scripts!

Sunday, 27 May 2007

Unit Placement

I have to be honest I haven't been working as hard as I could have recently on the TD project. The reason for this is that I have been trying to decide whether to progress with it atall. I believe it is an awesome project and will be successful, however each time I complete something in the project it adds to the complexity never subtracting from the amount of work remaining.

I finally however decided that I would stick it out as my mantra goes "Your success is only measured by your accomplishments". If I constantly keep starting new projects then I will never accomplish anything and therefore never be successful.

I had a long chat with my new friend Ebor Jan Folkertsma about different technical challenges associated with developing a tool and a game engine in tandem. The chat was extremely useful in the fact that it allowed me to take a more objective view of the project and split it down into simple tasks rather than getting swamped by the enormity of the project. It also made me feel like I wasn't sailing into uncharted waters, there were others out there that had run into similar problems and had come up with solutions to solve it. Basically Ebor gave me a big morale boost which encouraged me to stick with this project.

So onto the progress. Well as I said not a whole lot of visible progress has been made, I have mostly been re-organising the core of the project again to best suit my needs. I have however been adding more functionality allowing the user to place objects on the level in preparation for setting triggers and the like later down the road.



Next step in the project is picking so that the new objects on the map can be selected and have their properties modified and triggers added and the such :)

Tuesday, 22 May 2007

TD Terrains

Well i havent updated in a while one the TD project, not because I wasnt working on anything but mainly because i have been struggling with the nuts and bolts of 3D RTS game development.

Normal game development is fine when you only expect ever to have your game to simply run. When you want to make it run as a game but also act as a tool at the same time you have problems. The way the TD project is structured we have a game "Engine" project that contains all the code to display our objects on the screen, then we have a "Tool" project that contains all the code for making maps, it creates an instance of the Engine so that it can render those objects. We also have a "Game" project that will be the actual game and will contain all the other game type logic like menu systems etc.

Getting all these to work nice and happily and in an efficient way is proving to be umm difficult. The problem is confounded by the fact that the tool requires multiple rendering windows to display things at once, causing me to redesign alot of the way the game works. When you only have one window open you can set classes to be static all over the place, but if you need those classes to interact in a non static way then you have to use managers to sort out how they should interact, introducing more complexity nightmares!

But anyways, enough of that. Time for pretty pictures:



As you can see Mr Graham 'Golden' Furner has been making good progress on his terrain generation algorithm for the project. Hopefully I will beable to get enough of the structure in place so we can begin to merge the two parts of the project together!

Wednesday, 9 May 2007

Docking Nightmares



The tool has to be functional, elegant and fun. For that I wanted a special UI for it. I loved what the team had done over at Blade3D and i wanted something similar. Unfortunately they paid at least $300 for thiers, and hence this wasnt realy an option for me just yet :P

So for now im stuck with an old 2005 style UI. To spice it up abit I decided to add docking panels. I had worked with docking panels before for my ChainReaction project in Java but hadnt done one in C# before. A quick search on sourceforge came up with DockPanel Suite.

It certainly wasn't as easy to pick up as when I did docking panels in Java, but I eventually got it. The toughest part which I still haven't sorted out 100% is rendering a XNA window into a docking panel. As XNA runs using a DirectX graphics device its very picky about loosing its rendering state. So if a user undocks the window and moves it about and then redocks it, it doesnt like it due to the loss of rendering state. For now the XNA window has been fixed so that it cant be undocked.

As you can see in the screenshot above I have added some visual properties to the BlueprintEditor so that you can affect how its rendered, its all working beautifully.

The next step is to get the blueprints being placed on the grid so that you can build the level.