• Advertisement
Sign in to follow this  

my java slick2d based game framework new youtube tutorials

Recommended Posts

Advertisement
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Jamal Williams
      Hello, my name is Jamal and I've been interested in programming video games for a long time. I've attempted to make games in the past however, they never really got far or at least close enough to them being released. This is mainly because I was biting off more than I could chew. I know that before I ask this question, many people are going to discourage me from making an MMO. Please save those comments because I know exactly how hard it is to make an MMO. Which is why I am starting off small and then working towards making my game greater.
       
      Anyhow, I plan on releasing a 2D Java game that is going to be hosted on my websites server. I wanted to make the game multiplayer(obviously) but I also wanted to make a system in which the player would log-in and then be able to access their characters in their account and play the story. I'm recently learning about sockets however, I was wondering if anyone had a method or even the slightest idea of how to save a player's information so that it could be loaded back into the game?
      I already have an idea where whenever the player logs in, you create a new initiate of a Player Object and then pass certain variables through. For example, the player logs in from one GameState and then goes into another GameState in which the Player() is called. When the Player() is called, it passes these values and these values tell the game where the player needs to be, etc.
      public class Player { String name; String race; int attack; int defense; public Player(String name, String race, int attack, int defense) { this.name = name; this.race = race; this.attack = attack; this.defense = defense; //etc } } I could always store these values into a SQL database so that way whenever the player logs in, I can just pull these values from there however, I was wondering if there was a better method for saving the player's data. Any thoughts?
    • By EddieK
      Hi, so I have this game which I'm working on and I have implemented A* pathfinding algorithm, but the problem is that the game framerate drops significantly if there are more than 50-100 enemies which need to find path to player.
      I did some code analyzing and noticed that the part which takes longest to process is part where it searches for node with the lowest F score. Is there anyway I could speed the process up?
      Here's the code I'm using:
      public ArrayList<Node> getPath(Node start, Node end){ closedSet.clear(); openSet.clear(); openSet.add(start); cameFrom.clear(); start.gScore = 0; start.fScore = heuristicCostEstimate(start, end); while(openSet.size() > 0){ Node currentNode = lowestFScoreNode(openSet);//openSet.findLowestFScoreNode(); if(currentNode.equals(end)){ return reconstructPath(cameFrom, currentNode); } openSet.remove(currentNode); closedSet.add(currentNode); Node [] neighbours = getNeighbours(currentNode); for(int i = 0; i < neighboursCount; i++){ if(closedSet.contains(neighbours[i])) continue; openSet.add(neighbours[i]); float tentativeGScore = currentNode.gScore + heuristicCostEstimate(start, neighbours[i]); if(tentativeGScore >= neighbours[i].gScore) continue; cameFrom.put(neighbours[i], currentNode); neighbours[i].gScore = tentativeGScore; neighbours[i].fScore = neighbours[i].gScore + heuristicCostEstimate(neighbours[i], end); } } return null; } The lowestFScore node function just returns result of Collections.min() 
      Thanks in advance.
    • By EddieK
      Hi I am having this problem where I am drawing 4000 squares on screen, using VBO's and IBO's but the framerate on my Huawei P9 is only 24 FPS. Considering it has 8-core CPU and a pretty powerful GPU, I don't think it is not capable of drawing 4000 textured squares at 60FPS.
      I checked the DMMS and found out that most of the time spent was by the put() method of the FloatBuffer, but the strange thing is that if I'm drawing these squares outside of the view frustum, the FPS increases. And I'm not using frustum culling. 
      If you have any ideas what could be causing this, please share them with me. Thank you in advance.
    • By menyo
      I am trying to figure out a good component design for my item classes since otherwise it probably ends up in a hierarchy disaster. I will just be just using this to define my items in a data driven way. My items do not have a position or interact with the map, they are either on a character or on a tile in the map and that is where they are stored. So I created a blank interface and a couple implementations, nothing is set in stone but I think my concept is pretty solid and I'm looking for feedback from people with more experience on the topic since it would not be the first time I burry myself into something I cannot climb out of :).
      public interface ItemComponent { } public class WeaponComponent implements ItemComponent{ int damage; int range; float attackSpeed; String damageType; } public class ArmorComponent implements ItemComponent { int defense; String armorType; String bodyPart; } Easy enough, like most component systems they only add data the system in my case are the characters using the items, I could add functionality but that will probably complicate things once more components are added. When the character uses any item with the corresponding component I have access to the data, and that is all I currently need. A shield that could also be used as a weapon should be easy to model in. To know and find a specific type of item I implemented a Map that maps a String to a ItemComponent.
      public class Item { private String name; private int weight; private Map<String, ItemComponent> itemComponents = new HashMap<>(); public Item() { } public void addComponent(ItemComponent component) { itemComponents.put(component.getClass().toString(), component); } } A basic item that is used for crafting only would not have any components. For easy lookup I added a couple methods.
      public boolean hasComponent(Class c) { return itemComponents.containsKey(c.toString()); } public boolean isWeapon() { return hasComponent(WeaponComponent.class); } public boolean isArmor() { return hasComponent(ArmorComponent.class); } To instantiate items I will import all JSON data in a Factory pattern and clone the items. Since crafting is a thing I will add another Map to this that maps the items name to the recipe.
      public Item clone() { return new Item(name, weight, itemComponents); } public class ItemPrototype { private Item item; private Recipe recipe; public Item cloneItem(){ return item.clone(); } public Item createItem(List<Item> ingredients) { // Todo: Check ingredients. // Todo: Remove ingredients. return cloneItem(); } } public class ItemFactory { private static Map<String, ItemPrototype> itemPrototypes = new HashMap<>(); static { // Todo: Import items from JSON } public static Item createItem(String name, List<Item> ingredients) { // TODO: Error handling return itemPrototypes.get(name).createItem(ingredients); } public static Item createItem(String name) { // TODO: Error handling return itemPrototypes.get(name).cloneItem(); } } Here is how an item would look inside a JSON file. A simple rock would truncate everything except for it's name and weight unless it I decide it can be used as a weapon too.
      "Rifle" : { "item" : { "name" : "Rifle", "weight" : 3500, "itemComponents" : { "WeaponComponent" : { "damage" : 18, "range" : 20, "attackSpeed" : 10.0, "damageType" : "Piercing" } } }, "recipe" : { "ingredients" : { "Wood" : 1, "lense" : 1, "Steel Plate" : 4 } } } I love to hear what more experienced people have to say about this. There are not much examples to look at on internet except for a couple that go all the way down to engine level where basically everything is a entity. If I have success with this structure I definitely write a article about it.
    • By Honneamise
      Hello,
      im looking for some feedback about my latest experiment .
      You can find it here :
      http://www.honny.net/hexnet
      But please before to do that take some minutes to read what follow.
       
      In all my previous projects i have always used C language ( C not C++ ), yes i am a very old person.
      Some time ago I felt the need to “evolve” in some way, I cant say why exactly.
      To be honest in C i have always been able to find a way to solve a problem by myself or a library for a specific task.
      Of consequence all this stuff about OOP and Classes was really new to me.
      To test this experience i have used Processing.
      From what i have understood this was the fastest ( and easiest ) way to setup this kind of project.
      Well, if you are reading this you have already understood that this is not really a "complete game",
      just a minimalist minesweeper-like similar to the "mini hack" sub-games that you can find in major titles.
      Keep in mind that the main goal was to make some experience with basic stuff like :
      setup a project
      learning OOP and Classes
      basic drawing and images loading
      handling user input
      etc...
       
      UPDATE 11/02/2018 : updated new game version and added some screenshots !!!
      UPDATE 03/02/2018 : now it exist AT LEAST a path to complete the game :-)
       
  • Advertisement