Thursday, December 13, 2012

Old Dog New Tricks

It's been roughly 2 weeks steeping myself in Objective C, XCode, and iOS programming, and I've made a respectable amount of progress.  Solar Vengeance for the iPad is coming closer to a reality.  In this week I've ...

  • Gotten a handle on UIKit/Appkit, and Apple's MVC application development architecture.  In particular, I've figured out how to create UIViews that represent different screens in the application, and how to easily navigate between these screens.  I've also developed a simple, custom color picker control, and gotten comfortable with the ubiquitous TableView component.
  • Port much of the game's "model" classes into Objective C, and wrapped my mind around the ARC programming concept.  Coming from garbage-collected C# this was a bit of a leap, but Apple's recent ARC feature eases memory management substantially.
  • Successfully integrated the cocos2d OpenGL game engine into my app, and have some StarSystems, Shields, Scanners, a starfield background, and nebula rendering.
  • Build the foundation of my RealTimeEngine class, which will manage multiplayer games, and keep the impulses pumping in general.  The RTE is kicking off an impulse every second, and my prototype game is chugging away, with Resources being generated!  This also includes the beginning of the game order and state change architecture, with a Build Shield and Build Scanner order already operational.
A major challenge ahead will be working on the client/server layer to facilitate multiplayer matches.  But I have a head start.  My C# PrismServer is running on a dedicated machine at home, and I think I can write an Objective C PrismClient class to communicate with it.

I leave you now with a happy accident as I was testing out some tiled graphics to represent nebula.  I had accidentally rendered the tiles twice as large as they needed to be for the nebula, but when I saw the result, I liked how the nebula now kind of looks concentrated and brighter where it is thickest, thanks to the translucent tiles blending on top of each other.


Monday, December 3, 2012

Just a screen shot of some work in progress ...


Friday, September 4, 2009

Solar Vengeance 6 Released

http://www.siliconcommandergames.com/SVSilverlight/SV6.htm

It took a few months of part time effort to port SV5 to Silverlight, and now we have SV6. There are some decided advantages to the browser based version:

1) You don't need to to download the latest build, that's taken care of automatically.
2) The graphics performance of the Silverlight sprites outperforms the GDI+ based graphics of SV5.

A Silverlight version also poses some challenges that I still need to overcome. Biggest of these is providing a way for people to run a debug version of the app so they can develop and debug their Scenarios and Brains. Once I crack this I will publish the updated Scenario and Brain API's and promote these to developers.

One of the hallmarks of Silicon Commander Games was the extensibility, and I think we've pushed the envelope by providing robust API's so developers can build their own Scenarios (levels) and Brains (computer AI's) that integrate seamlessly into the game. This will continue with SV6!

Another challenge is to try and rebuild the SCG community and get some active players again. I'm hoping this will come naturally when I continue to build up the supporting documentation of the game with strategy guides, examples, etc. If you're reading this now you can help too by logging in and waiting a little bit in the lobby for other people to show up! I look at the logs and see someone like "Z" for example log in, and then 1 minute later log out. Then 5 minutes later someone else does the same thing. I'm guilty of this too some time, but I will try and hang out in the lobby more to catch other players and hopefully get some games logged!!

I've also begun work on converting some of the class libraries for WinWar II over to Silverlight. This includes my tile-based map logical components, and a new Silverlight based TileBasedGameBoard component that can use my MapSet class to render tiles on the map. I'm hoping to port the WinWarII logic engine I created for V5 pretty easily to Silverlight, then build a new UI, much like I did for SV6.

Monday, July 13, 2009

Say no to Verbose XAML with EasyGrid!

EasyGrid is a simple enhancement to the basic Grid layout panel in WPF/Silverlight. The sole purpose of EasyGrid is to eliminate the verbose markup that clutters your XAML when you define Grids with many rows and columns.

EasyGrid provides a "mini-language" that lets you create all of the rows and columns of the grid by simply providing a value to the EasyGrid's Data property.

Before getting into the mini-language specifics, lets look at an example. Say we want to define a Grid that contains 4 columns, the first and last a fixed width, and the middle two variable, and 12 rows. You would wind up with markup something like this:



If you're anything like me, looking at markup like this gives you a headache! The EasyGrid version looks like this:

The EasyGrid Mini-Language

The EasyGrid performs its magic via the Data property, which contains a string that represents all of the rows and columns of the grid. The Data property actually has two modes of operation, a simple mode and a verbose(?!?) mode.

Simple Mode

In the simple mode, you can create a grid with a number of rows and columns that all have the "*" sizing specifier by using this syntax:

Data="CxR"

where C represents the number of desired columns and R represents the number of desired rows.

For example:

Data="12x30"

Verbose Mode

In this mode, you use tokens to specify rows and columns. You can also use the "x" character to represent a number of rows or columns with the same sizing specification.

C - A "C" in the Data string means that the next token(s) will define grid columns.

R - A "R" in the Data string means that the next token(s) will define grid rows.

# - A number token (for example "12" defines a row or column with a fixed size.

#* - A number followed by a * (for example 4*) defines a row or column with a proportional size.

Auto - The "Auto" token defines a row or column with an automatic size.

#x(token) - When there is a #x preceding a token, it means that the row or column will be repeated the specified number of times. For example, C 5x3* creates 5 columns with sizing of 3*.

That's all there is to the EasyGrid. Use it in your projects and "say no to verbose XAML!".

Download the EasyGrid component.

Monday, July 6, 2009

Solar Vengeance 6 Lobby


I completed the multiplayer lobby interface for Solar Vengeance 6 in Silverlight. Click the link below to log into the new lobby. You can set your profile, including a Glyph image, and chat with other users in the lobby.

Implementing the lobby in the app was easy once my PrismServer components were ported to Silverlight. The PrismConnection component provides an easy way to connect a Silverlight app to a running PrismServer.

In SV6 I create the PrismConnection component in code, but you could also create it in your XAML since it descends from DependencyObject. You'd just need to be sure to place it within a ContentControl, because Silverlight panels can't take DependencyObjects directly. When defined in XAML, you can set the properties like Host, Port, and SubjectName in your XAML, as well as hook up event handlers.

In my custom application class I declare a private variable to hold the PrismConnection object, and a public property to provide access to it in other pages. In Application StartUp event, I create the instance:

_prism = new PrismConnection("1.2.3.4", 4502, false);
_prism.SubjectName = "SV6";

You'd replace "1.2.3.4" with the host name or IP address where your PrismServer is running.

To connect, call the Connect method, which will eventually fire either the ConnectSuccessful or ConnectFailed events.

In your ConnectSuccessful event handler you can call either Login (for existing users) or LoginNew (for new users). Login takes 2 parameters, a user name and a password. LoginNew takes 1 parameter, an instance of a PrismUser object that represents the user information for the new user.

These methods will eventually fire either the LoginOK or the LoginFailed events, which you can handle accordingly.

The PrismUser class has some helper methods that make it easy to store and retrieve Glyph images for users. The SV6 Lobby lets you select a local image file on your computer to represent you as your Glyph. PrismUser encodes this image into a Base64 string, and saves it in the PrismUser object, in one of the "Detail" fields. PrismUser GetDetail/SetDetail methods let you store arbitrary information with a PrismUser and have it saved on the server.

When a user logs back in, its encoded Glyph string is decoded and converted back into an ImageSource which is then displayed next to them in the Lobby.

I use the PrismUser GetDetail/SetDetail to store other game-specific information about a user, such as their rank and rating.

Handling chat in the Lobby is virtually effortless thanks to PrismConnection doing all of the dirty work. To send a line of chat to other users, simply call the SendChat method. A ChatRecieved event is triggered when an incoming chat message is received. The EventArgs class provides you the PrismUser who sent the chat as well as the line of text itself.

Now that the Lobby is completed I can move onto converting the actual game mechanics!

Solar Vengeance 6 Development Build - with Lobby!

Monday, June 29, 2009

ChatNDraw Silverlight Demo

My ChatNDraw Silverlight demo is completed. ChatNDraw is a Silverlight-based chat program that lets you create new chat rooms, chat with others who happen to be logged in, and draw in different colors using a shared blackboard.

ChatNDraw was created using my PrismServer component suite that I just converted to WPF/Silverlight from WinForms (.NET 2.0). I plan to release the source for PrismServer as soon as I can complete the documentation.

ChatNDraw Demo

Friday, June 26, 2009

Rebirth of PrismServer - for Silverlight!

I'm almost finished with the Silverlight/WPF port of PrismServer. I have a live Chat server running now on the following page. I'm still working on the "Draw" part of the "ChatNDraw" Silverlight app, but for now you can help me test the server by logging in and "Chatting"!

Note - if you create an account here, it will become the eventual account you'll use for all SCG Silverlight games.

I wanted to get this news out to allow for some early testing. I do plan on creating a post describing the new PrismServer in more detail, and possibly a revised CodeProject article. For now, my fingers are falling off of my hands so I need a break from coding ;)

http://www.siliconcommandergames.com/ChatNDraw/TestPage.html