Dreamscape

Note: I’ll be re-writing this OP eventually…

Over the past few months I’ve been very slowly learning Java and becoming better and better through re-writing this game multiple, around six, times now. This game will, hopefully, be a playable RPG in the future but for now it’s just a little project of mine.
It’s taken quite a while but I managed to wrap my head around how a bit of these things such as collision detection work and so I was able to finally get it working and into the game. Now that that, in my opinion, huge leap has happened I can finally start working on some of the more fun and interesting parts of the game.

Although there isn’t much to show, here is what the game currently looks like:

Random Ideas for the Future:

  • The game will be a top down view just like an old NES style SRPG.
  • There will be no set classes in the game. You decide if you want to be mele, caster or ranged at the beginning but you can become whatever you want.
  • The game will be open ended as to allow me to keep adding content.

Current Goals:

  • Put enemies into the game and have them move around using waypoints.
  • Create a decent looking map to play on.
  • Get a custom made player sprite to replace the current one that I ripped off of google images.
  • Create menus for quests, options, etc…
  • Add sound and music.
  • Add a battle system.

~Updated 13-Jul-2013

There isn’t much to go off, but from what I do see, you should use some anti-aliasing around the scrolls so they don’t have so much of a jagged look to them.

Example:

The one of the right looks a lot more smooth due to anti-aliasing…

-Pickle :slight_smile:

Does anti-aliasing work on png images that are being loaded from the folder that the program is running from, if so I’ll check out how to use it.

Pixels that

Pixels that are see-through will appear white against another background with .png’s… I think it maybe a problem that’ll have to be solved in an image editting program like photoshop.

The other thing you may be able to do (not sure, haven’t tried) is adding a tiny blur effect to buttons… This might solve the problem. Either way, if it’s too time consuming, I would say put a pin in it and come back to it later when the game is reaching alpha/beta testing.

-Pickle :slight_smile:

I just did a little test with the blur tools in photoshop, the button is really small so it didn’t make a very noticable difference in-game. I think I’ll do as you’ve also suggested, I’ll put “Make new buttons!” on my to-do list.

There is no such term. Just saying.
Because I mean, in video games most RPGs are primarily single player anyway

It’s a made-up term that stuck with me from when I used to mod Warcraft 3, you were either making an SRPG or an ORPG (Online RPG). Hopefully nobody minds the term. =P

Sounds good! Can’t wait to see more :slight_smile:

For your question about the JPanel, yes, you can, by using JLabel (on the image in the code, if you get what I mean :wink: ).

I did a little bit of work today, although I don’t have anything new to show I do have a quick question. Is it acceptable for me to have a ‘Global Variables’ class such as the two below so that I can just use them whenever and wherever I want or will doing this create some obstacle, problem, etc… that I may run into later on?

class GlobalVariables //Create variables here if you want to use them anywhere. To refrence the variable use GlobalVariables.variableName 
{
	public static String characterNAME = "", characterALIGNMENT = "";
	public static int characterLEVEL = 1;
	public static int characterSTR = 0, characterAGIL = 0, characterDEX = 0, characterINT = 0, characterCON = 0, characterCHAR = 0, characterSPWR = 0, characterHPWR = 0, characterXP = 0, characterHEALTH = 0, characterMANA = 0, characterGOLD = 0;
	
	public static JPanel gamePanel;
	public static Font abaddonFont;
	
	/* 
	* A few of the main primitive data types.
	*
	* byte = -128 to 127
	* short = -32,768 to 32,767
	* int = -2,147,483,648 to 2,147,483,647
	* long = -9,223,372,036,775,808 to 9,223,372,036,775,807
	* boolean = true or false
	*/
}

//All of the global formulas used in the game will be stored here.
class GlobalFormulas
{
	public double attackFormula(int mainAttribute, int weaponRoll, int passiveSkills, int baseDamage)
	{
		return ((mainAttribute/2) + weaponRoll + passiveSkills + baseDamage);
	}
	
	public double attackMagicFormula(int spellDamage, int intellect, int passiveSkills, int spellPower)
	{
		return (((intellect / 2) * passiveSkills) * spellPower);
	}
	
	public double healingMagicFormula(int spellDamage, int intellect, int passiveSkills, int healingPower)
	{
		return (((intellect / 2) * passiveSkills) * healingPower);
	}
	
	public double defenceFormula(int constitution, int armor, int passiveSkills)
	{
		return ((constitution / 3) + armor + passiveSkills);
	}
}

Edit: In other news I’ve finished what I currently need to do on the character creation screen so I’ve started to try and wrap my head around how to actually create the game. I’m currently reading up on various ways to display and update images but I probably won’t have anything working for awhile.

No, that’s pretty much not good design at all, sorry. Consider watching some of these:

I’ll check out those videos when I get a chance. Why is it not good design and what would be a better way to do it; The only other way I can think of using all my variables wherever I want would be an annoyance. I’d need to keep using something like:

ClassName variableName = new MethodNameThatIsTheSameAsClassName(passATonOfVariablesHere);

Edit: That would be mainly for the menu screens, I’m not sure of the non-menu screens though.

It’s not good design because it’s just not object-oriented at all. I’ll grant that OO is sometimes a little bit overblown, but if you’re going to write in Java, it’s really what the language is heavily geared toward. In fact, throwing everything into a global isn’t even good structured programming, OO or not.

I don’t pretend to have the teaching skill to introduce OOP, which is why I pointed at those videos (I’ve not watched them, but I’ve seen them referred to before). I’d at least consider a class like Player to collect things like name, alignment, level, stats, and so forth. The formulas, I don’t know enough about your game to say, but I’d consider a Weapon and Spell class, with [icode]attack(Player attacker,Player target)[/icode] and [icode]cast(Player caster,Player target)[/icode] methods.

Just so I can figure this out a bit more, here’s an example I’m making up based on what I know and kinda-sorta know.

1.) The game is launched and the user creates a character.
2.) When the user clicks continue on the character creation screen a constructor in the ‘character’ class would be fed all of the stats and information from the various variables in the ‘characterCreationMenu’ class. If I use something along the lines of:

Character referenceCreatedCharacter = new Character(str, agil, dex, int, con, alignment, name)

Would I be able to somehow pass around and get the variables from the referenceCreatedCharacter object and work with the variables that way?
I’m pretty sure when I google around after I submit this question I’ll find a way to do that but the one thing that might be hard to find is the type of object that referenceCreatedCharacter is, it’s not declared as an int, byte, short or anything as far as I can see so I’m not sure how to pass it around.

BTW, thanks for the weapon/spell class idea. I think I’ll try something similar when I get there after re-writing the program.

Edit: Oh and the formulas are just some simple equations that me and my friends figured out, it works for our table-top game so I’m trying them out in this game.

Objects are values like anything else, and you pass them like anything else. I don’t want to sound overly critical, but this is super-basic java programming knowledge that you need to get comfortable with, perhaps by following some tutorials or books.

As for wanting to avoid a constructor that takes a zillion args, that’s understandable. One thing you could investigate is the Builder Pattern, which would be very appropriate for something like a RPG character where you’re literally building them up in pieces. You need to get basic reference semantics under your belt first though.

Constructors and passing around variables was one of the two units in my CS course that I didn’t understand at all so I’m somewhat clueless when it comes to working with them without some sort of googled reference. Also, thanks for the link!

Edit: I’ve looked into constructors a bit more and I’m going to try to re-write my program as to get rid of the global variables completely, I have one question before I’m able to re-write any of the menus. What type of variable would be created from:

TestOneTwo tempReference = new TestOneTwo();

I need to know because I wont be able to pass the tempReference into the constructor for my actionlistiners to work without knowing the type; Well that’s what I think I need to do anyways…

Be careful how you use that phrase - Java doesn’t technically have global variables (I think).
They’re called fields of a class. It’s not that important though :wink:

You have to rethink this a bit, it’s really not that hard :wink:
Like Sproingie said objects are values like anything else. And in java everything is an object
So passing values around isn’t difficult. There isn’t really any difference between passing primitive data types and objects.

So if we want to pass a name of a person to a other person.


public String name;

/*constructor*/
public Person(Person otherPerson) {
     this.name = otherPerson.name;
}

Want to return a reference to a object?


public Person aPerson;

public Person getPerson() {
    return aPerson;
}

But yeah this is basic so you should perhaps consider takeing some time learning. It won’t take you much time before you get it under your belt
Hope I could help you a little :slight_smile:

Take a look at this one.
http://docs.oracle.com/javase/tutorial/java/javaOO/index.html

Well, I just re-wrote everything and got rid of all the ‘fields of a class’ aka fake global variables. The entire unit in my CS class just somehow started to make sense after reading these comments although I’m not sure how. I’ve set up the shell of a character class which uses getters/setters as well so I made a lot of progress. ^.^

Thank’s for the help!

Learn to find errors yourself, you won’t be able to rely on other people forever.
I don’t think there is anything wring with the code (I haven’t actually read it yet), because my experience with swing taught me that it is unexpectedly slow at random times.
Just get on with the game and worry about it if it gets worse.