• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Dastrn's Programming Projects Thread

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I'm a fledgling C# developer, and I want a place to share and discuss my projects with you guys. I'll post some pics/videos soon of my recent projects, including a 15-Puzzle, Poker, a Dope-Wars clone, and my latest game called Quick Clicks, with is sort of a fast-paced button clicking game similar to whack-a-mole, but with power-ups.

I'm off to work now, so I can't post more, but I figured I'd get the thread started before I left.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
Sounds cool to me. I've been a .NET (mainly C#) developer for almost a few years (PHP before that), so this is right up my alley.

Only thing I've done in C# outside of work so far has been to build www.jabsy.com :) Shameless plug, haha.

Any tips/project ideas/cool stuff about C# or programming in general should go in here.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
It uses Google's Geolocation API. Google does it to you as well, but they don't ask :) How do you think your search results are conveniently based around where you are?
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
Didn't mean to plug my site I just think this is something SWF has needed for a while, something to talk about programming.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
Among other awesome features I wrote for my game this weekend, I wrote a multi-user save file feature that is completely gangster. It searches through the file for your username, and if it finds it, it grabs the next 40 lines, which have all your save data on it. If it doesn't find it, it adds you to the top with new data. Everytime it saves your game, it adds your name to the top with your 40 lines of data, and then sticks all the data from all the other saves in underneath of your data, so the most recent user name always comes up first.
 

GOTM

Smash Champion
Joined
Feb 4, 2007
Messages
2,776
Location
West Chester, PA
Have you thought about creating a save file system based on XML? That way, it's just a huge tree of data, and one of the tags could be the date, so you could use an XML parsing library (already available in .NET), and always find the most recent save file, as well as search for past ones.

Also the tree-like structure completely ***** the linear search you'd have to do in O(n) to find your save file if the text file was enormous.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I hadn't thought about using XML for it, since I've never used it.

The good thing about this method is that it's a unique file per copy of the game. So even if 200 people all played this game on the same computer, the file would still only be 8000 lines of text, which is about how many lines of code the game has currently, so it would be negligible.

I would like to learn XML a bit soon, though. Thanks for the suggestion.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I've added button graphics. Pythag and I are playing with some design ideas. It looks pretty cool.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I've added a few new tricks, including the ability to limit the maximum number of each powerup tha can be on the screen at once, per level, so each level can have its own values.

I'm learning XML save file systems now. I'll switch over to that system soon. Right now, I usually delete my level save file every time I add something new, so I won't have read errors, and I won't have to go in and manually add lines for the updates. But because of XML's extensibility, I won't have to do that. I'll plan on writing a function to amend my save files to add new elements into each level as I add them.

I imagine I'll have this new save system in place within a few days. Next on my list is probably writing my two new modes, which are Combo and Memory. I think I'm maybe 3-4 weeks away from doing an official release. I'll put together a website at that point to be the home of my games.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
Ok, I've got the XML save system working in a mock-up project. I'll convert my save system over to it in the next day or two. I'll be super busy for a few days, but I think I'll find time on either Monday night or Tuesday night.

I'm pumped about this update.

edit: I switched it over this morning. Took me maybe 20 minutes to implement. SUPER cool update. GOTM, thanks for the suggestion. I LOVE how much more flexible this system is. I can add and remove features and my save file is still useful.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I updated my player save feature to use XML as well. I managed to get all player saves into one file that the program can parse, adding players to it if a new username logs in. I got half of it done last night, to the point where it could save them in separate files for each user, but I wasn't happy with that and really wanted it all in one file. I slept on it, and figured out how it needed to work this morning and fixed it.

Are there code tags on swf? I kind of want to post my read/write functions.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I started work on a chess program tonight. I'm going to bed now, but I'll post some screenies or something soon on that.

I also spoke with 2 separate companies today about the potential of doing some coding for them. One would be PHP, but I'd be doing mostly project management and marketing. The other is an On Rails shop, doing major projects for Groupon, among other clients.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
Back to working on quick clicks. Memory mode is now well on it's way. It flashes the buttons at you for just a second, and gives you a sequence to click, and you have to click them blind by memory.

It's pretty fun.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I'll put a video up soon showing my progress on Quick Clicks. It's getting to be pretty sweet.
Memory mode is complete, although I still need to do level design.

After that, I need to do combo mode.

All I'll need after that is my graphics guy to do some icons for me and then the game will be ready for release. We're working on a website to put out stuff up on, so I'll link that site here when it's ready. It'll be a few months on the site, but I think Quick Clicks will be ready for release before Christmas.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
Are there code tags on swf? I kind of want to post my read/write functions.
Here are my read/write functions for my XML save files.

Code:
        private void readXMLPlayerFile()
        {
            if (!File.Exists("Saves/PlayerMemorySave.xml"))
            {
                for (int i = 1; i <= numLevels; i++)
                {
                    l[i].setComplete(false);
                }
                
                writeXMLPlayerFile();
                levelPanelColors();
            }
            XmlTextReader reader = new XmlTextReader("Saves/PlayerMemorySave.xml");
            XmlNodeType type;
            bool thisPlayer = false;
            bool foundMe = false;
            int id = 0;
            int playerTempID = 0;
            string gameMode = "";

            while (reader.Read())
            {
                type = reader.NodeType;
                if (type == XmlNodeType.Element)
                {
                    if (reader.Name == "Name")
                    {
                        reader.Read();
                        if (reader.Value == playerName)
                        {
                            thisPlayer = true;
                            foundMe = true;
                        }
                        else
                        {
                            thisPlayer = false;
                            player[playerTempID].setName(reader.Value); 
                        }
                    }
                    if (reader.Name == "GameMode")
                    {
                        reader.Read();
                        gameMode = reader.Value.ToString();
                    }
                    if (reader.Name == "LevelID" && gameMode == "Memory")
                    {
                        reader.Read();
                        id = Convert.ToInt32(reader.Value);
                    }
                    if (reader.Name == "Completed" && gameMode == "Memory")
                    {
                        reader.Read();
                        if (id <= numLevels)
                        {
                            if (thisPlayer)
                            {
                                l[id].setComplete(Convert.ToBoolean(reader.Value));
                            }
                            else
                            {
                                player[playerTempID].setLevelComplete(id, Convert.ToBoolean(reader.Value));
                            }
                        }
                    }
                }
                else if (type == XmlNodeType.EndElement)
                {
                    if (reader.Name == "Player")
                    {
                        thisPlayer = false;
                        playerTempID++;
                    }
                }
            }
            reader.Close();
            if (!foundMe)
            {
                for (int i = 1; i <= numLevels; i++)
                {
                    l[i].setComplete(false);
                }
            }
            levelPanelColors();
        }
        public void writeXMLPlayerFile()
        {
            int playerID = 0;
            
            // Create a new file in C:\\ dir
            XmlTextWriter textWriter = new XmlTextWriter("Saves/PlayerMemorySave.xml", null);
            // Opens the document
            textWriter.WriteStartDocument();
            // Write comments
            textWriter.WriteComment("Quick Clicks Save File. Do not edit!");


            textWriter.WriteStartElement("QuickClicks");
            textWriter.WriteStartElement("Player");

            textWriter.WriteStartElement("Name", "");
            textWriter.WriteString(playerName);
            textWriter.WriteEndElement();

            textWriter.WriteStartElement("GameMode", "");
            textWriter.WriteString("Memory");
            textWriter.WriteEndElement();

            for (int i = 1; i <= numLevels; i++)
            {
                textWriter.WriteStartElement("Level");

                textWriter.WriteStartElement("LevelID", "");
                textWriter.WriteString(i.ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("Completed", "");
                textWriter.WriteString(l[i].getComplete().ToString());
                textWriter.WriteEndElement();

                

                // Ends "Level" Element
                textWriter.WriteEndElement();
            }
            // Ends "Player" Element
            textWriter.WriteEndElement();
            while (player[playerID].getName() != null)
            {
                textWriter.WriteStartElement("Player");

                textWriter.WriteStartElement("Name", "");
                textWriter.WriteString(player[playerID].getName());
                textWriter.WriteEndElement();

                for (int i = 1; i <= numLevels; i++)
                {
                    textWriter.WriteStartElement("Level");

                    textWriter.WriteStartElement("LevelID", "");
                    textWriter.WriteString(i.ToString());
                    textWriter.WriteEndElement();

                    textWriter.WriteStartElement("Completed", "");
                    textWriter.WriteString(player[playerID].getLevelComplete(i).ToString());
                    textWriter.WriteEndElement();

                    // Ends Level Element
                    textWriter.WriteEndElement();
                }

                // Ends "Player" Element
                textWriter.WriteEndElement();
                playerID++;
            }

            // Ends the "QuickClicks" Element
            textWriter.WriteEndElement();
            // Ends the document.
            textWriter.WriteEndDocument();
            // close writer
            textWriter.Close();
        }

        // Read file function
        private void readMemoryXMLFile()
        {
            if (!File.Exists("saveMemoryFile.xml"))
            {
                writeMemoryXMLFile();
            }

            XmlTextReader reader = new XmlTextReader("saveMemoryFile.xml");
            XmlNodeType type;
            int i = 0;

            while (reader.Read())
            {
                type = reader.NodeType;

                if (type == XmlNodeType.Element)
                {
                    if (reader.Name == "Id")
                    {
                        reader.Read();
                        if (Convert.ToInt32(reader.Value) <= numLevels)
                        {
                            i = Convert.ToInt32(reader.Value);
                        }
                        else
                        {
                            i = 0;
                            break;
                        }
                    }
                    else if (reader.Name == "Interval")
                    {
                        reader.Read();
                        l[i].setInterval(Convert.ToInt32(reader.Value));
                    }
                    else if (reader.Name == "Colors")
                    {
                        reader.Read();
                        l[i].setColors(Convert.ToInt32(reader.Value));
                    }
                    else if (reader.Name == "ImagePack")
                    {
                        reader.Read();
                        l[i].setImagePack(Convert.ToInt32(reader.Value));
                    }

                    else if (reader.Name == "NumButtons")
                    {
                        reader.Read();
                        l[i].setNumButtons(Convert.ToInt32(reader.Value));
                    }

                    else if (reader.Name == "NumVariables")
                    {
                        reader.Read();
                        l[i].setNumVariables(Convert.ToInt32(reader.Value));
                    }
                }
            }
            reader.Close();
            levelSetup();
        }
        private void writeMemoryXMLFile()
        {
            // Create a new file in C:\\ dir
            XmlTextWriter textWriter = new XmlTextWriter("saveMemoryFile.xml", null);
            // Opens the document
            textWriter.WriteStartDocument();
            // Write comments
            textWriter.WriteComment("Quick Clicks Save File. Do not edit!");
            // Write first element
            textWriter.WriteStartElement("QuickClicks");
            textWriter.WriteStartElement("Levels");
            for (int i = 1; i <= numLevels; i++)
            {
                textWriter.WriteStartElement("Level");

                textWriter.WriteStartElement("Id", "");
                textWriter.WriteString(i.ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("Interval", "");
                textWriter.WriteString(l[i].getInterval().ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("Colors", "");
                textWriter.WriteString(l[i].getColors().ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("ImagePack", "");
                textWriter.WriteString(l[i].getImagePack().ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("NumButtons", "");
                textWriter.WriteString(l[i].getNumButtons().ToString());
                textWriter.WriteEndElement();

                textWriter.WriteStartElement("NumVariables", "");
                textWriter.WriteString(l[i].getNumVariables().ToString());
                textWriter.WriteEndElement();

                textWriter.WriteEndElement();
            }
            textWriter.WriteEndElement();
            textWriter.WriteEndElement();
            // Ends the document.
            textWriter.WriteEndDocument();
            // close writer
            textWriter.Close();
        }
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I'm working on a new project. I'm making a Tower of Hanoi program. I got the game logic and rules done, and it's totally playable. All in maybe 3-4 hours of coding.
Now I have to put a wrapper on it that looks pretty, add save features, etc.
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I've decided to turn that one hanoi program into a package of many classic puzzles.
I haven't done any real visual design work yet, and I'm focusing on getting all the puzzles working. Once I'm satisfied with the package, then I'll go back through and implement design and saves. I'm hoping to put it all up so you can play in your browser when I'm done, rather than downloading an exe.

I added 2 puzzles already. One is a board with 9 holes in it in a line, with 4 blue marbles on one side, and 4 red marbles on the other, with an empty hole in the middle. You have to get the reds to the blue side and blues to the red side. Marbles can only move forward. they can either move into the space immediately in front of them if it's empty, or jump one ball of hte opposite color.

the 3rd puzzle is the pyramid pegs puzzle, which you've all seen at cracker barrel and what not. You're moving pegs by jumping over each other, and removing the one you jumped. Your goal is to remove all pegs but one, ideally landing the last peg into the original empty slot.
This one is taking the longest, but the logic is well on it's way. I have the first 5 slots complete, with 10 more to go. and the logic is cut and paste from here, and you just change the numbers. Should be done tonight.

I think my goal will be to create a website for people who enjoy puzzles, with the opportunity to play many puzzles on the site, as well as instructions for how to complete the puzzles if you're interested. I'd probably also create an entire section of the site for chess essays and lessons, since I'm a chess guy too.
 

John2k4

The End of an Era
Joined
Aug 28, 2011
Messages
8,989
I'd take those chess lessons... :laugh:

So if you're going to have them running in the browser, which language are you going to use?
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
Pyramid pegs is done.

I need a graphics guy to add some flair to my games. I'm great with all the game logic in particular. It's just visuals that are not really my thing.
 

John2k4

The End of an Era
Joined
Aug 28, 2011
Messages
8,989
Let me know what you're thinking of, I'll try to create it. :)
 

Dastrn

BRoomer
BRoomer
Joined
Jul 16, 2005
Messages
9,472
Location
Indiana
I'm designing a strategy game that I'm pretty excited about. Hexagon grid. You level up stats that will last past the game you're in. You gain stats after each game that you can use to upgrade abilities. Each game will be 3v3 to 5v5 depending on the map. You choose characters out of your team to play in each game. You can bank dozens of characters and develop them down whatever paths you want. Each character starts with generic stats and abilities and as you use certain attacks, you gain xp in that area, which gives you new abilities.
You can also build buildings on tiles on the map, which do different things. Walls block walking and attacks, magic shields slow enemies and block spells. Turrets shoot at targets near them. Etc.
Each turn you have to use resources to make your moves. You can also build resource nodes to provide extra resource points over time, but you get diminished returns if you wander too far from your nodes.

Pretty excited about the project.
 
Top Bottom