Showing posts with label Web Design. Show all posts
Showing posts with label Web Design. Show all posts

Friday, August 21, 2015

TournamentCompare 0.001

I've been weighing up what programming project to work on for a while. I had Factor Friends as the front runner, but the move to a facebook friends variant didn't pan out as facebook now only allows access to friends of friends to only those who have installed / run your application. In some ways it is sad that the original concept cannot be done, but at least it wasn't made completely redundant if I had finished it before the changed the API.

On to TournamentCompare. I have been meaning to return to the Designing a Tournament series of articles for a while and it's really at the stage where I need some actual stats to pull together some comparisons. I had written a tournament analysis program back in 2006 to do some of the bias analysis, but since then I'd lost the Clarion development environment and couldn't continue modifying it for non-perfect play. So, a total rewrite is in order and hopefully make it web based and accessible for others to vet and build their own tournament types.

After a bit of digging it seems that another MVC application should be pretty easy, but use bootstrap to help with the presentation and graphs. Even though code first EF design seems to be more prevalent these days, I'm still a stickler for getting the data right so I've stuck with data first design.

Starting off the app in Visual Studio 2013 was pretty easy following this data first tutorial, although I'd created the MVC app first before creating the database. VS 2013 now has the ability to immediately add a SQL database right into the MVC project and create / modify tables and data right from within Visual Studio. I'm impressed! Within 1/2 hr I had the first TournamentTemplate tables done and looked like getting the others completed was just a matter of time. Went back to the tutorial to build up the entity framework for the starting tables, but unfortunately a VS crash took out the project connectors. Since it was so early I dumped and recreated the project with only the database making its way into the new project. EF done. Checked a quick update of the DB to make sure the EF would also update, and it looks pretty good so far.


Monday, December 31, 2012

Notoriously Databased v0.41

After a couple more play sessions there have been some more bugs to squish, some wierd strategies to rebalance and some UI recommendations to help smooth out the game's flow.

First off the list was to fix an abuse of the win condition by popping yourself over the notoriety limit for 2 turns in succession. I was sure i'd covered this by checking for a wipe on the winning turn, but it needed a check for wipes on the turn before as well to catch this devious little strat.

The turn submission screen also now has a notoriety list to help gauge where you are in relation to the notoriety limit and others. this has added a bit more informaiton at your fingertips to make your choice for next turn, but has also turned the submission screen into somewhat of a knowledge store for the game too. The recommendation to place the story on there is most likely as a response from relying more and more on the informaiton at hand rather than really reading and digesting exactly what's going on in the region.

To add the story to the submission screen I wanted to try a partial view so that the same information could be displayed there as well as in its current location. Because the view has already been set up I didn't think it would be too hard to turn it into a partial view.

It turns out that there are a number of different ways of making a partial view. What i really wanted was to call the same action that currently exists as it has a ViewModel and custom data gathering script already in place and a major part of what I didn't want to replicate, so calling the partial view using @Html.Action was the way to go.

After a couple of tests it turned out to be a fairly simple change:
 - Replicate CharacterCurrentStory into PartialCharacterCurrentStory in both the controller and view
 - Set PartialCharacterCurrentStory controller to return a PartialViewResult
 - Strip down PartialCharacterCurrentStory view to only show the table of messages fit for both views.
 - Strip down the old CharacterCurrentStory view to only show the headings and page setup
 - Call the PartialCharacterCurrentStory using @Html.Action()
 - Add the same call to the character submission
 - Strip down the old CharacterCurrentStory controller to only pass in the current character rather than the stories. 
 - Lock down PartialCharacterCurrentStory to only be called as a child action (probably not required, but handy to know)

Here's the end result for the controller:
        public ViewResult CharacterCurrentStory(int charID)
        {
            Character currentChar = db.Characters.Where(i => i.CharacterID == charID).SingleOrDefault();
            return View(currentChar);
        }


        [ChildActionOnly]
        public PartialViewResult PartialCharacterCurrentStory(int charID)
        {
            Character currentChar = db.Characters.Where(i => i.CharacterID == charID).SingleOrDefault();
            int currentStoryTurn = (int)db.Storys.Where(i => i.CharacterID == charID && (i.Turn.GameID == currentChar.GameID)).OrderByDescending(u => u.TurnID).FirstOrDefault().TurnID;
            var storys = db.Storys.Include("Character").Include("Turn").Where(i => i.TurnID == currentStoryTurn && (i.CharacterID == charID || i.isPublic == 1));
            return PartialView(storys.ToList());
        }

Sunday, November 04, 2012

Factor Friends website

As part of the final year 12 project for this year, they helped build a website to promote Factor Friends. Although we ran out of time to complete it all under the student's efforts, they put together a pretty good framework for the next phase in development. I've also been inspired to write my own version of Factor Friends to compete with their major project and place it up on the site too (when finished)

Friday, June 22, 2012

Notoriously Databased v0.21

Now that the tables and relationships were mapped out on paper, I then put them into a fresh database. Pretty easy after finding out some autoincrement foibles in the previous testing. 8 tables in all:


Users will have Characters inside each Game. The Characters will have CharacterSubmissions for each turn in what to do with their dungeon, which, once processed, is stored as the DungeonState. The Game will also revolve around a single village, that has VillageStates stored for each Turn. 

(Almost elemental facts, but meh ...)

Generating the App
Next step was to create the new MVC3 C# app. There were a number of steps that I needed memory jogging on, but I finally got the app set up with the database brought in by adding an ADO.NET Entity Data Model class to the Models directory. 

Account Control
The standard template came with ASP users and login hooked into a separate db, and not having to recreate login scripts and password obsfucation seemed like a good thing so I set about attempting to integrate it. Since the final version will be hosted online in AppHarbor using only one database, it seemed logical to bring all the ASP database tables into my own db and possibly link into the User table.

After some research it turns out that placing relationships onto the aspnet_user table is a bad thing in the long run, so I left the original tables as they were and added another field to handle linking to the unique ID. Hopefully I'll be able to link them together using API calls once the whole thing gets going. Creating the aspnet_ tables was relatively easy with aspnet_regsql , and apparently there's a lot more stored procedures that I would have missed if I tried to bring it over from the generated db file.

Once the db's had been merged, the next thing was to get the models to be merged. After a little bit of frustration, it seemed that the AccountModels didn't like accessing the aspnet files under the entity data model, so it was easier in the end to leave the connection string as a separate connection adressing the db with a simple SqlClient. The future problem will be that once I move it all to AppHarbor, it will only migrate one of the connection strings internally, so I'll have to manually update the ConnectionString to permenently point to the online db. Shouldn't be too much of a drama as there's not going to be much separation between production and testing.

Adding Controllers
User accounts complete! Adding controllers for the new tables worked relatively well once I figured out that the Data context class it was after was the complete NotoriousEntities class. Since I had added and removed it a couple of times, I had to restart VS 2010 to get it to pick it up. I'd heard that I should be able to refresh the database if it changed (because dropping the entity model and recreating is a pain) and once you double-click on the edmx file you can 'Update Model from Database..' from the NotoriousModel. Tested and working MUCH better.

Moving to AppHarbor.
I followed the general instructions to set up the new application, but finding the git info still needed a visit to the knowledge base. After previous tests with local git, I'd settled on integrating it into VS 2010.  Right click on the entire project in the project tree enabled me to start up a local git instance, then update it either with the Git Pending Changes addon, or straight to Git Bash. The shell will eventually be more useful, as once the remote git is set up I'll be constantly running the update and push commands. Update is nicer in the addon, but I can't see a push.

AppHarbor with SQL.  
It was easy to pick the free SQL shared server, but finding the details of the server to manually connect once again seemed harder than I remembered. There some new configuation variables that indicated a different method for connecting, but I finally found the options I needed by going to the SQL server. The connection string is going to be the main one to the entity model, and because of that it also needed the resource metadata to complete the connection string rewrite. After looking at the output, I pinched the ConnectionString data for the server itself and placed it over the account model connection. Seems to be working, but getting errors. Doh! no tables!

Once connected using SQL Server Management studio, the next task was to get all of the tables across. From the local database I could run a 'Generate Scripts..' task and point to all the tables. Hopefully the aspnet tables will be fine coming across as I'm pretty sure I won't be able to run aspnet_regsql over on the server.

Databases look good, but running the app looks like there's still issues. No stored procedures. Looks like I can output generation instruction for all stored procedures as a script in itself, and with a bit of massaging I got it to work. Now I need a schema :/.

Looks like I can get all the elements from generating scripts, so back to square one. Generating the complete database brings in too much database specific changes, so I tried picking all the items instead. Some ALTER ROLE scripts were ging to fail, but the rest seemed Ok so I merged them and manually added the role members using the GUI.

Still having issues with the schema, stating that it's an older, incompatible version; a task for another day ...   

EDIT: After a bit of Googling, it seems that the schema was fine, just aspnet requires some data to validate against. A quick merge of aspnet data files and it's all working. Now to build an integrated admin panel for manipulating the game data directly...





Friday, June 08, 2012

Notoriously Databased v0.2

After discussing with Andrew the benifits of MVC3 and AppHarbor, I was finally convinced that it was the way to go for the next step of developing Notorious. Hopefully it will allow a little more freedom in testing as I'll be able to fully automate the process and serve it up as a web app rather than Google Doc forms. Been a pretty long journey to get all the setup in place:

 - Looks like I'll need MVC3, EntityFramework, and AppHarbor testing
 - MVC3 needed Visual Studio 2010 sp1.  (250Mb)
 - Downloaded Windows Platform Installer to speed up the process. It was able to get most, but not entity Framework.
 - Tested MVC3 apps locally.
 - Downloaded GIT and merged local app to cloud
 - Needed to move data over to SQL, so downloaded 2012 SQL Management studio (600Mb)
 - Needs Windows 7 sp1, so it and another ~100 windows updates later ..
 - Management studio didn't seem to work by itself, so decided to move to 2012 express as well (200Mb)
 - Installed and running, and apparently management studio 2012 now magically works.
 - Played around with developing tables, and then merging them into MVC using entity frameworks. Lots of guidance by tutorials as this was not obvious. Eventual model first approach seems pretty slick rather than building LINQ.
 - Merged to cloud and then needed to figure out cloud connection. I could see the db fine in Management studio using the given user / pass, but couldn't connect to it using the app. finally figured out that it's rewriting the connection string itself. All I needed to do was to provide an alias to the model's connection string and also the resource metadata. 5 hours :/.
 - Looked at merging the data in case I neded to to that later on, but couldn't get a nice, simple way to do it across servers (I'm pretty sure the apharbour user doesn't have the right privelages for most options)
 - Ready to go!

3 days to get into a position to develop, and possibly 20 hours. Most of that was waiting for downloads, so maybe 8 hours in watching tutorials and testing stuff.

With all the tucked away, I spent 1/2 hr designing the table layout for the new NotoriouslyDatabased app. After building the guts of it on Google Docs, it's going to be pretty easy to convert the logic, but the file layout changes might mean a different approach is possible.

Tuesday, November 18, 2008

Site Redesign?

I've been more and more frustrated with the newspaper-like design. It started out as a simple selection from the blogger templates that needed only minor tweaks to match the "green screen" look of the old VRWorld website, but the lack of resizing has always bugged me.

A couple of years on and the right hand pane is filling up with all sorts of crap. It's now just looking messy. I tried to make it resizeable fairly early on in the piece, but the template uses a fixed width background to do the dropshadow and it was relegated into the "ToDo" bin to figure out what needed to be hacked up to make it scale.

Now I'm of the opinion it all needs to go. Start afresh with a new template that automatically scales, then build back the theme. After playing through the virtual level in World of Goo it reminded me of the neon VR feel I wanted at the start that the site now no longer resembles.

- Back up the page as it stands.
- Dump in a new template
- Re-add the tag cloud code
- Fix delicious links
- Fix feedjit colours
- Fix the background
- Play World of Goo