First “Persistent” WP7 App

…. did I mention it’s simple?

… very simple, indeed.

The end result is a WP7 app that upon launch, displays “Not Logged In” for a few moments. That text changes to “Josh is cool” after a few moments.

The back-end is this: An asynchronous WCF service call is kicked off upon app initialization and the “Josh is cool” is returned from a VM in my home network that hosts some WCF service endpoints. The call from the WP7 app is done over the public internet, through a homedns.org subdomain that points to my home IP (maintained by good ol’ DD-WRT on my router). There is a DB on another VM that serves up the data. The services get deployed to the services machine by an Atlassian Bamboo (backed by Crowd) instance that polls a Bitbucket.com code repository that I commit my code changes to via Tortoise Hg (Mercurial source control).

How to make it all better? Besides more interesting end-user results…. heh heh… I want to use full AD authentication for all intra-network communication, I want to have Atlassian Crowd use the AD domain accounts, I was cleaner DNS names, I want something along the lines of an API key the WP7 app has to submit (not sure about the best implementation there), and I want https-secured communications. Maybe I need to get some third-party hosting solution for this.

I did all the non-primary infrastructure code creation and configs in about 1.5 hours… I’m getting faster and more efficient :)

Posted in Uncategorized | Tagged , , , , | Leave a comment

Improved Sidescroller

I improved my initial attempt at a sidescroller… well, I rewrote the whole thing (I’d recommend that when learning new stuff, by the way). This one is a copy of an existing game my 2 year old seems to really enjoy. It’s just a train engine on the screen with a moving background, and periodically object fly across the screen. When you tap them, they either play a sound, change the color of the train engine, or add a flatbed train car that acts as a collection thing for up to three objects.

In about an hour and a half I got a simpler version working: the engine is there (no animation though), one type of flying object – a paintbrush – that has a variable delay, size, altitude, and color effect. When you tap the paintbrushes, they disappear, the train engine changes colors, and a new paintbrush will shortly fly across the screen again. I make sure the new color is different than the existing train engine color too. whee

I had some troubles with how to randomly select a color. I didn’t see an obvious way to do that, and it was taking too long to get an “enum” list working that would allow for a poor-man’s “probability block” (“if” statements that chooses one of the colors based on a random number generator). So, I just did the poor-man’s “probability block” with manually defined colors inside the “if” statements.

I’ll be trying what I think may end up being “attachment points” on the main train engine.. hopefully I can get it all to be scalable too.

Posted in Uncategorized | Tagged , , , | Leave a comment

3D in XNA on a WP7

Drawing primitives is not simple… well, it’s a bit overwhelming at the moment. I’d like to be able to do efficient visual “stuff” though, so I bet knowing how to do it all will be good.

I’ve not wrapped my mind around it all yet, but here is a post I found rather helpful:

http://labs.vectorform.com/2011/09/xna-primitives-on-windows-phone-7/

It’s a working example (you need to add “” in the line:
texture = Content.Load(“Tree”)

You also need to import the “Tree.png” file (just drag from you desktop into the “ (Content)” portion of your project.

By parameterizing things in the “LoadContent”, or rather, changing things you loaded in the “LoadContent” method in the “Update” method, you can move the camera all over, move the tree, spin things. Make it all based on gestures, and, well, you have a first 3D “I-hesitate-to-call-it-a-game” game.

Posted in Uncategorized | Tagged , | Leave a comment

WP7 Physics

Simple physics, like bouncing off walls, gravity, and collision detection are fairly straightforward. What about what collision results of objects of various sizes, masses, shapes, etc? A friend at work mentioned how great it is to just find a physics library and use it for as much as possible, preferrably one you could use in a for-profit project. I came across the Farseer Physics Engine. It’s supposed to perform well on WP7 (and of course XBox and PC, since it’s XNA-embracing and all). I’ve only just cracked it open to look at the sample projects, but assuming some more research and experience proves it to be reasonably future-friendly, I’m going to quite simply leverage it to the hilt.

Posted in Uncategorized | Tagged , , , | Leave a comment

WP7 Touch Gestures

Writing this post as I go, so it’ll be a bit stream-of-consciousness…

I want to understand how touch gestures work on a Windows Phone 7 device. I have an HD7, incidentally, so I’ll be ultimately testing whatever I make on it after I have done stuff on the emulator that comes with the WP7 SDK (pretty slick doodad, that).

I did a bit of searching, and I’ve settled on this blog post as a starting point for now: http://blogs.msdn.com/b/nicgrave/archive/2010/07/12/touch-gestures-on-windows-phone-7.aspx

Ok. I’m back. I have something that works. There are some refinements to the gesture processing, but this actually responds within reasonable expectations, gesture-wise. I’m effectively just reading the inferred gesture (as determined by the GestureSample class) and then modfying the applied user-input delta according to my rather quick/basic testing. I found that if yu divide the Flick gesture’s delta by 2, it behaves pretty well. If you double the FreeDrag gesture’s delta, it behavew pretty well.

You need to explicitly define which gestures your application is looking for in your initialization method (fewer = better performance). Here’s what I have:

//enable various gestures
TouchPanel.EnabledGestures = GestureType.Tap |
GestureType.FreeDrag |
GestureType.Flick;

In my Draw method, I process gesture input deltas with this:

//read all queued gestures
while (TouchPanel.IsGestureAvailable)
{
GestureSample gesture = TouchPanel.ReadGesture();

switch (gesture.GestureType)
{
// TODO: handle the gestures
case GestureType.Flick:
delta = gesture.Delta / 2;
break;
case GestureType.FreeDrag:
delta = gesture.Delta * 2;
break;
}
}

Posted in Uncategorized | Tagged , | Leave a comment

PlayOn on Windows Server 2008r2

When you try install PlayOn on a Windows Server 2008r2 machine, you may get an error about needing to have Windows Media Player 9 “stuff”. When you go to the URL it provides (download page), you don’t see any download that specifically applies to 2008r2, and if you try the download for plain 2008, it doesn’t install.

Well, you need to go to “manage my server” and install the “Desktop Experience” Feature. Reboot. Install PlayOn. Win.

Posted in Uncategorized | Tagged , , | Leave a comment

Windows Phone 7 Game Dev – 1

First WP7 game.
Using VS 2010 Express, both the Windows Phone 7 SDK and Web Developer Express. All done in C#. No real driving goal; I’m going to go with the flow and see where it takes me.

For my first attempt, I rather simply copied-and-pasted the sample project here: http://msdn.microsoft.com/en-us/library/ff472340.aspx. After that, I added in some basic logic to make one of the blocks follow the user input. After that, I threw in some score tallying, and here is where I ran into my first problem. I couldn’t get the score text to render correctly. Every time it came out as black blocks.

I eventually came across this blog post: http://rbwhitaker.wikidot.com/drawing-text-with-spritefonts. It triggered the thought that maybe I couldn’t duplicate a “spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);” statement block. Yeah, that was the problem. Add the “spriteBatch.DrawString(……);” line for the font rendering, and it worked like a charm. Now to figure out how to get the font to render in the top-right regardless of screen rotation (never done that before).

Posted in Uncategorized | Tagged , , | Leave a comment

What do you really need to know?

If you figure out all the below, like, actually do them all individually, you will be well on your way:

Excel
Pivot Tables
SQL Server installation (account security, file locations, backups, restores)
Joins, Updates from data in another table, deletes based on data in another table, index optimization.
Get data from a text file into a table, and vice-versa
Visual Studio (.NET) – Web Developer, C#
Create a Web Service
Consume a Web Service
Install Windows Server, turn on Windows Firewall, then punch holes for SQL Server, then access that SQL instance from another computer.
Understand why you would need to set up a static route (networking).
Set up a software load balancer and balance traffic between to (or more) servers (web traffic for simplicity)
Source Control (set up some SVN server and then access that SVN instance via Tortoise on another computer.

Posted in Uncategorized | Leave a comment

Marx’s Revenge Some More

The Communist Manifesto has great points up until where it outlines the points that it asserts generally apply to advanced capitalist nations. And then it goes squarely into replacing one set of cultural elite with another, seemingly via force. Up until that section, there are some excellent points, but the conclusions on what ought to be done lacks the recognition that the problem he is railing against (cultural elites that largely control the population through exploit) is exactly that, a cultural problem. Cultural problems cannot be “fixed” by external forces. Their fundamental form consists of some critical mass of individuals all behaving in very similar ways, all without conscious edict. Identification of “problematic” cultural norms can only really be done when viewing the population in aggregate.

An example is in order. Taken in isolation, a single individual’s decision to not assert his or her concerns on a nearly-solidified decision because he or she believes it’s “not appropriate” or otherwise “unwelcome” can be interpreted as not that big a deal, even a sign of respect. However, taken in the aggregate, with thousands of people, if not millions, behaving in similar ways in their day-to-day lives, it becomes a significant factor in the overall economic climate of that social group. It becomes a social norm to not assert one’s views. One result is a disproportionate representation of the viewpoints of those people with assertive personalities. Going by Strengths Theory, this becomes a cause for concern, due to the fact that an individual is only ever really really good at 5-6 strengths (out of about 36); if 2 of those are taken up by self-assurance and optimism, it means a severely diminishing possibility of the individual containing exceptionally good decision-making skills. At the best, you simply have very few people who embody the necessary analytical strengths for great decision-making as well as the [culturally] necessary ideals of strength of conviction and charisma.

My point is that Marx identified a crucial, more fundamental way of looking at human sociological development, but he missed the bus on what ought to be done. He advocated a Proletariat revolt as the best way to get the underclasses up. He should have been thinking in terms of how to get the underclasses to “flourish” where they’re at. heh heh… he should have been writing self-help books.

Posted in Uncategorized | Leave a comment

Marx’s Revenge

I finally found and finished “Marx’s Revenge” by Meghnad Desai. I found it to be rather engaging. Part of my interest is in how Desai plows through the “short 20th century” in the detail and matter-of-factness of someone who obviously loves the subject matter.

His first-hand knowledge of the goings-on in economic and political thought allows him to provide a strong context for the various hot debates. Much how “Glimpses of World History” by Jawaharlal Nehru moves through historical events fast enough and with enough references to concurrent events worldwide so as to allow for what could be thought of as a holistic approach to history, Desai does the same for Political Economy. If you’re into Economics and the historical roots of why things are the way they are, I’d recommend it. Just make sure you read it quickly – it’s quite densely packed.

Desai’s “Marx’s Revenge” point is fairly interesting, if a bit of a stretch: Karl Marx was actually a Libertarian. His whole point about things becoming “socialist” was that one day, long from now, after everyone on the entire planet has for 2 generations or more been very consciously behaving as free-market capitalists will they sort of realize, “Hey… how funny… I’m acting like a socialist.” Their motivations will be fundamentally that of self-interest, but the efficiency with which they are able to do what they want to do has, in the aggregate, resulted in such low costs of living that everyone is effectively wealthy (material needs are absolutely met such that a significant portion of one’s time is spent following one’s passions). He saw that once everyone has become fully “capitalist” in their fundamental assumptions about life, human interaction, and how things ought to be, then strangely enough, they are actually socialist. Fascinating topic, this.

Posted in Uncategorized | Leave a comment