Block Jump project

My boy fairly regularly asks if he can see my game [on the phone]. I haven’t made anything new in about a week now, and his asking has been a reality check that if I’m serious about learning the game programming craft, I need to be pretty harsh about actually producing stuff as often as I can.

To that end, I added features and polish to my Block Jump game. The main character, a happy face is now of higher resolution and handles transparency better, an exploit has been fixed, there is a score multiplier based on how long you can stay on the ground before jumping or getting hit with a block, and the game will exit with both the back and home buttons. There is now a “Get Ready” state when first starting the game where nothing is affected until the first block rolls by. Combined with the fact that the game always exits when focus shifts away, this provides a crude “paused” state, which I think is actually within range of “appropriate”.

Posted in Uncategorized | Tagged , | Leave a comment

Artemis C#

I’m going to try to contribute as I can to the ongoing Artemis C# project. At first it will just be documentation as I figure out what does what, specifically in getting some more Visual Studio Intellisense documentation set up.

In fact, I just committed my first batch. Here’s hoping it’s not all wrong ;)

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

More ES with WP7

It’s not abundantly clear to me how best to handle user input. The StarWarrior sample app has a system called “PlayerShipControlSystem” that implements the “TagSystem”. It’s constructor includes that it implements a base(“PLAYER”), but in my case, I’m actually just trying to detect and “do” stuff with finger taps – detect if they’re on planets or not. Again, I’m stuck, and I’m too tired to make further progress. I did add some more components, and I put in some framework-y logic to handle spawning ships and some basic planet selection/deselection.

Well, tomorrow’s another chance to move forward.

It’s always striking to me how detail-oriented programming is ;)

On a totally unrelated note, today at work I implemented a way to effectively restrict certain hosts to specified logins on SQL Server; it’s along the lines of the username/hostname tuple in MySQL. hint: create a “logon” trigger that checks a basic table you make that has the hosts you want to restrict and the logins you want to restrict them to. MS doesn’t have this sort of feature by default, but they left it open for us to pretty easily build out. So far, it works great. Make a logging table to dump violating logon attempts from the restricted hosts and monitor it for fun and profit… or security, whichever you wish ;) .

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

It Lives

Not much time to spend, so I decided to redo the “PlanetRaiders” concept game Entity Systems style. Well, I got the planets to show up, so I’m on my way.

Here’s a rough description at fairly high level:

You create an entity world first.
To that world, you add the “approved” pool of possible components, each of which you have already created at least stub classes for.
You tell the renderSystem what graphics device you want it to output stuff to, the spriteBatch you want it to add stuff to, and the execution type it falls under.
You initialize it all.
Create your initial planets (in this case).
—-Up to here, this has all been code in the global variables section or in the Initialization section—-
In the Update method (the main game loop), all you really need to do is “world.LoopStart();”. This takes care of kicking off all systems processing.
In the Draw section, you just set up a spriteBatch.begin….end and inside you run “world.GetSystemManager().UpdateSynchronous(ExecutionType.Draw);”. This takes care of all rendering processing.

All the logic that processes movement, collisions, etc… anything that makes data change, all that should go in your Systems classes, e.g. MovementSystem, ControlSystem. I’m still too new (and a bit tired) to have fully digested how exactly everything is split out, but I’ll try to go into that later.

Whatever the case, I started from a blank solution, duplicated how the sample StarWarrior code seemed to do things, and it’s drawing planets on the screen, all in just a few hours. That’s quite a bit more than I expected I would get :)

Posted in Uncategorized | Tagged , , , , | 1 Comment

Artemis and WP7 – Working Example

I couldn’t resist coming back to this thing. This time, I figured I’d check out the sample application – StarWarrior. It builds and runs fine, both on the WP7 emulator as well as my WP7 phone.

Just start from this solution. Don’t waste your time otherwise.

The immediate things that come to mind are:
1. I’m going to write code snippets to describe what all the various methods do – more descriptions in general. Maybe this is a way I could contribute to the project.
2. I am going to have loads of things to tweak until I get a good grasp of this. It’s overwhelming.
3. I think I’m going to commit to this framework for the immediate future. The next 30 projects will utilize it.

Random tidbit: Use “world.GetEntityManager().GetActiveEntities().Size();” to get the total number of entities in the world.

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

Actually Trying a WP7 Application using an Entity Systems Approach

In this case, I am using the Artemis C# port from here: https://github.com/thelinuxlich/artemis_CSharp

The solution files compile fine right after opening them. If you just debug the “ArtemisTest” solution you will get a console application that outputs the time between loops of doing mundane calculations for 100,000 entities. (I get about 300 ms, as a benchmark).

I’ll do some stream-of-consciousness… may be interesting….

I created a new solution, added references to the 2 .dll files output by the sample solution. Then, as best as I could tell I put the various parts of the main “Test.cs” contents of the ArtemisTest sample project in the WP7 game template, “Game1.cs”. EntityWorld world = new EntityWorld(); goes in main part of Game1 class, initialization code that creates entities and assigns components go in the Initialize() section, and world.LoopStart(); goes in the Update() section.

I’m a bit stuck as to how I do gametime, as in how do I know by how much to move a ball given the master GameTime instance in the Update() loop….. found it…. since there aren’t really any “Summary” comments for the various methods in the Artemis framework, I thought I’d look in the source code solution. I had a hunch there should be something like game time or something in the “world” class. Sure enough, “world.GetDelta()” returns “Time since last game loop.” Now I have to actually try it… well, that didn’t work.

I’m getting the sense that I’m mixing 2 different frameworks here. And as such, it won’t go well. I don’t see how to get something to render on the screen based on purely on a system acting on entities with, say my own “Visual” component. I’d have to somehow tell it the SpriteBatch I’m using to draw stuff on the WP7 graphics device. I’m too tired for the time being.. brain is fried. I’ll jump on it again tomorrow. Fresh solution, fresh eyes.

It’s not easy, this.

Posted in Uncategorized | Tagged , , | 3 Comments

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