Several Questions about C# - Interested in Building Text Adventure Game
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 29

Thread: Several Questions about C# - Interested in Building Text Adventure Game

  1. #1
    Join Date
    Jan 2008
    Posts
    20

    Several Questions about C# - Interested in Building Text Adventure Game

    After toying with VB6, something many advised I avoid, I've decided to attempt to learn C#. However, when I ordered a beginner's guide (Microsoft Visual C# .NET Step By Step 2003) I was disappointed to learn that its instructional CD aid lacked a compiler.

    I've had a friend of mine copy Microsoft's free Express Visual Studio .NET image to a DVD, and I soon have to pick it up. I also have concerns about the .NET SDK. I downloaded a 23MB (likely old) version of the framework, and my Antechinus editor asks for a makefile utility location.



    Well, I found the Microsoft.NET directory, and it has no "nmake.exe." It doesn't even have a "bin" directory as I was instructed to look in, so I apparently need this updated Framework SDK. For my first question: Is this SDK included with a downloaded .iso image (offline install)? If not, is it possible to acquire a CD?



    I am fairly familiar with VB6 code, and find it easy to work with simple input/output structures, as I have tried to program a game using VB6. However, C# was recommended and I decided to try it, so here I am.

    I noticed while browsing some C# code examples that there is an entire system of TextBox controls that make it behave like a console. This is something I'd like to use in the game I am developing, and I'm embarassed to say that reading the example makes no sense to me. That just means I need to do my reading.

    I would like to give a brief explanation of the kind of game I am interested in developing. I have set up many plain-english instructions that serve as a model for the actual programming I need to do, and I continue to work on that to this day. It is my goal to begin translating it into C# code as soon as possible. The second question comes after the explanation (which I hope to keep short.)

    The game is a text-based adventure game where the player uses his environment to survive. This is a long-term project. My plan includes a vast map area to explore, containing several different types of terrain in which one must live. The idea is that there will be seasonal changes in temperature, along with offsets for sunrise and sunset. The player will be asked to satisfy hunger, maintain healthiness, maintain hydration, rest and carefully conserve energy, and maintain core temperature

    Many things will be added to influence these statistics - weather, accidents, not having a fire, etc. Not maintaining hydration, body temperature, and curbing hunger will also result in detrimental effects to health and energy. All statistics would be set up on an integer point system, and I have converted many of the text instructions into pseudocode already. The related changes are fairly easy to think out, and either a case or an if-then setup seems to be the best option.

    I hope to somehow construct seasonal weather patterns, hunted animal availability changes, greater energy loss during stormy, cold days, and etc. The map would be simply based on a fixed pattern of numbers - for instance, moving north meant subtraction 100 from the "location" value, while south would add 100, west would subtract 1, and east would add 1. This seems to be a simple enough way to reference different tiles of the grid.


    My question is, after reading my generalized description of the game, does it seem like C# is worth trying to build it in? It was probably recommended for a good reason, but I am completely wet behind the ears with C# and really don't know how to assemble the bits and pieces that I do understand.

    Any suggestions are appreciated, and if anyone knows of a source for a game that has been written in C#, it would truly help my learning. Perhaps I'm not searching in the right places, but it seems that most of the text-based adventures are programmed in C++... If so, then maybe I'll just have to buy lots more books.

    Anyhow, thanks for any suggestions/input at all. These forums helped guide me towards resources for educating myself in VB6, and I don't doubt that if I put the same amount of work in, I'll get the same results.

  2. #2
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    The Express edition has everything you need, and you can directly download it if you dont want to wait for your frieneds copy on DVD (at first I thought you might not have internet access, then I realized you were positng on the net. ]

    If it is going to be a pure text game, why not just write it as a console program, same as the original Adventure was done over thirty years ago (and I played it when it was first released).
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Jan 2008
    Posts
    20

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    You mention just using concole programming - I realize this would be a much easier route, and probably a better learning experience. I had considered doing it in console, but then I realized I could learn more, and mae the game more to my liking, if I had several handy systems put into place on a form-style application.

    Because you do not have to cunsciously think about your condition to know that you are cold or hungry, one of these systems planned is a statistics readout, which would display progress bars that reflected changes in stats. And since you do not have to tell yourself to assess the weather, heat of the day, or area the sun has risen to, I intend on using an uneditable textbox / label that would display facts about both the character's position, their speed of travel, and a box to display facts about your surroundings.

    I may attempt a small-scale console version for testing the outputs and such, and if I do I'll post more about that later tonight.

  4. #4
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    If you do a proper design and isolate your logica and data from the presentation, then you can write all of the logic, and test it with a console. \

    Then without making ANY changes to the logic.

    1) Make is a Windows Form
    2) Make is an ASP.NET page
    3) MAke is a WPF/Silverlight application.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  5. #5
    Join Date
    Jan 2008
    Posts
    20

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    I've decided that you're right - constructing it as a console and then overlaying an entire forms system with the proper displays would indeed be a better way to learn to handle C#.

    So I don't mean to be needy, but how in the world do I start this off? I assume I'll be including a using System; statement. My biook teaches you to use the WriteLine command, but I have no idea how to edit the prompt, or properly use the ReadLine function.

    Can anyone point to a good breakdown of this, or source with comments? After I learn what I'm doing, I'll try and post some of those things that I get finished, and maybe you guys could tell me how it looks?

    Appreciate the suggestion though, because isolating the logic does make more sense.

  6. #6
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by wall_fall_down
    I've decided that you're right - constructing it as a console and then overlaying an entire forms system with the proper displays would indeed be a better way to learn to handle C#.

    So I don't mean to be needy, but how in the world do I start this off? I assume I'll be including a using System; statement. My biook teaches you to use the WriteLine command, but I have no idea how to edit the prompt, or properly use the ReadLine function.

    Can anyone point to a good breakdown of this, or source with comments? After I learn what I'm doing, I'll try and post some of those things that I get finished, and maybe you guys could tell me how it looks?

    Appreciate the suggestion though, because isolating the logic does make more sense.
    Go ahead and just try some simple things. Look at the samples on MSDN for Read,ReadLine, Write and WriteLine methods. Post when you have questions that you cant find answer for....

    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  7. #7
    Join Date
    Jan 2008
    Posts
    20

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    So I've just finished more than half of my statistics system in visual basic 6... Haha, can't seem to drop old habits.

    When I install C# Visual Studio, I'll prolly figure out how to translate the two and maybe I can start using a language with brackets.

    For now, though, I'm continuing to write my logic in VB6.

  8. #8
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by wall_fall_down
    So I've just finished more than half of my statistics system in visual basic 6... Haha, can't seem to drop old habits.

    When I install C# Visual Studio, I'll prolly figure out how to translate the two and maybe I can start using a language with brackets.

    For now, though, I'm continuing to write my logic in VB6.
    Perhaps you might want to look at VB.NET before getting into C#. You might get a quicker grasp of the .NET Framework through VB.NET as the syntax would be somewhat familiar to you. There is a distinction between C# and the .NET Framework. You can be familiar with the C# language elements but you still need a basic knowledge of the .NET Framework in order to build any useful/substantial applications.

  9. #9
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by nelo
    Perhaps you might want to look at VB.NET before getting into C#. You might get a quicker grasp of the .NET Framework through VB.NET as the syntax would be somewhat familiar to you.
    Actually I usually recomment against that approach. The basic paradigms of a VB6 and VB.NET program are completly different. Even though the syntax is nealy identical. This tends to allow people to bring old habits (which may have been great) into the new environment (where they can be really bad).

    By switching to something different, they tend to start thinking differently. So when I am doing training on .Net fundamentals, I will often start the series for VB6 programmers with C#, and start C++ programmers with VB.Net. Sounds radical, but I have found it effective for the few hundred people who have been through one of my training series....
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  10. #10
    Join Date
    Jan 2005
    Posts
    56

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by TheCPUWizard
    The Express edition has everything you need, and you can directly download it if you dont want to wait for your frieneds copy on DVD (at first I thought you might not have internet access, then I realized you were positng on the net. ]

    If it is going to be a pure text game, why not just write it as a console program, same as the original Adventure was done over thirty years ago (and I played it when it was first released).
    Has it been 30 years? I have the source code on an 8" floppy which I have no way to read anymore. I hate to admit it but I had been programming for over 10 years when this "game" came out and it was the first real game I ever played on a computer. The version I had the source for was written in Fortran IV for a hobby Heathkit based on the LSI-03 by DEC Machine. I first played it on a Cyber Mainframe Circa 1977 and remember when the Apple ][ version came out which was expanded and had more tricks. I know that various versions of the source code are available, many have been converted to C and it would be a great place for wall_fall_down to start.

  11. #11
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by K7SN
    Has it been 30 years? I have the source code on an 8" floppy which I have no way to read anymore. I hate to admit it but I had been programming for over 10 years when this "game" came out and it was the first real game I ever played on a computer. The version I had the source for was written in Fortran IV for a hobby Heathkit based on the LSI-03 by DEC Machine. I first played it on a Cyber Mainframe Circa 1977 and remember when the Apple ][ version came out which was expanded and had more tricks. I know that various versions of the source code are available, many have been converted to C and it would be a great place for wall_fall_down to start.
    K7SN - I would have taken this to a PM, but you do not have them enabled. I still have 8' floppy capability for DEC RX-01 and RX-02 floppies (Part of my 1968 DC PDP-8 restoration project). The PDP-8 was the first machine I learned on back in the fall of '72....
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  12. #12
    Join Date
    Jan 2008
    Posts
    20

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Well, now I have all three of the express editions - Visual Basic 2008, Visual C# 2008, and Visual C++ 2008. At least my options are open.

    But none of them say .NET. They are presented as just that, 2008 editions of each. Is that significant?



    I'm figuring on still trying to code this in C#. However, since I understand VB to an extent, I have been writing Notepad source to pseudocode a lot of crap.

    Keeping in mind I have VERY LIMITED EXPERIENCE with VB6 (>2 years) and have not finished any programs more complex than algebraic calculators, small databases for filing info about my job, and the odd practice program for understanding how it works.

    In my time with programming, I have not learned too much, and would be completely confounded if anyone asked me to do something as complex as what I'm wanting to do with this game of mine.

    So honestly, it doesn't matter which one I learn. I'm familiar with most basic syntax in VB, but all three will require a couple more cheap educational books, I'm sure.

    Apparently my express version of VS08 came with the entire MSDN library for C++, C#, and VB. I've been looking into it quite a bit, and I'm glad you mentioned it, CPUWizard. Had you not, I'd have probably been ignoring it for a good while longer.

    Thanks for all the input, folks. I'm sure once I start turning over on my own, your collective wisdom will be more than enough for any minor difficulties. For now, I'm going to read.

  13. #13
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,537

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by TheCPUWizard
    ...By switching to something different, they tend to start thinking differently. So when I am doing training on .Net fundamentals, I will often start the series for VB6 programmers with C#, and start C++ programmers with VB.Net. ....
    Thats really a good idea. As its really like what you explain here. Changing from VB6 to C# in my case brought me to think in a complete other way then I did in VB6 before. I'm still able to do both, but in btween I'm really missing a lot when doing something in VB6.( Most times when I have to do some service on some of my legacy code ) And as I see here in the Forum people coming from C++ MFC sometimes have troubles to verify the differences needed in the design, because it looks them to be familar with this language, but they arn't.

    So IMHO it must be easier to get the new ideas in, when you have to learn a language, which doesn't seem to you to be 'nearly the same I ever did before' and with learning the language then you also get the new design.
    Quote Originally Posted by wall_fall_down
    ..But none of them say .NET. ...
    Hmm.. There is VB.net, C# itself is a .net language ASP.net too. So what you havn't ully understand about this terms? They all work with the framework. I would suggest you to really take a book and working with it ! Not reading, working. means doing all the examples. Even if you dont believe me this
    a) You will have fun to understand what you are doing
    b) you will see how different net languages are to old VB6
    c) The new design methodology will give you hundrets of new additional design ideas for what you want to produce. So its not single one second lost

    On the opposite you can do try and error getting a bit of what you want to get, finding out that your design was leading into a dead end starting again in a different way, fail again... until you are broken.. cannot be done is the standard end of that way. So decide, where you want to go.
    BTW A very good learning book is MS Visual C# 2005 Step by Step.
    A very cheap other good book is an e-book from apress named Ilustrated C#2005 also with lots of examples.
    Last edited by JonnyPoet; February 16th, 2008 at 02:52 PM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  14. #14
    Join Date
    Jan 2008
    Posts
    20

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    So I've been reading the MSDN stuff page after page and i still can't find my answers. So I'm going to ask some of the basic stuff.

    I've decided to code the console app first, but I really have no idea where to start. But let me explain what I mean.

    I have the equations and limiting if statements and such written out for the basic player stats (health, energy, hunger, hydration, core temp) but I don't know where to put them - should they be in a class? Are they best as methods? I've included a small example that I've put into C#, but I haven't continued because there are little red error marks and it won't compile. So I need to figure out what I'm doing wrong first.

    Code:
    namespace Survival
    {
        class Program
        {
            static void Main(string[] args)
            {
                public class statScore()
                {
                    public void healthStat()
                    {
                        string healthStr;
                        if (health = 0)
                            healthStr = "dead";
                        if (health >= 1 & health <= 20)
                            healthStr = "very unhealthy";
                        
                        Console.WriteLine ("Player is" + healthStr + ".");
    
                        // continuing if statements for other stats
                    }
                }
            }
        }
    }

    This is what I mean. I plan on putting the other stats into the same format, with a descriptive string and a decision block for what the string should be based on the int values of the stats themselves.

    Is it even placed correctly? Should the ifs and such be in a method or a struct or what? I have no idea how to begin coding.

    I won't be on to check replies for a long time, so if you have any questions abotu what I'm trying to get done, or goals, or if you just don't understand what the hell I'm talking about, be patient, and I'll get to answer you soon surely.

  15. #15
    Join Date
    Mar 2002
    Location
    NY, USA
    Posts
    12,097

    Re: Several Questions about C# - Interested in Building Text Adventure Game

    Quote Originally Posted by wall_fall_down
    I have no idea how to begin coding.
    Then you need to learn the fundamentals. Get a GOOD book on Object Oriented Design using C#, read it carefully, type in EVERY piece of code that is in the book. Run this code with the debugger, stepping through EVERY line. Do this until you are 100% certain that you have a full understanding of the material, BEFORE moving to the next section.

    The time spend will be well invested. Skip this crutial step, and you will have major problems and struggles.

    Good Luck.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009
    In theory, there is no difference between theory and paractice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center