Jump to content
  • Advertisement

RidiculousName

Member
  • Content Count

    100
  • Joined

  • Last visited

Community Reputation

256 Neutral

1 Follower

About RidiculousName

  • Rank
    Member

Personal Information

  • Role
    Game Designer
  • Interests
    Design
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. RidiculousName

    Java's Weaknesses in Game Creation

    Thanks again everyone. I am just finishing up the course I was about to take when I started this thread. I decided to program my game's visuals in JavaFX, and while I've heard it's much better than Swing, I often have trouble finding reliable information on it. I probably shouldn't have decided to try and program the whole thing in native Java instead of JavaFX's XML-style notation, "FXML".
  2. I've recently found out about that too. I wish I had known it beforehand. This will really help me, thank you.
  3. Thank you! I'm not sure if this is just because I have a math disability, but I sometimes hear people talk about how real mathematics is about logic, not memorization. I'm sure that's true. The problem is, on an exam, I don't have the time to figure out how [1 + cos(2x)] / 2 = cos^2(x), I have it memorized, or I get it wrong. Your answers have been really helpful for me. I will definitely think about what you said. It's not like I don't understand the problems conceptually, I just have a lot of trouble memorizing all the related stuff. Would you please tell me whether calculus is necessary to understand procedural generation and artificial intelligence? This is primarily why I feel like I may want to take Calculus 1 and 2. Also, sorry I can't get the MATH notation here to work.
  4. Thank you for the reasoned response. I think I can follow the video fairly well. That video seems very well done, and explains things a lot better than what I am used to from my my math teachers/professors. I didn't watch the whole series, but my problem mostly stems from being unable to remember a bunch of different formulas, identities, types of notation, and other such things very well. I can do it, but it takes more repetition, and I still have to think for awhile to remember them, and figure out what tools go with which problem. I am worried that if I skip Calculus I won't have the foundational knowledge necessary to learn procedural generation and artificial intelligence.
  5. I have a diagnosed math disability and I really struggled with PreCalculus this semester. I know I won't be doing much with Calculus as software engineer because I don't want to be involved professionally with a game company. I think I have the ability to pass the course, but it takes me a very long time to study and resultingly leaves me very little time to study for my other classes. This makes it very difficult for me to keep up my GPA. I tend to only get "passing" grades in Math subjects regardless. Also, I have to attend full-time because of the requirements for the Financial Aid I need to have to pay for college. Computer Science majors need to attend both Calculus 1 and Calculus 2. The Computer Science Department in my college doesn't allow us to make our own custom degrees. However, I do want to continue making games as a hobby. I want to be able to learn how to do fairly "fancy" things like create procedurally-generated worlds, and I want to have at least some ability to create AI for monsters and such. My question is, knowing this, should I see if I can get a waiver for Calculus 1 and 2?
  6. Heh, I am not sure either. That doesn't make sense. There is no Equipment class, you mean Item, their super-class? I posted a while back about not being sure how to manage a bunch of objects across multiple files. It's an instance of my Organizer class that, well, helps me organize everything. I'm not sure what other option I really have. Organizer itself is a mess because it deals with multiple custom types and, well, lots of different things that need to be handled in different ways. Because Organizer is it's class type, and I couldn't think of anything.. 😚
  7. I have a method that's gotten rather bloated and unwieldy. This is mostly because I ended embedding a switch-statement inside another switch-statement. The outer switch-statement could be swapped with an if-statement, but that doesn't seem like it would help much. I selected this method in particular because all of the switch-cases do very very similar things, and it seems like I may be able to simplify the method. To explain the method a bit: I have a Bandit class that holds various things like the bandit's physical stats, and includes custom Item class objects that represent what sort of weapons and armor the bandit is equipped with. Each type of Item can only be equipped once, since each bandit can only wield one weapon, wear one helmet, use one shield, or wear one leather-jerkin of course. So, if I want to equip an Item and an Item of that same type is already equipped, I have to take it off the bandit and put it in storage before I can equip the new Item. This method just handles equipping bandits. I have another that removes equipment. My Class Order: Weapon and Armor are both subclasses of Item. I use the Armor class attribute String armorType to determine what type of armor is being utilized. My Method: /** * Equips a bandit with the given Item parameter * @param item The Item to equip */ public void equipBandit(Item item) { // get the item's simple class name. String equipmentType = item.getTypeName(); switch(equipmentType) { case "Weapon": if(this.weapon == null) { this.weapon = item; } else { // increment the amount owned of the un-equipped weapon Main.organ.addAmount(this.weapon, 1); // decrement the amount owned of the equipped weapon Main.organ.addAmount(item, -1); // equip the weapon this.weapon = item; } break; case "Armor": Armor armor = (Armor) item; String armorType = armor.getArmorType(); switch(armorType) { case "torso": if(this.torsoArmor == null) { this.torsoArmor = item; } else { // Does the same things as the else statement above Main.organ.addAmount(this.torsoArmor, 1); Main.organ.addAmount(item, -1); this.torsoArmor = item; } break; case "head": if(this.headArmor == null) { this.headArmor = item; } else { Main.organ.addAmount(this.headArmor, 1); Main.organ.addAmount(item, -1); this.headArmor = item; } break; case "shield": if(this.shieldArmor == null) { this.shieldArmor = item; } else { Main.organ.addAmount(this.shieldArmor, 1); Main.organ.addAmount(item, -1); this.shieldArmor = item; } break; default: throw new IllegalArgumentException("Armor type not found"); } break; default: throw new IllegalArgumentException("Invalid Item"); } }
  8. RidiculousName

    Global Variables

    Thanks! I think I'll try putting them in a special class. I am not an experienced enough programmer to know what a singleton or a namespace is exactly. Out of curiosity, is all of this possible in Java?
  9. RidiculousName

    Concept Global Variables

    I'm a bit confused by what would be the best way to handle this. I have always been taught that global variables are a big no-no except when absolutely necessary and only as a constant. So, if you have a game with tons of objects that all need to be kept track of, and have to be shared between multiple files, what do you do? Do you just have to make a few data-structures and use them as globals regardless, or is there a better way?
  10. I have a project with a bunch of different .java files. Is there a way for me to organize them in eclipse while still allowing them to access each other? If I split the project in different folders, Eclipse can't find the different files when they're called in a different file.
  11. I want to be able to display an amount of gold at the top of the screen that changes based on how much the player buys. I can just remove and reload the Pane object in my screen controller class, but it seems like there must be a way for me to only update one part of a Pane without needing to reload the entire thing. How can I modify a variable and change it's displayed value in a window, while not reloading the entire Pane object? Main Class package application; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; public class Main extends Application { // Fonts public static final String IMPER_FONT = "./res/fonts/imperator.ttf"; // Global Images // used for screen titles public static final ImageView TITLE_IMG = makeImage("./res/images/title.png"); public static final ImageView HIDEOUT_IMG = makeImage("./res/images/hideout.png"); public static final ImageView TREASURY_IMG = makeImage("./res/images/treasury.png"); // Global Game Stats public static int Gold = 1250; public static LinkList<Object> Equipment = new LinkList<>(); // Panes private static Pane mainMenu = MainMenu.getPane(); private static Pane hideout = Hideout.getPane(); private static Pane treasury = Treasury.getPane(); // Screen Controller private static Scene scene = new Scene(mainMenu, 1600, 900); private static ScreenController control = new ScreenController(scene); /** * Creates an ImageView object * * @param path A String that represents the filepath to the image * @return ImageView An Imageview object with the appropriate image */ private static ImageView makeImage(String path) { FileInputStream input; try { input = new FileInputStream(path); ImageView title = new ImageView(new Image(input)); return title; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; } /** * Creates a Text object with specified font file-path, message, and size. * * @param String path the file path of the font file * @param String message the text of the Text Object * @param double size the size of the font * @return Text The appropriate Text object. */ public static Text makeText(String path, String message, double size) { FileInputStream input; try { input = new FileInputStream(new File(path)); Font font = Font.loadFont(input, size); Text msg = new Text(message); msg.setFont(font); return msg; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; } @Override public void start (Stage stage) { // Add panes to ScreenController object control.addScreen("main menu", mainMenu); control.addScreen("hideout", hideout); control.addScreen("treasury", treasury); // create the scene and display it stage.setScene(scene); stage.show(); } /** * Allows other classes to use the same ScreenController object. * * @return ScreenController The object used to switch screens */ public static ScreenController getControl() { return control; } public static void main(String[] args) { launch(args); } } ScreenController class package application; import java.util.HashMap; import javafx.scene.Scene; import javafx.scene.layout.Pane; public class ScreenController { private HashMap<String, Pane> screenMap = new HashMap<>(); private Scene main; public ScreenController(Scene main) { this.main = main; } protected void addScreen(String name, Pane pane) { screenMap.put(name, pane); } protected void removeScreen(String name) { screenMap.remove(name); } protected void activate(String name) { main.setRoot(screenMap.get(name)); } }
  12. RidiculousName

    Java Accessing Inner Class Attributes

    Well, I was hoping to use other people's opinions to help form my own. I don't think it's a big deal either way, I was just curious. I think I'll go with methods just because it seems somehow more right to me to use methods to access private attributes. Do you say getters/setters for private methods aren't useful because they're unnecessary?
  13. RidiculousName

    Commonly Used Forms of Calculus

    What types of calculus are used most commonly in programming? Is there a need for it unless working with 3D graphics?
  14. RidiculousName

    Java Accessing Inner Class Attributes

    Thanks! So, I guess you prefer using a method?
  15. For my assignment my professor has given me the option of either accessing the private attributes of an inner class directly, or making my own "set" methods for those attributes. I am not sure what is generally considered best in this case. I am not used to accessing private attributes directly, but I'm new to Java, and haven't used inner classes much before either. She's not going to take off points no matter what I do, so I hope this isn't considered, "homework help". Anyway, which do you feel would be best and/or most elegant?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!