WP7 support

Apr 2, 2011 at 12:23 AM
Edited Apr 2, 2011 at 1:12 AM

All the great work going on here has inspired me to have a play to see if we could support WP7 (since i've just got a new phone). Everything compiles fine under the Reach profile if you modify the effects to compile with shader model 2 (no complaints about vertex buffer sizes so far but that may be an issue), but on its own thats no real use given that the current version of XNA on WP7 doesn't support custom shaders.

I've got basic block rendering working fine with BasicEffect and I think i've got a sneaky way to emulate lighting by using the DualTextureEffect with the second texture just being a black image with the alpha channel gradually increasing in one direction which would allow the block lighting to be emulated by setting the texture coordinates for the 2nd texture to the correct place in the image for the light amount. 

Since the WorldRenderer/ChunkRenderer/VertexBlockRenderer for WP7 are going to be very different than the current implementations and WP7 is unlikely to be able to support all the final features in the main engine - What are your thoughts on creating interfaces for IWorldRenderer/IChunkRenderer/IVertexBlockRenderer so we can have different implementations for different platforms? - Enomi's new code structure would make this very easy.

It would also require some minor rejigging of the content to move the shaders into a non WP7 content project since they won't compile for that platform.

Anyway i'll try and get a proof of concept working this weekend and create a fork for people to have a play with.

Apr 2, 2011 at 1:52 AM

Cool. I m glad my refactoring talents inspire so much talented people!

Apr 2, 2011 at 2:42 AM
Edited Apr 2, 2011 at 2:46 PM

Just got the dualtextureeffect lighting working - just applies a random light to each cube face at the moment.

edit - [File removed see later post for latest version]

Hopefully i'll have a version for WP7 tomorrow - dunno what the performance will be like, but i'm off to bed now.

Apr 2, 2011 at 9:46 AM
Edited Apr 2, 2011 at 9:56 AM

I was looking at ambient occlusion before, and using the dual texture effect. This is a great idea.

The code from the mentioned dropbox works fine. Thanks for the POC, i will have a play with it.


And the idea of interfaces for the renderer sounds good too. Im looking at different terrain generation, and IChunkBuilder at the moment.

Apr 2, 2011 at 10:27 AM

I was thinking about doing a kind of fake AO while i was doing the lighting - as long as you passed in some extra information to the BlockFaceRenderer about the surrounding blocks you could do the AO and lighting by having a texturelibrary of shades with the AO effect prebaked in as well, although it may be better to use a SSAO post process effect in the main engine if we also want to implement things like colored lighting etc.

Apr 2, 2011 at 10:37 AM

Exactly that, i was thinking of faking AO using a dual texture.

Is this something you are thinking of adding in this weekend too?

Apr 2, 2011 at 1:18 PM
Edited Apr 2, 2011 at 1:32 PM

I'll have a play around and give it a go, should be very similar to what i'm doing anyway.

edit - The code above actually works pretty much as is on windows phone - remove the original techcraft projects create a copy of the newdirection project for wp7 - remove the solid block shader, the serializable attributes on the vertex defenitions and the using statements which the compiler moans about and it runs fine....well apart from the fact that it's almost impossible to control, but i'll read up on wp7 this afternoon and put some proper controls in.

Apr 2, 2011 at 2:52 PM
Edited Apr 2, 2011 at 5:01 PM

Ok latest demo is here


video of it in action here


This is just the WP7 project - i've added virtual thumbstick support from the App Hub sample, and moved the camera to a nicer start location. Tap in the upper area of the screen to build - some issues with DoubleTap at the moment so no digging.

It seems to run sweet - will play around with fake AO later. I'm also going to investigate whether i can do an http comet (http://en.wikipedia.org/wiki/Comet_(programming)) connection from WP7 which would be needed for networking since the phone only supports http connections - might be horribly laggy for multiplayer tho but v. cool if it works. Perhaps we could do a free creative mode style minecraft on the phone to promote the engine ;)

May 4, 2011 at 5:13 PM


I was hoping to try and help with the WP7 Techcraft project however the dropbox is 404 now and I can't seem to locate the right fork. Can someone point me in the right direction :)?

May 5, 2011 at 4:03 PM
Did you finally find the experimental WP7 zip ? We are not developing
this currently but if you want to work on your own wp7 fork, i can
send you the zip, just email me at enomi.enomi gmail , ill send you
the zip in reply .
Sep 23, 2011 at 11:13 PM

Anyone still have the zip for this?   The dropbox link is dead.