Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Thursday, February 5, 2015

Version 0.0.5.4 Of [Working Title] AdventureGameQuest Released!

Just a quick announcement for all of the awesome people out there, I have released version 0.0.5.4 of my text adventure game! It comes with a few gameplay enhancements as well as some additional security features.

The gameplay enhancements are as follows:

  • "whereami" command that tells you where you are, where you can go, and if where you are at is an exit.
  • First person narrative. Originally, we had some bad grammar, and that is fixed now. Everything *should* be in the first person narrative.
Security Changes:

  • You may now reset your password from the Login page.
  • Password requirements are less strict (due to popular demand, it is *just* a game after all)
I look forward to hearing about some of your adventures in the game and comments about what can be done to improve it! Link here to play: http://adventuregamequest.azurewebsites.net/

Tuesday, December 9, 2014

Game Development Competition Announced!

Hello Blogger/enjoy-game-programming/Game Development community,

I am posting this because I plan on holding a competition for the alpha version of my online text RPG game found at http://adventuregamequest.azurewebsites.net/#/. The competition is simple, create a short story based quest line that falls in line with the quest flow of the game. Before I continue, there will be three winners selected from the competition. The winning quests will be included in the game as a playable quest line and credit for assissting in the devleopment of the game on the website.
There are several categories that will be judged for this competition. These categories are flow, balance, and originality. Flow is judged on how well the story of the quest fits together with the actual quest objectives as well as how the quests go together when leading from one to the other. Balance is the difficulty progression of the quests as the player completes them. Finally, originality is the cumalitive story line of the quests. The latter includes, characters, places, monsters, and all of the other exciting elements of an epic.

Now that we have those details out of the way, there are several rules which I will outline below.

1) Submissions must be made to alpha-adventuregamequest@outlook.com with the subject line of "Alpha Game Quest Contest"

2) There must be a grand total of 50 Quests.

3) Quests have the following structure:

a) Quest Giver
i) Name of the Quest Giver
ii) A description of the quest giver
iii) The location a quest giver is in
iv) The quests that must be completed to unlock this quest giver
v) The quest that quest giver gives

b) Quest
i) The name of the quest
ii) A description of the quest (this is mostly the story part)
iii) Quest brief - Follows the syntax of verb, number, what.
iv) Quest Type
aa) Collect
bb) Slay
cc) Travel To
v) Quests that may be triggered after this one is completed (optional)
vi) Rewards: Score, Experience, Gold

4) Finally, a high level overview of your collection of quests. This includes the full story, where the quests fit in, and anything else you find useful. (Essentially, a short story)

5) Full list of the linear progression (or not so linear progression ;) ) of the quests, each one numbered

6) The deadline is February 27, 2015 and the finalists (top 10) will be posted on the website [ http://adventuregamequest.azurewebsites.net/#/ ] by March 6, 2015. The winners will be announced April 10, 2015.

With all the nitty gritty out of the way, I do have some notes to make about the submissions. These notes are listed as follows:

1) *Slight* Deviation of quest structure are encouraged. By slight, I mean the types of quests, as well as rewards. Be creative - not crazy. Remember, it is a text based RPG.

2) Questions are encouraged in email at the submission address with the subject line "Alpha Game Quest Contest Inquiry", or as a comment below

3) Spelling and grammar are encouraged to be correct

4) English is my primary language, so I encourage submissions in English, but will attempt to go through some online translator if I must. I read German as a poor secondary language.

I look forward to your submissions and am very excited for the opportunity to do this for the game development community. If you want to get a feel for the game before getting started, join now for free and play for a bit at the games website. [ http://adventuregamequest.azurewebsites.net/#/ ]

Thursday, December 4, 2014

Greatest Adventure Game Update (so far)

Today is an exciting day! I have just release version 0.0.3.1 for my text adventure game at adventuregamequest.azurewebsites.net, feel free to try out the new version at the site! The game is chocked full on new features that I am excited to share. These features are as follows:


  • Enhanced Security: Users now need to confirm email address when signing up for the game. This will pave the way for password recovery and support.
  • Quests: The quest system for the game has been added! This is a huge update as it will pave the way for the Beta version and a fully implemented story!!!!!!!!!! Can you not see the impact of this feature!?!?!? If not, or even if you do, go and check it out.
  • More Achievements: With more things to do in the game, there come more achievements, meaning more opportunities to gain bragging rights.
So go ahead, join today, or log back in, you won't regret it! Here is the path for the alpha testing server - all are invited:

adventuregamequest.azurewebsites.net

Monday, November 24, 2014

Community Feedback for Text-based Adventure Game

I am in need of some verbose feedback in regards to my online game that I created. There are various sections of the game and the website of the game that I am looking to receive feedback on. These sections are the game itself, the game manual, website layout/design, and further suggestions.

If you would like to stop reading and just go ahead and play, here is the link:http://adventuregamequest.azurewebsites.net/  
Before I continue to explain what I am looking for, I would like to explain the project a little as well as the roadmap I have planned out for myself. What I would like to explain is the game itself and its inspiration. Secondly, I will discuss the roadmap of where I am at and where I wish to go.

In regards to the explanation of the game I have two main topics I would like to point out. These topics are the game itself (as in gameplay) and the inspiration behind the game.

First, the game is a text-based adventure game. You, like I did so many years ago, probably just threw out all interest in playing the game. That is fine, we all have different tastes and you aren't forced to continue reading. For those who wish to know more, here is a high level overview. The game is built to be played online and semi-competitively. There is a ranking system based on your adventures that tracks relics you collect, areas you explore, and monsters you fight. It includes a simple achievement system that auto-brags for you what you are doing. I plan on adding inter-player communication and a quest system. Finally, as most indie games/small projects have these days, I plan on adding random gameplay to the mix. What I mean by this is random quest generation (for smaller quests) and random dungeons (tried and true). I will stop here as it is getting more into my roadmap, so I will now discuss with you the inspiration behind such a game.

What is the inspiration behind this game? Well, to be honest, as I stated on my blog - enjoy-game-programming- I did it because I could and was in training to use new libraries, technologies, platforms. Ultimately, I say, it was because I could. However, it grew to be more than that. As I progressed I kept getting new ideas and drive to keep going. I had an idea of a world, a story, gameplay elements, and friendly competition between players. I also new that working on this part time with no artistic skills would be a huge roadblock. So I stuck with the KISS model. I kept it simple and focused on what really makes a game - a medium to tell an interactive story from the designer to you.

Yes, awesome effects, epic music, and slick graphics help with that story telling - I will admit that. However, I wanted to delve into the deeper parts of a game, to create something that gives real drive to keep playing, not just a firework show for the eyes and hears. A game where people think, where the gamer is not treated as a gigantic wallet awed by cheap tricks. Where the game is created with a tight gameplay system and well balanced mechanics. This is where you come in and the reason behind this announcement. I am looking for people to play and give feedback and it would be much appreciated. "This isn't my first rodeo", I have gone to other communities for other projects to receive feedback. I am no stranger to criticism or direction. If you want to be brutal, be brutal. If you had a bad day and want to rip my game to shreds, do. I beg you, feedback is the most important.

Finally, the roadmap I have for this game. Right now I have all of the core functionality in place and is accessible to the player. There are a few features that I would like to add and then some other stuff to jazz it up. Here is a list to keep this short:

Gameplay: On Beta Finished
  • Player chat for players in the same location
  • Quest system
  • Expanded world and story
  • Better balancing
  • Expanded npc roster.
  • Non-combat npcs (monstly for giving quests)

Before Going Gold
  • Users may pick portraits
  • Background art based on location
  • Revamped UI (hopefully with the help of the community That's you)

With that in mind I want to change direction from the game and the motivation behind it to what I am asking assistance for. Remember, what I am mostly looking for is feedback in regards to the game itself (broad overview), the game manual (is it understandable?), website layout/design (is it user friendly/intuitive), and further suggestions.

The first discussion point would be the game itself. I as this because my background and degree is mostly programming related work, I did not always focus my efforts on game design. I feel strongly that I know the theory well, but it is the implementation of various mechanics that I wish to receive feedback on. Such mechanics would be feedback from the game (is it descriptive enough, do you understand what it is telling you, is it appropriate?), balance, and do you simple just get the game. I mean, do you really get it.

Secondly, I would like feedback on the game manual. As this is a text-based game, there really wasn't much in the way of a smooth tutorial I could offer. So I decided with an age-old classic - the game manual. I explain all the commands available in the game and what sections of the HUD say and do. I also offer descriptions of various hints the game offers in regards to the HUD. What I am looking for here is if there are any sections that are not clear, missing, or should be replaced.

Finally, with the game being online, I would like to have a user-friendly website to host it on. Right now I would have to say it is pretty basic. I would love it if people with website design backgrounds could offer hints to make it better. Also, the UI for the game and its intuitiveness can fall into this category as well.

I would appreciate all of the feedback possible and here is a link to the website that the game is hosted on (the game name is a working title and WILL be changed):

http://adventuregamequest.azurewebsites.net/

Thursday, November 20, 2014

Continuous Integration in Azure

From my last post, many of you can tell that I just launched a test website / text-based game. This has driven me to start thinking about Continuous Integration in my projects.

Now, I learned all through school game programming and not much else in regards to some of the higher level tech management processes. Sure, there was project management and some Agile stuff thrown in, as well as using version control, but never anything on CI.

So, to help my career move forward and to provide an easier time in developing and deploying my little project, I have decided to begin implementing CI in my current project. As it stands, it should follow some basic tenets to even be considered following CI procedures. These are as follows:


  • Automatic pulling from remote repository on production branch update
  • Automatic version of files before build.
  • Automatic build process
  • Automatic unit testing
  • Automatic deployment on all tests passed
For the most part, Azure has done a lot of this for me when I linked it to my Bitbucket account and I can configure pre-build scripts as well. I plan on working on the rest of CI integration into my project in parallel of the production of features and enhancements. So the above list, currently, looks like this:

  • Automatic pulling from remote repository on production branch update
  • Automatic version of files before build.
  • Automatic build process
  • Automatic unit testing
  • Automatic deployment on all tests passed
So, really, that just leaves the unit testing (blech) and the version injection of the files. I already have a nifty script I can use for making versions, I just have to tie it into git, Bitbucket, and Azure.

If you haven't already, feel free to visit the website at http://adventuregamequest.azurewebsites.net/ and play around!

Monday, November 17, 2014

First Alpha Version of Text-Based Adventure Game

As promised, I am here to give a link to all the readers, for the text based adventure game that I have created. It is currently an alpha version, looking for feedback. As always I would love the feedback.

The name of the game is AdvetureQuestGame (working title) and this is the link:
http://adventuregamequest.azurewebsites.net/

Thursday, November 13, 2014

Where Have I Been?

For the past few months I have been hidden under a rock, not posting anything. Why? Well, life moves fast and I was keeping up with it. I have taken on one independent project (near completion), two after hours projects, and a full time job. I found myself wanting for time but also enjoying what I am doing.

First is my current independent project. I have recently finished the core features of a web based text adventure game. Why? As any programmer/engineer/mad-scientist will inform you: "Because I can." And I certainly can, did, and will continue with. Quite frankly, the project just needs some added game-play features and a hosting platform. The technologies used in this project were:
  • .NET 4.x Framework
  • ASP.NET
  • Entity Framework
  • AngularJS
  • Identity Framework
  • Twitter Bootstrap
What was the biggest motivation behind this project? I could say it was a yearning for the classic games, or a drive to make a deep story driven adventure. Quite frankly though, it was to learn various web technologies. It has always been my weakest skill in the world of programming. However, in this world, that would leave me without a job (games or not, the web is growing and so are the demands for positions to create it).

The other two projects that I am working on are all done in Unreal Engine 4, the engine I raved about so few months ago. I have pretty much stopped all production in Unity as I just didn't want to use it. I prefer C++ when I want to, and uber-fast prototyping in Blueprints when I need to. Plus I find the tool sets in UE4 significantly more robust and user-friendly. It feels wrong saying user-friendly, but it is true and it makes the projects move along smoother and at a more rapid pace than I have ever seen.

I am not sure as to whether I can talk in detail about these final two projects, but I will definitely give many updates if they turn out to go farther and allow me to share screenshots/videos with everyone.

Until next time! Keep an eye out on this blog as I will be posting a link to my web based game very soon once I get a hosting platform up and running.

Tuesday, June 17, 2014

Server Side Player Properties

An after effect of our server side overhaul is that the game now has a database full of ship, weapon, and projectile configurations. This means the server can pull data from there and send the properties to players upon game starts. In conjunction with the client side GUI to configure a ship, we have a good system going for multi-player games.

The only real issue was wrestling with the timing of script execution, construction, and threads. This caused some issues where the client was not updating its properties when the server sends the data due to the script not existing and therefore not listening for the event. When that happened, the event just disappeared. Unity does allow for script execution ordering but that would not have fit my case as the GameManager Singleton and the SmartFox Client Controller needed to send and receive events before, during, and after other scripts. Therefore, I rolled some code in the C# scripts to time events the way they would work with our system.

Saturday, June 14, 2014

Unity / SmartFox Senior Project Update

For the past two weeks I have been working on overhauling the server side logic to be more authoritative in our game Starbound Aces. Most of the work is done and completed to satisfaction. The parts that are complete are server side validation of input, shooting, abilities, ship configurations, and weapon configurations. All of that data is replicated well to each client.

The final step - transformations and maneuvers are hitting a rough patch.

As it works now, the game on the server is launched in a new thread that is updated every 150 milliseconds. Right now, this causes jittery game play and horrible movement. These are the issues I plan on resolved soon.

Wednesday, June 11, 2014

Server Replication

I have been spending the past two weeks re-factoring the server for our game - Starbound Aces. It is in an attempt to move to a more authoritative server model for the game to prevent cheating and game-play issues due to players being out of sync. The biggest improvement I have made is translating and rotating object on the server and sending the new positions to the players. With the aid of the LWJGL and the Apache Math3 API, I was able to imitate the original Unity C# scripts we had for movement onto the server in Java.

Here is the source code for that:

package com.gspteama.gamedriver;
import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;
public class Movement{
    public float Velocity;
    public float Acceleration;
    
    private float maxVelocity;
    
    protected Vector3f position = new Vector3f();
    protected Vector3f rotation = new Vector3f();
    protected Vector4f quaternion = new Vector4f();
    
    protected static final Vector3f UP = new Vector3f(0.0f, 1.0f, 0.0f);
    protected static final Vector3f LEFT = new Vector3f(-1.0f, 0.0f, 0.0f);
    protected static final Vector3f FORWARD = new Vector3f(0.0f,0.0f, 1.0f);
    
    protected Matrix4f transform = new Matrix4f();
    
    public void onUpdate(float deltaTime){
        Velocity = Velocity + Acceleration * deltaTime;
        if(Velocity >= maxVelocity){
            Velocity = maxVelocity;
        }
        
        Rotation rotator = new Rotation(RotationOrder.XYZ, rotation.getX(),
                rotation.getY(),
                rotation.getZ());
        quaternion = new Vector4f((float)rotator.getQ0(),
                (float)rotator.getQ1(),
                (float)rotator.getQ2(),
                (float)rotator.getQ3());
        
        transform.setIdentity();
        
        transform = transform.translate(position);
        transform = transform.rotate(rotation.getY(), UP);
        transform = transform.rotate(rotation.getX(), LEFT);
        transform = transform.rotate(rotation.getZ(), FORWARD);
        transform = transform.scale(new Vector3f(1.0f, 1.0f, 1.0f));
        
        //to row major
        transform.transpose();
        
        //get the forward vector
        Vector3f forward = new Vector3f(transform.m20,
                                        transform.m21,
                                        transform.m22);
        forward.normalise();
                                        
        Vector3f forwardVel = new Vector3f(forward.getX() * Velocity,
                                            forward.getY() * Velocity,
                                            forward.getZ() * Velocity);
        
        position = Vector3f.add(position, forwardVel, position);
    }
    public Movement(float maxVelocity){
        this.maxVelocity = maxVelocity;
        Velocity = 0.0f;
        Acceleration = 0.0f;
        transform.setIdentity();
    }
    
    public void onLeft(float value){//A
        rotation.y += value;
    }
    
    public void onRight(float value){//D
        onLeft(value);
    }
    
    public void onUp(float value){//W
        Acceleration += value;
    }
    
    public void onDown(float value){//S
        Acceleration -= value;
    }
    
    public void onHorizontal(float value){//MouseX
        rotation.z += value;
    }
    
    public void onVertical(float value){//MouseY
        rotation.x += value;
    }
    
    public float[] getPosition(){
        return new float[]{position.getX(),
            position.getY(),
            position.getZ()
        };
    }
    
    public float[] getQuaternion(){
        return new float[]{quaternion.getX(),
            quaternion.getY(),
            quaternion.getZ(),
            quaternion.getW()
        };
    }
}

Monday, June 9, 2014

Hey Baby, I Wanna Know (What Have I Been Up to)!

Seems like it has been a while since I have done my last post. This is with good reason, my fingers are blistering from refactoring the server side engine. What is it that I am doing? Something maniacal in a time crunch - every programmers dream come true.

Currently I am in the middle of a major overhaul of the server side engine to be more authoritative in regards to gameplay. The key word here is gameplay. So far, the engine works great in regards to GUI systems calling server events and data. Such things would be high scores, creating games, joining games, ship configuration, and so on and so forth. The part that needs work is the actual code that handles the game logic simulation such as collisions and player positions. As it stands right now, the server just forwards all this information with no replication. This can lead to easy cheating and abuse of networking. So, I decided to fight this by doing the following:

  • Player input is sent to server for processing
  • Server calculates position
  • Server updates game world on itself, then sends data to players
  • Server handles collisions
  • Server handles player elements - health, life, death, ammo, cooldown, etc.
On another note, I have also been working on the special effects in the game to make it more visually appealing. More on that on another date.

Tuesday, June 3, 2014

Starbound Aces Update - The Countdown

With the impending end of our project, I have been in scramble mode. Our project Starbound Aces is coming to a close and there is much to do to get a viable product from the 16 week development period. So, first and foremost, we must focus on fixing any issues we have that reside in the game. As it stands, there are a few. These issues are as follows:


  • Network problem when joining a second game after playing the first
  • Sound issues
  • Projectile / Weapons are lame
The last one is more or less a comment on how we have not gotten to adding awesome effects for the projectiles themselves.

Enough gripping though, I have some nice art content to show off for our game, as well as an in game screen shot! Enjoy!

Image of ship in pursuit

Image of ship manuevering

Smooth space ship

Tuesday, May 27, 2014

Weekday Update w/ Video

I hope everyone had a good Memorial Day and weekend - I sure did. Now onto business, the state of the game.

Starbound Aces is coming along very nicely. Since my last video update I have introduced a lot of new features and changes since my last update. I will compare as they are seen in this video:

This video shows everything from a week ago. Over that time I have made a lot of changes. Many of them are simple optimizations and bug fixes. However, there are a few that are noticeable in the game. These changes are:

-Inserted a new game menu option: Ship configuration
-Changed the engine effect to a trail renderer
-Changed the tracking system of the seeker missile.
-Tweaked some variables

Here are the changes that the other programmer, David Tiscerano, incorporated:
-Cooldown system for manuevers
-HUD Display of cooldown

Many of the other busy work has been behind the scenes tweaks and optimization. Until next time - Enjoy game programming!

Thursday, May 15, 2014

Massive Game Overhaul

I spent most of today and last night going over the game and overhauling a lot of the features and the UI for the game. There are some massive improvements to all the scenes as well as textures for our ships now. Here is a list of all of the improvements made:

  • Remote Players who connect to a game no longer have oddly rotated ships.
  • Colliders for both the remote players and the client player are now properly oriented.
  • Users can now join games that were created earlier that their login time.
  • Scrolling view for all of the current games queuing.
  • Uniformed GUI re-sizing for various resolutions. (minimum 1024px wide)
  • Updated visual effects for space ships
  • Better feedback when registering.
If you want to start a game, leave a comment and follow the link here to play the web player version of the game: Starbound Aces Game

And here are snapshots of the new ship models by Valentin Oprea:
Player Ship 1
Player Ship 1 - Texture

Player Ship 2
Player Ship 2 - Untextured



Wednesday, May 14, 2014

Game Persistence Implementation

For the past week I have been going over a lot of my school project code and figuring out what core gameplay elements still need to be added in regards to the server. If you have been keeping tabs on the github project, you can see that a lot of it was fixing code that caused errors as well as adding data persistence to the server engine.

Let us talk about the first issue at that I ran into and fixed this past week. The issue was players trying to log in twice. This was something simple to fix, remove the request to log in. Well, this caused the client to not know it was logged in and therefore I reverted that change. The second issues was automatic room removal. rooms where not being removed properly as they caused exceptions to be thrown. Turns out it was the extension's overriden destroy method causing the issue. This I found strange because the tutorials said that if I implemented the login assistant component, I needed to call the components destroy method in the extensions destroy method. Well, I removed that and have thus far to receive errors since then.

Onto the fun part now. I have added a full, new feature to the game. This is a game list that pulls up games created during your session as well as queued games created while you were picking your nose and not logged in to our game! This is very exciting as it allows for a whole list of data to be populated in the game list field. It also works, right off the bat! Unfortunately, I do not have the new Webplayer out there for the public to play just yet, but I do have all source code for it at our repository, so take a look there or even download/checkout the project and build it from source.

The final installment that I worked on in the past week was all GUI systems for the pre-login stage. Most of it was just a design change as they are using our common template. This is taking some time because I have never used Unity's built in GUI system and did not code for GUISkins. So most of the styles are hand configured and have their parameters set in the editor through public properties.

I am not sure when, but soon I will have a new game play video out as well as a walk through of all the new features. After that we will have the new player available for playing on the web. I also plan to do a desktop build as well. But first I will need to revamp the GUI for the lobby as well as the high scores.

Until next time!

Monday, May 5, 2014

Unity Senior Project Update

I decided to get cracking at fixing some issues that were left over from the last half of my Senior Project. The issue was players were trying to join rooms twice when going into the lobby. Turns out it was just bad programming on the client side. Mistakes happen.

Now I need to fix the final issue on the server which is a null pointer exception being thrown by the Bitswarm socket reader when the last player leaves a room. I am thinking it may be protocol related in regards to data trying to be read from a socket. Not one hundred percent sure, but that will be my goal to finish tomorrow.

Sorry for the lame update, but there really isn't anything cool to show when working strictly server-side.

The Final Stretch

I knew this day would come eventually. The beginning of the end, as the cliche goes. Today marks the last eight weeks of my time at DeVry. With it, comes the closing hours of my Senior Project - Starbound Aces.

This week we will be spending time organizing data about Alpha gameplay reviews and comments to make some bug fixes as well as fleshing out the game. However, to be quite frank, any efforts to have unbiased third parties to test the game were a complete, miserable flop. Any attempts - on two forums and a couple of social media websites - resulted in only one comment in regards to the game. Thankfully, there are some close friends and allies who were able to play the multiplayer version of the game with me and give some feedback.

Most of the feedback was as follows:

-How do I x?
-Where are you?
-Am I flying?

Indeed, a lot of that is just questions. Which means there are some things in the game that need fixing. First off, a help menu for those who don't know how to play. I spent too much time assuming that people playing would have a natural assumption of 3rd person PC gaming controls. That was ignorance on my part. Secondly, the movement/camera scripts need and overhaul in regards to the actual gameplay. This is the task of the other programmer on the team. Finally, fixing the player name displays to be locked on viewport will give players an idea where other players are at in regards to the game world. Space is too big to hide player names by not locking them to the viewport. A later screen shot will show what I mean by this.

Until next time, enjoy your game programming, because I certainly will - until it doesn't works when it was working before and I have no idea why so I just restart my computer hoping that will fix the issue but that obviously wasn't the issue because it turns out to be some stupid thing I did late at night when I was obviously too tired or drunk to remember doing it and sure I thought it was a cool thing to add into the game but it clearly wasn't a good time to put it in and of course I forgot to commit my latest changes and I already saved and closed so there is no mercy in the Ctrl+Z department which I think is stupid but oh well that is how it goes and it turns out to be that I overrode a method in a class and so the base class was not being called so really the big issue is stupidity and one line of code then that is when game programming is not enjoyable but I still enjoy it anyways.

Monday, April 28, 2014

Crickets Make the Most Noise

It has been a while since I have posted. This is mostly due to the fact that I am on break before my last class starts. This class is the second half to my Senior Project and is the second sprint towards a Beta for Starbound Aces.

I have decided not to work on Starbound Aces during the break. This is unusual compared to my past patterns in which I would religiously throw myself at my code to fix all bugs that manifested themselves in the Alpha development. I have decided against this because burnout is a huge mood killer.

On another note I plan on purchasing a license for Unreal Engine 4 and taking the C++ for a spin since that is the language of my choice. I also have been working on some Unity prototypes that I though were neat. Within the week I will be able to show some prototypes here as well as explain them. In regards to UE4, we will see if I have anything to post.

In the meantime, enjoy your game programming and check back soon!

Wednesday, April 23, 2014

Unity / SmartFox Senior Project : Halfway Point

Today marks the halfway marker for our Unity project: Starbound Aces. It has been a long 8 weeks of producing documentation and an Alpha version. Playable here: Play Starbound Aces

I want to spend this time recapping all of the work done for the game and what I would have done differently in regards to the programming architecture of the game. Then I would like to explain what will happen moving forward from here.

In regards to the recap there are several subjects I would like to cover. These subjects are server extension design, database design, and the client side design.

The server extension design was originally intended to follow a simple authoritative design in which client data was verified by various classes. These classes I called game drivers. Each class was responsible for collecting data from each client. This was implemented fairly simply but did not achieve its ultimate purpose. Each of these classes were to have validation methods built in that accepted or rejected client data by virtue of 'is it possible'. For instance, if the client says their position is at a given point, the ship validation (containing all information for movement such as acceleration, velocity, position, and rotation) would determine whether this was possible in the time passed and the given latency. If not, it would tell the client that their ship is elsewhere. When implementing this method however, even without the validation, it caused a lot of jumping around client side. This leads into what I would have done differently in regards to the server extension design.

What I would have done differently in regards to server extension design is completely simulate, and drive, the game from the server. What does this mean? Well, it would imply all physics, movement, game logic, events, combat, everything, would be handled server side. Essentially, the game core systems to drive it would have been programmed server side. The only responsibility of Unity would be to collect the data, render, connect, give user feedback, and get user input.

The database design of the project was small. There are only three tables and two that are actually used. The two tables that are used are for the user and the user scores. This is simple enough and was just enough to accomplish the lowest core requirements of the game. This I have no problem with and went without a hitch.

There are a few, more ambitious, ways I would have used the database.

Now, what I wanted to have done is much more in depth. On top of the scores and users, I wanted to add in functionality for the game table. The game table would hold metadata about each game played. This would allow new people joining the lobby to see a game created before they entered. It would also allow a player to see their past game statistics. Finally, I would have added more tables for ship configurations. This would hold all data for each weapon, projectile, and ship hull available. It would then allow players to set configurations when connected to the server and pick one for the game they are about to join.

The client design I turned out to work well with what was originally planned with a few modifications. The SmartFox Server singleton class did the grunt of the work. Its main responsibility was to connect, login, handle events, and forward data between client and server. This worked out excellently without any problems and worked as intended.

There are few things I would have changed. One would have been to create smaller scripts based on network actions. These scripts would look similar to the one I added last week called NetworkTransform:

public enum NetworkObjectType {
    PLAYER = 0,
    PROJECTILE
}

public enum CommunicationType {
    SEND_ONLY,
    RECEIVE_ONLY,
    SEND_AND_RECEIVE
}


public class NetworkTransformer : MonoBehaviour, IEventListener {

    public NetworkObjectType type;
    public CommunicationType commType;

    private int networkId = -1;
    private string stype;
    private IClientController server;


// Use this for initialization
void Start () {
        server = GameManager.gameManager.ClientController;
        server.Register(this);
        switch (type) {
            case NetworkObjectType.PLAYER:
                stype = "player";
                break;

            case NetworkObjectType.PROJECTILE:
                stype = "projectile";
                break;

            default:
                break;
        }
}

    public int NetworkId {
        get {
            return networkId;
        }
        set {
            networkId = value;
        }
    }
// Update is called once per frame
void Update () {
        if (commType == CommunicationType.SEND_ONLY || commType == CommunicationType.SEND_AND_RECEIVE) {
            SendData();
        }
}

    private float delay = 0.1f;
    private float timepassed = 0.0f;
    private void SendData() {
        timepassed += Time.deltaTime;
        if (timepassed >= delay) {
            switch (type) {
                case NetworkObjectType.PLAYER:
                    SendPlayerData();
                    break;

                case NetworkObjectType.PROJECTILE:
                    SendProjectileData();
                    break;

                default:
                    break;
            }
            
            timepassed = 0.0f;
        }
    }

    private void SendPlayerData() {
        Dictionary<string, object> data = new Dictionary<string, object>();
        data.Add("transform", transform);
        data.Add("type", stype);
        server.Send(DataType.TRANSFORM, data);
    }

    private void SendProjectileData() {
        Dictionary<string, object> data = new Dictionary<string, object>();
        data.Add("transform", transform);
        data.Add("type", stype);
        data.Add("networkId", networkId);
        server.Send(DataType.TRANSFORM, data);
    }

    public void Notify(string eventType, object o) {
        if (commType == CommunicationType.RECEIVE_ONLY || commType == CommunicationType.SEND_AND_RECEIVE) {
            switch (eventType) {

                case "transform":
                    handleTransform(o);
                    break;

                default:
                    break;
            }
        }
    }

    void OnDestroy() {
        GameManager.gameManager.ClientController.Unregister(this);
    }

    private void handleTransform(object o) {
        Dictionary<string, object> data = o as Dictionary<string, object>;
        int id = (int)data["id"];

        if (id != networkId) {
            return;
        }

        float px = (float)data["position.x"];
        float py = (float)data["position.y"];
        float pz = (float)data["position.z"];
        float rx = (float)data["rotation.x"];
        float ry = (float)data["rotation.y"];
        float rz = (float)data["rotation.z"];
        float rw = (float)data["rotation.w"];

        transform.position = new Vector3(px, py, pz);
        transform.rotation = new Quaternion(rx, ry, rz, rw);
    }
}

This class was hacked in to resolve issues where the SmartFox instance on the client side was doing too much management of data and resolving who gets what data rather than forwarding its data as originally designed. In fact, I would dare say I would have created a base script for this design that determined whether an object was send, receive, or send and receive only, then create a class for each type of network event possible. Right now, a lot of the scripts are tied to specific functionality and make reuse virtually non-existent - poor OOP design.

Moving forward we have a lot of plans for the game in regards to our class. A lot of the work to be done is related to the features of the game. So, unfortunately, most of what I said before of how I should have/ wanted to do things will not be implemented in this game. So, here is a list of what I need to get done, but I will not go into long winded detail right now. Next week though, I will explain how I will go about this when my final class starts, and the last 8 weeks of this project. Here is what I plan on getting done for next period:
  • Fix room leaving errors on server side
  • Fix users attempting to double join rooms
  • Email response to activate accounts
  • Clean up all GUIs in the game
  • Implement full database for game creation
  • Create game waiting lobby so players can queue before going into a game
  • Generating random space debris
  • Fix messaging between client and server as redundant and 'dead' data is being sent.