• Advertisement


  • Content count

  • Joined

  • Last visited

  1. clickteam fusion 2.5 asking

    I have no experience with this engine but it looks to me you need a score object, just like you have a collision and asteroid object in there. Then when asteroid hp <= 0 you can add score += 10.
  2. The client is the end user and the code I wrote is for client/server communication. The server receives a packet and can handle the request. What I meant with the line I wrote is that the client does need to ask for data in the database but trough a client/server connection. The classes I wrote will be registered on both client and server so it can be serialized/deserialized by Kryo and send over. On both the client and server I would setup a listener for this packets. Whenever something arrives I check what kind of packet it is and then check the packet ID to know the exact request or response and handle that. The following will happen: Client logs in and needs his fighters to be displayed. He sends a FighterRequest packet to the server. Server listens for these packets, receives the packet and will query the database for all clients fighters by looking up the playerId. For each fighter the server sends back a FighterResponse packet. The client listens for this packets, receives the packets and handles it so the user can see his fighters. Now if I want my client to receive a dialog when he buys or wins a new fighter I need another such packet class so the client can handle it correctly. And thus for every instance I need slightly different functionality I need such a packet class. They all feel rather similar though, I guess whenever the player requests data the type of data to request can be represented by a simple int or enum. Fighter, item, login details, etc does not matter. They are just data bags and atm I am just fetching them for the client to display them, later they can fight in a turn based fashion but that would still be the same data bag.
  3. I could see this happening for a window based game where not much is happening and just sending an image when something changed. But to send quality full HD on 30 FPS you need to send at least half an MB per second. This means after a couple of hours you already streamed 10GB. Now imagine 120FPS 4K, that is probably a couple dozen MB each second. Apart from that, the server bandwidth needs to be huge and the server needs to calculate and render everything for each client so you better have a insane battery of CPU and GPU ready. It is just not scalable and a waste of the clients hardware. For 99.9% of the games a server should just handle the bare minimum and let the clients do the dirty work. I understand that some games can eat your data bundle, just update when you are on wifi I suppose, plenty of public wifi available nowadays if you don't live in the middle of absolute nowhere.
  4. Should I use an engine or learn a programming language?

    If you want to make a proper game you at least need to learn some coding. Even Gamemaker has it's own scripting language and could be a good start. There is also Unreal Engine, which allows you to code with blueprints in a visual manner, but for a bit more complicated systems you have to code in C++ which is a lot harder to pickup. This is how I would progress: Start with some basic programming tutorials. Teamtreehouse has a week long free trial, try to get in a lot of hours and it will be a nice jump start all for free. Create a command line game like hangman in the language you chosen. Keep things very simple, it is very easy to grow the scope of a game and then fail to complete it. Pick and learn a framework like Libgdx or Monogame. Code simpel games from start to finish worthy of releasing. They do not need to be great or extremely polished but they "just" need to work. You will get a tremendous boost from releasing a finished project on your own but don't expect any sales or income from them. Repeat making simple games, look for making clones that teach you something new and perhaps something you could use in your turn based game. Depending on your time it might take a view years until you are able to make something you want. Games are very complex and you need to know a lot about programming to finish a slightly complex game on your own. Don't let this put you off, if you like to code and solve problems the road to your goal will often be fun and satisfying.
  5. I have a MongoDB db on a server operated by Kryonet. Obviously I need to be able to query the database from the client for adding, removing, requesting all kind of assets. Now I have written the code to request, add and remove fighters on the Kryonet network I am wondering if there is a better way to do this. I feel it's a bit repetitive, especially when I need to implement this for all other assets the player can own and other players assets when needed. The way I am currently approaching this is the same as my chat/lobby system which works great but I was wondering if anyone could see improvement on my code or a complete different way that is much more scalable perhaps. public class ClientAssets { public static final int FIGHTER_REQUEST = 1; public static final int FIGHTER_RESPONSE = 2; public static final int FIGHTER_ADD = 3; public static final int FIGHTER_REMOVE = 4; public static void Register(EndPoint endPoint) { Kryo kryo = endPoint.getKryo(); kryo.register(FighterRequest.class); kryo.register(FighterResponse.class); kryo.register(FighterAdd.class); kryo.register(FighterRemove.class); } static public abstract class AssetPacket { public int packetId; public AssetPacket() { } } /** * Packet to request all owned fighters */ public static class FighterRequest extends AssetPacket { public ObjectId playerId; public FighterRequest(ObjectId playerId) { packetId = FIGHTER_REQUEST; this.playerId = playerId; } public FighterRequest() { } } /** * Receiving fighter data from server */ public static class FighterResponse extends AssetPacket { public Fighter fighter; public boolean add; // Add or remove public FighterResponse(Fighter fighter, boolean add) { packetId = FIGHTER_RESPONSE; this.fighter = fighter; this.add = add; } public FighterResponse() { } } /** * Adds a fighter to player assets */ public static class FighterAdd extends AssetPacket { public ObjectId fighterTemplateID; public FighterAdd(ObjectId fighterTemplateID) { packetId = FIGHTER_ADD; this.fighterTemplateID = fighterTemplateID; } public FighterAdd() { } } /** * Removes fighter from assets. */ public static class FighterRemove extends AssetPacket { public ObjectId fighterId; public FighterRemove(ObjectId fighterId) { packetId = FIGHTER_REMOVE; this.fighterId = fighterId; } public FighterRemove() { } } } To elaborate a bit more, this code will communicate between client and server. When receiving a request on the server it will lookup the request in the database. The client will store it for displaying the assets. A specific thing I am unsure about is the FighterResponse.add boolean. I need to be able to remove and add fighters, I guess I am better off with a FighterAddResponse and a FighterRemove response so I will send one boolean less each time this packet is send. But this will create even more repetitive code.
  6. Sorry for not being clear. My item class at the moment is very simple. Just a data class with a string for the item type. I have a item stack derived from that that has an extra int for the amount. The value of the item depends on the supply/demand. So since its just a trading/crafting system items don't need functionality. Later perhaps a category for better sorting. I have a template class with that holds the crafting data so that a factory pattern can use it to craft items. This way I can create items with json. So except for energy all my current items are tradable. A battery for example can be crafted with energy and iron. The battery and the iron can be traded like any other item. I'm using Java but basic programming principles apply.
  7. All my items are the same except for 1 at the moment. Energy cannot be traded, it needs to be put in a battery first. Crafting is done with items and buildings/factories produce items. If I abstract energy out of the item class I need to abstract the power plant as well since factories produces an "Item". Also, if an item needs energy to be produced I need to account for this change since currently I just iterate over the available "Items", subtract and produce. Although this feels like an elegant way to deal with the problem, due I'd really like to keep the energy as a Item. I could add a boolean to the item which tells me if it. All items get this extra boolean now just because energy is a mutant. I could add a extra item class that inherits the regular Item class. This feels like overkill for just one item. Any other ways to handle this in a elegant way?
  8. Advice Beginner? Sure

    The thing about being indie is having to do everything on your own. Also marketing and the average game company spends a huge chunck of the total budget on marketing so this is as important as any aspect of your game. Usually the look of the game is a big part of the marketing as well. Having seen your screenshots, and it does not look bad at all but it is hard to read and hurts my eyes, both are caused by super high saturation. Perhaps toning down saturation for all non important. You also need a video, at least some gameplay footage but a bit a basic trailer is best. The thing is, and you have to be honest about it yourself, does the game has a great potential? Is it worth to invest a lot of time and perhaps money into marketing this game? Factoring in the amount and quality of other games of the same kind and how does your game stand out. Honestly, I think you should be very proud of completed a game from start to finish I have been doing game development for more then 6 years and only have completed 3 fairly simple games the rest are the usual way to ambitious projects and prototypes. Anyway, you can find a lot of information on how to market your game on internet but in the end your game has to be good (or some sort of gimmick that goes viral). To sum up a couple: Home page Social media, Google+ page, Facebook page, Twitter, Tumblr, youtube, reddit, etc) Youtubes reviewers and let's players. (There are plenty of small guys that would love to play and promote a little for you for free) Giveaways (buy a bunch of cheap games and tell people to like and share your social media in order to win) Press releases, indiedb Release on multiple platforms (Amazon, Ios, perhaps even port it to desktop and release on steam) Devlogs and be active in the community. (Gamedev.net, Tigsource, gamasutra). As you see marketing is a huge timesink and unfortunately it is mandatory for a good game to succeed on the market. It can even let a bad game succeed if done properly but this gets harder and harder since the market is very saturated. Try to get followers, be personal as a indie developer and make them feel important. If your game is good enough your followers will do a fair bit of the marketing for you, it's a snowball effect, the more followers you have the more followers and marketing you get.
  9. 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.
  10. List with nouns, adjective and verbs?

    It does not need to get too complicated. I won't be writing complete sentences but I am bothered by showing "Wood Table" instead of "Wooden Table". I would like to hear more opinions on this being "unnecessary and pedantic". If there is no easy solution I might just show it as a "Table" and have the option to further inspect it which will show "Material: Wood".
  11. I want to abstract material from the type of item to give the player a lot of options in crafting. Now I'm running into a language problem, take iron and wood iron is written the same as an adjective and wood transforms to wooden. So when the player creates a table from wood material it says "Wood Table" instead of "Wooden Table". Now I am not a native English speaker so I don't really know the exact rules create word combinations like these but I guess I just need to have a noun, adjective and verb for each word. Then just build a String like "Player created a " + wood.getAdjective + " " + item.getType + " in the workplace.". So my first question is would this work for each possible combination? This wheel has probably been invented already, so where do I look? At the moment I just need a couple dozen of materials so I probably just write a JSON file with each one. But I like to keep it scalable and perhaps there are ready to use lists or JSON files already available?
  12. Server battle predictions?

    Thanks, your first solution made me think about game replay's so I googled that. I think this is the best way to go, I guess all I need my game to be deterministic and start on all clients in the exact same state. If I ever want user interaction I could send input with it. Edit: I found another great article to have fixed time steps for a deterministic outcome. Unity has the method 'FixedUpdate()' for this but some engines might not or even combine the draw and logic loop.
  13. Does a server need a gui?

    Thank you, could you list the pro's and cons of the different methods? My guess is a specialized client suits my needs, A web interface maybe just for the database if I ever want to create an api for it.
  14. I have a bit of experience with client/server architecture and up till now all my server did was relay and occasionally verify data to it's connected clients. I have even less experience with deploying a server, I did that once on a free amazon AWS tier. Anyway, I am planning on making a larger networked game and I am wondering if such a server needs GUI, or at least a command line console and if that is even possible to run from a vpn. Another way to check and correct/alter server data is to make a separate client that logs in on the server that has all kind of other privileges and a gui of itself. I know this is a broad question but I like to know what is common so I can anticipate on this while writing my server.
  15. I got a little client side auto battle game going, you pick some units and the battle progresses visually but automatically with a lot of random elements. However, I want need to verify the outcome by the server. I also want to be able to let clients duel other clients. So what is the best take on this problem? Instead of heaving the complete battle play out on the server or check/compare every action from the client that is being played out randomly I figured it must be possible to just calculate the outcome quickly and once the client has finished the battle just verify that result with the server. I would just generate a seed on the server, pass that to the clients so the battle can be generated and played for them. In the meantime the server quickly calculates the outcome and checks that result with the client. Is this possible at all? Would a seed generate the same random numbers on each and every machine when using the same Random() implementation? Should I just loop trough the whole battle on the server side? Like moving each unit, detect hit, fight, damage, etc but instead of doing that each frame just in a single loop? Can I perhaps skip trough and interpolate these steps? Just let the game play on the client and check each action with the server. Both clients would still need to get the same seed and the server needs the match the action with it's own "battle". I expect the outcome of both clients to defer from the server outcome. Same as above. Have the server run and dictate the battle and the client just displays what is happening. Since the battle has random elements the client needs to ask the server each frame what to do which is a problem. I really cannot set the random aspect aside, units have to be able to "dodge" or "critical" every now and then. But perhaps this can be implemented in a different way since the battle outcome should be fixed. As you see I'm having trouble wrapping my head around the whole concept. I have a fairly good understanding of network gaming. when the player controls a character you could let the client just do it's thing and occasionally checking variables and correcting the client based on server state. With my automatic battle the outcome of the game should be fixed and predetermined, especially when having clients PvP.
  • Advertisement