Closed. Please don't bump old threads.
EDIT:
Re-opened to see if there is still any interest in the topic.
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.
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.
Last edited by C_ntua; 10-27-2008 at 05:10 PM.
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)
What if he doesn't want to attack himself and accidently clicks the wrong target?
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 )
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.
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.
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.
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.
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.Code:public varType varName { get { return this.var; } //do something protective or productive here set { this.var = value; } //do something protective or productive here }
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++):
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.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; } }
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.
Why? I'd play that game non-stop just to attack myself... :P
Currently research OpenGL
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