Need Partners (D&D fan preferably)

This is a discussion on Need Partners (D&D fan preferably) within the Game Programming forums, part of the General Programming Boards category; Closed. Please don't bump old threads. EDIT: Re-opened to see if there is still any interest in the topic....

  1. #16
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Closed. Please don't bump old threads.

    EDIT:

    Re-opened to see if there is still any interest in the topic.
    Last edited by VirtualAce; 10-23-2008 at 11:21 PM.

  2. #17
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Thanks Dae. I fully understand know and is indeed very useful!

    Sorry for the delay of the topic. Didn't have time before to continue with my project.

    Well, lately, I've been studying C#, just to close my knowledge of C,C++,Java,C#. So, naturally, I tried to create again a game, to get used to C#/Visual Studio and Windows.Forms.

    So, I re-created the code, this time in C#.

    So, if anybody is STILL interested, I ll post the project I created. Basically, now I have the graphics and most of the code. But a lot of things still are needed. I make this post if anybody is interested to help and/or just view another (rather bad?) code.

    Though, note these:
    1) The code is not perfect. My purpose is to have some working code and then make it perfect if I see to it. Even though I read Dae's notes for example, I didn't use them in my code. I would like to explain myself, not to seem that I ignore good advice. Basically, I am not that big of a fan of OOP. I like having a rich library as .NET to work with, but when it comes to simple things I like the variable-based approach, in which you can make lots of lots of little nasty bugs. So you will see that most of the stuff are public, no set/get etc etc
    2) You don't have to read all the code to make sense. My job is to create the basic code, I need help though to writing the code for all the powers, classes, feats etc etc.

    So, first let me explain a bit the code and files:
    1) base.cs: In this file there is the basic classes. Like Character, Game, Weapon etc etc
    2) Power.cs: In this file there are all the powers. I have made the powers as this. I have a class Power and which will have a lot of static functions. Those functions are accessed from a delegate list in the Character class. Here I would like some help. There are a lot of powers in the game and if anybody is really interested it would be most welcome if he/she can write a power or two.
    3) Item.cs: Here will be the items created. I will create weapons for starters. If anybody can add a few weapons again most welcome.
    4) The rest....

    Some things to note:
    1) So far you can move and attack. You move by pressing Move button. Then you use the arrows. You have 4 steps to make. You can cancel the move with <space>. You attack with the Standard (action) button. You double click on the target and some message should be displayed in the down-textBox. You have one character and one dummy target.
    2) In order to add to the powers look at the basicMelee attack. Something similar should be done with the rest of the powers. Note that there are not restrictions of what the power can/should change. If for example a power moves a character it will directly move it. If it lowers its str it will character.str -= something. Also note that an ArrayList is passed to the power functions. This should contain everything necessary for the power. If a lot of thing need to be decided you can make something like a wrap function. Something that asks for the player to enter input and pass that input to an actual power fucntion through the ArrayList.

    Also, class and race and other stuff are not added yet. They don't need to be added at this point. Basically they will update the already existing stuff of the character, nothing else. So powers can be written even though classes don't exist. If you need more variables add them to the Character class, preferably with a comment so I know what is added and postback the code.

    Of course if anybody wants to make suggestions about the code, again most welcome. Thank you for you time...


    EDIT: I uploded a .txt file, which is really a .rar file. I hope there is no problem with this...
    EDIT2: If anybody is interested, post here before you create/change anything. Because at that point I might have already changed some minor things.
    Attached Files Attached Files
    Last edited by C_ntua; 10-27-2008 at 05:10 PM.

  3. #18
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Just thought I would throw in a few things for the hell of it.

    1) Don't let the character attack itself.
    2) Do not allow window resizing(or set up to handle it correctly)

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,781
    Hey, that is discrimination. What if the characters wants to attack themselves?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    What if he doesn't want to attack himself and accidently clicks the wrong target?

  6. #21
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,781
    What if he accidentally attacks the wrong enemy? Or heals the enemy?
    Point being, sometimes someone wants to attack him/herself... and sometimes you want to heal an enemy.
    Be careful of what you do and you will be fine!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    I hate to be argumentative, but where(or better yet why) would someone want to attack themselves, or heal an enemy. ( I can understand healing a npc, but not a enemy )

  8. #23
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,781
    Now that is just the thing - who are YOU to stop the player from doing what he/she wants?
    I have found, sometimes, in games, that I want to attack my own characters, or my character him/herself. Why stop it?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Because being able to attack yourself is a nuisance in most cases. Say you have 1hp and you accidentally attack yourself. Now you just died because of a unnecessary addition to the game.

  10. #25
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,781
    Then do not attack yourself! This is game control issue!
    You should not accidentally attack yourself - and if you do, it is the controls' fault.
    However, I would still retain the idea of being able to do so, with the proper use of controls. So that I am aware of what I am doing.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #26
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    I agree with you Elysia. I just don't think it should be as simple as a single-click to attack yourself is what I am trying to say.

  12. #27
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,781
    There we might agree...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #28
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Looks like a good start.

    Switching to C# is a good idea anyway, merely to get the ball rolling. I decided to start my first C#.NET application a few days ago for that very reason.

    Similar syntax, quick, powerful, and less mess (the only thing I dislike is requiring .NET installed). For example you now have the power of that whole accessor (set/get) abstraction called properties in C#, as you may have seen.

    Code:
    public varType varName
    {
      get { return this.var; } //do something protective or productive here
      set { this.var = value; } //do something protective or productive here
    }
    Are you going to continue with the basic old-school D&D feel graphics, or you wanted help with 2D graphics (gameboy, snes, ff3, etc.). You might want to look into XNA. Although it's primary pitch is for Xbox game development, it's the replacement for MDX (Managed DirectX). As such, you can start up one of those projects, ditch the auto-created class, attach the graphics device to a panel in your WinForms and just use the library/content pipeline for graphics (they have tutorials for this). The content pipeline is an easy-to-use way to incorporate 2D images, 3D fx, audio, etc.

    There's a tutorial here which I followed and had me running a simple Mario game in a few hours: http://www.xnadevelopment.com/tutorials.shtml

    Speaking of properties, while following that tutorial I changed their code a little to show another way properties can be useful. A simple efficiency tweak in game creation is instead of re-calculating variables every time something is changed (which can happen rapidly), recalculate them when something is changed AND it's requested. In order to do that you have bools (or bits - efficient/convenient) and would use getVar/setVar in C++, a new wrapper class for the variable in C++ (or use a templated class), or the simple property syntax in C# (which also exists in Visual C++ btw, Microsoft's version of C++):

    Code:
            // source
    
            private Rectangle source;
            private bool sourceChanged = false;
    
            public Rectangle Source
            {
                get { return this.source; }
    
                set
                {
                    this.source = value;
                    this.sourceChanged = true;
                }
            }
    
            // scale
    
            private float scale = 1.0f;
            private bool scaleChanged = false;
    
            public float Scale
            {
                get { return this.scale; }
    
                set
                {
                    this.scale = value;
                    this.scaleChanged = true;
                }
            }
    
            // size - recalculate if either scale or source change
    
            private Rectangle size;
    
            public Rectangle Size
            {
                get
                {
                    if (this.scaleChanged || this.sourceChanged)
                        this.size = new Rectangle(0, 0, (int)(this.source.Width * this.scale), (int)(this.source.Height * this.scale));
    
                    return this.size;
                }
    
                set { this.size = value; }
            }
    That can be extended one further and check if this.source != value before saying it's been changed. Also noticed you would need to put scaleChanged and sourceChanged back to false afterwards, which is another reason bitwise is more convenient.

    I might be interested in helping out with graphics and overall if you are going to use XNA or DirectX, because I need the experience for my other projects (which are 3D).
    Last edited by Dae; 10-28-2008 at 05:06 PM.

  14. #29
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    Why? I'd play that game non-stop just to attack myself... :P
    Currently research OpenGL

  15. #30
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    I attack myself in real life, sometimes...

    I shouldn't be restricted from doing so in a game. How unrealistic is that?! :P

    It's the whole 'friendly-fire' deal, which you could have an option to turn off/on.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Hardware + Software][C++ or C#] USB Fan
    By Mywk in forum C++ Programming
    Replies: 16
    Last Post: 07-04-2009, 03:12 PM
  2. What is the fan size?
    By adr in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 12-06-2007, 02:21 PM
  3. Computer Fan question
    By the dead tree in forum Tech Board
    Replies: 2
    Last Post: 12-28-2005, 03:16 PM
  4. Stress Test: Graphics/CPU intense
    By RoD in forum Tech Board
    Replies: 90
    Last Post: 01-19-2003, 12:20 PM
  5. P4 Fan problem: Urgent
    By RoD in forum Tech Board
    Replies: 5
    Last Post: 01-15-2003, 11:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21