Jump to content
  • Advertisement

Draika the Dragon

Member
  • Content Count

    30
  • Joined

  • Last visited

Community Reputation

297 Neutral

About Draika the Dragon

  • Rank
    Member

Personal Information

  • Interests
    Programming

Social

  • Github
    https://github.com/Draika
  • Steam
    draco123456ftw

Recent Profile Visitors

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

  1. Draika the Dragon

    Need some ideas

    Items and lootables? Forked areas in the road, where one leads to treasure but is very risky and other progresses through story? How about a crafting system, where you gain crafting components from beating certain enemies, and the craftables are unique weapons or armour, or a key for the gate? How about an RPG levelling system, where using a certain weapon grants skill with that weapon type, and as you play throughout the game enemies get tougher? I think i'd recommend staying away from the codebase for a while and doing some planning on paper on what exactly you want to do. Try looking into storyboarding.
  2. Draika the Dragon

    Draika's Bakery - Tower Defence

    There's an emergency in Draika's Bakery, Draika's goods are running away! Don't let his baking efforts go to waste, stop them from escaping! Use various kitchen utensils to defeat them and save the day. Features: - Fully randomised spawning sequences - Infinite progressive difficulty system - Infinitely expandable playing field - Unlockable turrets Notes: - Minimum android version 4.4.2 KitKat, tested on Galaxy Note 2 - Contact risole123@hotmail.com for any queries - There is an in game text guide at the top left, which may provide useful information This is my first game release. I hope you all enjoy it as I have just gotten started. I decided to release this because I have gotten my friends to play test and they really enjoy it. This project was a challenge set for me to delve into all aspects of game development. The gameplay is fully self-contained, there are no pay to play options anywhere. If you like it please leave feedback as I value thoughts and criticism.
  3. Draika the Dragon

    Wanting a mere hint on how to Compose music like Toby Fox.

    Isn't it just 8 bit sounds mixed in with random midi instruments? You can find those as soundfonts. Maybe you can use FL studio or something similar with those soundfonts.
  4. As a learning programmer, still in uni, I am also starting to realise how difficult OOP is to deal with. Java was taught to me as a first year coding language and I have been playing around with it a lot. I'm grateful for how readable Java developers make their code, it makes learning other people's code quite digestible. But the way code has to be structured into a deep hierarchy makes it really difficult to use. Last week I stumbled upon an experience where in order to implement a feature I had to use reflection just to expose a variable in an API that was set to private simply because of the whole black box idealogy, along with a hacky subclass to adjust the behaviour of a method that was using that variable. This doesn't feel right at all, but it was the only solution. I submitted as an issue to the API's github and the author went ahead and implemented the feature, as I didn't feel like forking the project just to make one thing public. A lot of Java blogs tell us how you should hide instance variables behind getter and setter methods for encapsulation, but it just feels so cumbersome. Having a lot of getters and setters tends to hint to the fact that the variable should really belong in another class... or not. It really depends on what the variable is for right? If it's basically a database class then it's natural, but if it's an object that does things it tends to feel a bit unnatural in use. Also, don't setters break the concept of immutability and give the class less control of its own behaviour? But without them some things just wouldn't work, like how would you make a clock class without a setTime() somewhere? I know these arguments have been said many times before but there should really be some concrete definition of at what point or what level these features belong. I had a few different classes in my game and tended to get more and more difficult adding in new features when I don't know where the variable should go. I could put it in their proper sensible class, but then I have to telescope it's reference along a chain of other classes and ends up getting very coupled with other classes. This means whenever I wanted to add a feature I had to refractor the whole codebase, which was getting really annoying at one point because for one new feature I kept breaking 20 other features. At some point I ended up mimicking the MVC pattern. It feels more natural and sensible having a class handle data that's serialisable (with basically public fields), and a class monitoring that data and presenting view level representations of that data. For example, if I have a grid of game entities, I can store the entities in an array in one class, make modifications and send events in an update method, and let my view level classes determine what the player sees based on what happened. It just feels so much less messy that way than coupling the behaviour to the visual representation of the events. To be specific, i'm using libGDX as my game development library. libGDX has a library called Scene2D, which is a 2D actor graph library. When poking around forums and discord, I noticed people really disliked it for anything except UI building with it's UI sub-library, despite its vast amount of features ,and usefulness in other areas being a general 2D actor graph library. One of it's biggest disadvantages is that serialisation is not naturally supported, so saving game's state to file becomes really confusing. However, I feel like it's more manageable when I have a backing class that stores all my entities as data structs, and creating actors from the data+handling behaviour dynamically. Please let me know if my thoughts make sense, I am not the most experienced developer in the world for sure as I'm still learning things (I tend to be really ambitious and don't like making clones.. good thing I didn't start off with an mmorpg though 😛).
  5. Draika the Dragon

    Is Kotlin with Libgdx good for new Android Game Dev?

    Up to you, I'd say. I've been meaning to try Kotlin for a while now. For someone who has been studying Java quite a bit, the features that Kotlin provides on top of Java are quite appealing, such as the feature of enforcing non-null references by default (I've just been too lazy to actually try Kotlin, but it looks really awesome). But yeah, maybe learning both LibGDX and Kotlin at the same time could be overwhelming. What you want to do is game development, which Kotlin doesn't help you with explicitly. In my opinion the best approach would be to become accustomed to native Java first working in LibGDX, understand its flow and limitations, then look at what Kotlin can bring to the table. At most I think Kotlin will save you time when you can see where it can improve over Java but it might just be a timesink for starting out. Should look into it sometime though, I reckon.
  6. Draika the Dragon

    How to best do color selection menu ?

    I haven't tried using HTML5 for games myself yet, but it sounds like a 'tint' function is what you need. With that, you just need 1 hairstyle image and then just tint its colour. You could then just tie the tint colour to something like a 'colour wheel' for the user to select the colours they want. Perhaps try googling something like 'how do I tint an image html5', it might bring up something that you want
  7. I'm trying to learn about procedural 2D world generation but I'm a little confused about something. I already have a good algorithm (http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels) that randomly generates the kind of terrain i want, but the problem is I don't know how to scale this effectively for 'infinitely' large worlds.   One of the simple obvious solutions i thought of was to just use a 2D array like so: int[][] field = new int[Short.MAX_VALUE][Short.MAX_VALUE]; Where each int in the array represented information on a tile and it's index values represented the coordinates of each tile. I would then just simply run the algorithm on the field to generate the level's terrain.   Problem is, this line of code doesn't work. I get a java.lang.OutOfMemoryError. Even if it did work i'd imagine it would take forever just to populate the field.     It's obvious i need to split the field so that i can just run the population algorithm onto the local area near the player, and dynamically generate the rest of the terrain as the player walks around.   I'm thinking of splitting the world into chunks. I'm not really sure how to do this though. If all I did was split the field into chunks and populate them individually, then i'd have abrupt terrain changes at the border between each chunk. I need the terrain to be consistent accross chunks. It seems if I went for this approach I would need each chunk to "know about" its neighbouring chunks as its being generated to ensure consistent, seamless terrain between them.   I'd imagine i'd have to do something like check the 8 neighbouring 2D arrays together, patch together the ones that are loaded, running the population algorithm, then splitting the array again to form the target chunk. It seems like a really complicated solution i don't think its a good one. Can anyone give me tips?
  8. Draika the Dragon

    Splitting a grid field into groups of tiles randomly

    I got something similar to what i wanted using a modified cellular automata cave generation algorithm from http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels which is similar to @Alberth 's idea   except i tweaked the settings so that: -chance of spawning a seed is 20% -the minimum requirement for filling a tile is that if only 1 tile around it isn't empy space instead of 4+ in the article -instead of storing the field as booleans, i have them stored as ints, and each distinct int represents a different biome -on 'growth' cycles, my algorithm finds the most common biome int around the target cell, and if it becomes a non empty space it'll become whatever most common biome around it. -rather large iteration count of 25 so that i dont have as many empty spaces   on a small scale this seems to work fine, which is all i need for the game i'm making. I generated an image with random colour values for biomes:     i dont seem to get any empty spaces due to the small size and large iteration count. I guess if i got any i could just flood fill them with some random default biome or surrender to a nearby biome type   I think i might want to have an extra 'polish' iteration to remove single block biomes as i sometimes do in the image but that should be easy.   I can imagine this might not be the best algorithm though for anything much larger cause i guess the iteration count would need to be bigger to fill up more space with biomes, which would be incredibly slow.
  9. I have an 2 dimensional array representing the information about tiles of a tile based game. How would i go about randomly grouping up blocks of tiles in random shapes and sizes in this 2d array? I want to create an effect similar to how biomes are done in Minecraft except on a simpler scale (example: https://media.mojang.com/15e20c7f9936d9ea7d8f4bdee21503fed206cd5e/overviewMap.png where the white areas are snowy places, the yellow areas are desert and the green areas of grassy biomes).   Does anyone know any algorithms out there i could use that would be suitable for this sort of thing?
  10. Thanks, your idea worked. It's working fine now.
  11. I was testing out a cave generation algorithm i made for a 2d orthographic game (like terraria) using the Cellular Automata method. I decided to stress test the algorithm originally to see if there was enough caves being generated so I decided to generate 100 massive levels and save them all a .png file so i could spot any problems.   I'm seeing a pattern across all the images where all the deep caves are sort of "streaking" towards the bottom right direction. I'm not really sure why this is happening. I am not sure how to pinpoint the reason since i only notice the pattern in a large scale. Does anyone have any ideas as to why my caves look like this?   Here's a sample of 3 different levels i generated         i don't know if it's a problem with my code but just in case here is the algorithm public static int groundFloorY = 360; // the layout of the level. true = is a block, false = empty space public boolean[][] groundChart = new boolean[128 * 32][14 * 32]; public List<PositionBlock> getBlocks(String[] args) { return cellularAutomata(6.2f, 4); // the settings i used to generate the images } // generates ground as a list of blocks and their positions public List<PositionBlock> cellularAutomata(float wallTriesModifier,int iterations) { List<PositionBlock> ground = new ArrayList<PositionBlock>(); Random random = new Random(); // randomly fill the map with blocks for (int x = 0; x < 128 * groundFloorY * wallTriesModifier; x++) { int maxX = 128 * 32 - 32; int randomX = random.nextInt(maxX); int randomY = random.nextInt(groundFloorY); groundChart[randomX][randomY] = true; } // "grow" the terrain to generate a complete level for (int automaiterations = 0; automaiterations < iterations-1; automaiterations++) { for (int i = 0; i < groundChart.length; i++) { for (int j = 0; j < groundChart[i].length; j++) { boolean block = groundChart[i][j]; int neighbourBlocks = 0; int neighbourSpaces = 0; // get neighbouring nodes around a node List<Point> neighbours = ExtraUtils.getNeighbours(groundChart.length - 1, groundChart[0].length - 1, i, j, 1, true); // count the neighbours that are blocks for (int k = 0; k < neighbours.size(); k++) { Point neighbourLocation = neighbours.get(k); boolean neighbour = groundChart[neighbourLocation.x][neighbourLocation.y]; if (neighbour) { neighbourBlocks++; } else { neighbourSpaces++; } } if (block) { } else { // Turn a node into a block if there are >= 4 neighbouring nodes, that aren't empty, around it if (neighbourBlocks >= 4) { groundChart[i][j] = true; } } } } } // Final polish iteration for (int i = 0; i < groundChart.length; i++) { for (int j = 0; j < groundChart[i].length; j++) { boolean block = groundChart[i][j]; int neighbourBlocks = 0; int neighbourSpaces = 0; // get neighbouring nodes around a node List<Point> neighbours = ExtraUtils.getNeighbours(groundChart.length - 1, groundChart[0].length - 1, i, j, 1, false); for (int k = 0; k < neighbours.size(); k++) { Point neighbourLocation = neighbours.get(k); boolean neighbour = groundChart[neighbourLocation.x][neighbourLocation.y]; if (neighbour) { neighbourBlocks++; } else { neighbourSpaces++; } } if (block) { // remove random floaty blocks if (neighbourBlocks <= 1) { groundChart[i][j] = false; } } } } // Compile blocks into list for (int i = 0; i < groundChart.length; i++) { for (int j = 0; j < groundChart[i].length; j++) { boolean block = groundChart[i][j]; if (block) { ground.add(new PositionBlock([block instance], new Point(i, j))); } } } return ground; } public class PositionBlock {     public final Point position;     public final Block block; // not really relevant here     public PositionBlock(Block block, Point position) {         this.block = block;         this.position = position;     }     }
  12. Draika the Dragon

    Convert Wma To Wav

    i've been using iWisoft Free Video Converter for media file type conversion. It can convert a wide range of codecs and supports audio conversion too. edit: its free
  13. Draika the Dragon

    [Solved] Rotate towards a target angle

    I would upvote this twice if I could. You should learn them. They will benefit you greatly in game development and aren't that difficult to pick up. http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/complex/transforms/ It make take a bit of effort to learn them, but I will pay off big time.     if they're that useful i'll be sure to do some research on them later. Thanks
  14. Draika the Dragon

    [Solved] Rotate towards a target angle

    i have no idea what complex numbers are, also i had to use negative as that's just naturally what java wants it seems, so I had to come up with another solution which seems to be working   basically i check the surrounding universes of (-pi to pi) to check for equivalent radians to my target radians (like how 0 = 2pi = 4pi). // get surrounding universe equivalents of desiredAngle float desiredAngleM1 = (float) (desiredAngle - 2*Math.PI); float desiredAngleP1 = (float) (desiredAngle + 2*Math.PI); I then compare my current angle to each of those angles and check which one is closest. // find closest universe equivalent of desiredAngle to angle float dADiff = Math.abs(desiredAngle - angle); float dAM1Diff = Math.abs(desiredAngleM1 - angle); float dAP1Diff = Math.abs(desiredAngleP1 - angle); float closestUniverse = desiredAngle; float closestDiffToZero = dADiff; if (dAM1Diff < closestDiffToZero) { closestDiffToZero = dAM1Diff; closestUniverse = desiredAngleM1; } if (dAP1Diff < closestDiffToZero) { closestDiffToZero = dAP1Diff; closestUniverse = dAM1Diff; } Then i simply use the code from before to rotate towards the target: // rotate towards it if (closestUniverse > angle) { angle+=0.1f; } else { angle-=0.1f; } I then tried a angle %= 2*Math.Pi but it wasn't working well. I had some issues where if the desired and current angle were less than 0 and the desired angle was greater than the current angle, then the object would rotate to 0 then back to the proper target. This fixed it for me: // ensure angle stays under PI if (angle > Math.PI) { angle -= 2*Math.PI; } Just to make sure the angle doesn't keep oscillating back and forth when the current angle is around the target angle (for example if the current rotation is .5, target is .6, rotation speed is .2 - can't reach .6 so it keeps going back and forth), i added a lock just to fit everything together nicely. Since this is called when the target angle is "reached" i can call my turret shooting code from here when i get around to it. // Lock rotation to target if looking close enough to it if (Math.abs(angle - closestUniverse) < .2f) { angle = desiredAngle; } Full code: float angle = 0f; float desiredAngle; // = [some value] // find which way to rotate // get surrounding universe equivalents of desiredAngle float desiredAngleM1 = (float) (desiredAngle - 2*Math.PI); float desiredAngleP1 = (float) (desiredAngle + 2*Math.PI); // find closest universe equivalent of desiredAngle float dADiff = Math.abs(desiredAngle - angle); float dAM1Diff = Math.abs(desiredAngleM1 - angle); float dAP1Diff = Math.abs(desiredAngleP1 - angle); float closestUniverse = desiredAngle; float closestDiffToZero = dADiff; if (dAM1Diff < closestDiffToZero) { closestDiffToZero = dAM1Diff; closestUniverse = desiredAngleM1; } if (dAP1Diff < closestDiffToZero) { closestDiffToZero = dAP1Diff; closestUniverse = dAM1Diff; } // rotate towards it if (closestUniverse > angle) { angle+=0.1f; } else { angle-=0.1f; } // ensure angle stays under PI if (angle > Math.PI) { angle -= 2*Math.PI; } // Lock to target if within this if (Math.abs(angle - closestUniverse) < .2f) { angle = desiredAngle; }
  15. I have an angle that i want an object to rotate towards. My current code is as follows: if (desiredAngle > angle) { angle+=0.1f; } else { angle-=0.1f; } However it has a flaw. The range of values for rotation is -3.14 (pi) to 3.14 (see http://www.mediafire.com/view/r7dgb4z8pgb3p6g/angle+analysis.png for a diagram), so if say my object is at 3.13 radians and the target is -3.13 radians, then the object will spin the long way around to reach the target rotation. Can someone help me make it so that it will always take the shortest route? This is for a tower defence game so it is pretty important that the towers rotate sensibly. Thanks for your efforts in advance.
  • 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!