Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3 ... 10
 1 
 on: 2014-07-28 15:38:20 
Started by Orangy Tang - Last post by delt0r
Well i always think these debates are pretty Meh. But i still read them.

I mostly had issues with what problem Entity stuff solved, as in i couldn't see the point all that much. I assumed because i didn't understand them. Turn out i did. Also turns out when the right problem came along then it did become clear what they are good for. I should also note i didn't use it for performance, since i got a few clusters i can use with over 5k cores. But it made the code small and fairly compact.

For smaller indie games however its less clear how it helps. Its up there with writing an engine. Write a game, not an engine. No one else is going to use it anyway.

 2 
 on: 2014-07-28 15:13:35 
Started by tommohawkaction - Last post by LostWarrior
It's a list of all available tiles. In your case, it will only contain grass and sand.

But the thing I don't get, is that you want a whole area covered in the same tile, but you want it random? If you fill a whole chunk with grass only, then there is no random factor involved. So could you please explain a bit more what you are trying to achieve here? And going back to look at some basic Java stuff will help a lot, before you start on some more difficult stuff like this.

 3 
 on: 2014-07-28 15:00:24 
Started by Orangy Tang - Last post by Roquen
I keep forgetting.  The argument "OO isn't good enough so I use component based" is flawed.  Component based is OO.

 4 
 on: 2014-07-28 13:42:26 
Started by tommohawkaction - Last post by tommohawkaction

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Biome {

    private Tile[][] tilemap;
    private static Random random = new Random();

    public Biome(int width, int height, ArrayList<Tile> possible){
        tilemap = new Tile[width][height];
        for(int x = 0; x < width; x++){
           for(int y = 0; y < height; y++){
               tilemap[x][y] = possible.get(random.nextInt(possible.size() - 1);
           }
        }
    }

}


Now if you wanted weighted chances that is much more involved.

CopyableCougar4
[/quote]


What is the possible for?

 5 
 on: 2014-07-28 13:22:16 
Started by tommohawkaction - Last post by tommohawkaction
I learned ArrayLists but never had a use for them. So yes I will need to go back and have a look

but how would I generate a massive area covered in a certain tile? and it is also random

this is what i use for generating random tiles
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
   // Random Generation
     for (int i = 0; i < tileGenAmount; i++) {
         for (int j = 0; j < tileGenAmount; j++) {
            if(j == 0|| j == tileGenAmount -1 || i == 0 && j <= tileGenAmount || i == tileGenAmount -1 && j <= tileGenAmount){
               if(map[j][i] == 0){
                  map[j][i] = 106;
               }
            }
            randomMapNumber = r.nextInt(106);
            if(map[j][i] == 0){
            map[j][i] = randomMapNumber;
            }
           
         }
      }

 6 
 on: 2014-07-28 12:45:07 
Started by BurntPizza - Last post by mag
Made the world more desertly, added a player with collision and figured I still have some shadow problems to fix.

 7 
 on: 2014-07-28 12:19:11 
Started by Rayvolution - Last post by dime26
That smooth shaping looks like the Terraria game, good job! Now I have to look up how to do this...

After making all the drawing all the required terrain transitions tiles, you have to setup a way to check the 8 tiles around the tile you placed when you place it and change that one tile accordingly, I did it by building a small string of numbers like, say this for example:

111111000
..or.. when broken down it looks like this
111
111
000

Basically every "1" is where a tile is the same terrain type as the one you just placed, every "0" is a empty spot, or an unmatching tile. Then, depending on the arrangement of the string of numbers (I used an int btw, not an actual String) you tell the engine what type of transition tile it should put there. Keep in mind the center "1" is your tile being checked. So in this case, it would of be converted to a down facing straight transition tile.

Where as something like this would have become a south west corner transition.:
011
011
000

Eventually after you hammer out every single possible variation that could exist, and code in a very fast way to do the checks, you'll end up with what I have. Cheesy

One critical step is to make a "no valid connection at all" terrain tile (note my little tree "dots" in the gif) because there will be some illegal transitions that are impossible unless you want to make like 30 more texture transition variation possibilities. You'll see when you get there, but there's many very awkward transitions that require very awkward tiles, like this for example:
111
111
010
What do you do with that? Now you need a T-joint thing. In my game, in this situation the center just becomes the same tile as in my first example (Straight down facing transition)

..and the oddball 1 in the bottom row, does it's check and it sees this ..so it becomes an "illegal transition" and becomes a single stand alone texture:
111
010
000

So while I *could* make transitions for these situations as well, you get to a point where it's just overkill.

Here's one of my terrains, if you want to see how many transition tiles each of my terrains have. Only the top row is important, I just added texture variations on top of all this. But it's not required.




EDIT: I think the theory behind this a lot of people may miss is they probably think you need to check the entire terrain/map as a whole, you really don't. You only need to check each tile 1 by 1 and the 8 tiles around it, if it's done correctly all the tiles will end up lining up perfectly.. being completely unaware of the rest of the map, just the 8 tiles around it.

Interesting reading through these posts, the game looks great thus far! I did the exact same thing with a iso tile map generator, created a code that could be used to assign the correct tile type; land surrounded by water:

000
010
000

The codes were in an array as I had a few different checks of surrounding tiles. When I changed by tiles to a MineCraft style I found the number of variations dropped dramatically but I do like the look you have created here and it is worth working out all the combos!


 8 
 on: 2014-07-28 11:15:36 
Started by GNecro1 - Last post by GNecro1
Now animating will be painfull!

 9 
 on: 2014-07-28 10:58:21 
Started by tommohawkaction - Last post by Gibbo3771
I want to make biomes in my game how would i do that?
I want to make 2 biomes at the moment (Grass and sand)
if you would like source code please inform me please thanks

Also the tiles are rendered in a 2d array

Very vague question
Ok, fair enough
That would be a start, you don't go to a car mechanic and don't bring the car

It seems you need to take a step back and learn basic Java before diving any further, or you will drown.

 10 
 on: 2014-07-28 10:34:31 
Started by CopyableCougar4 - Last post by gouessej
Why not just use Unity then?
When you create something yourself, you learn loads more.
That's what several people here expressed, creating something yourself even though there are already some libraries that do the same is interesting mostly for pedagogical purposes, the interest depends on where you are and where you want to go as I explained here.

Edit.: This is a simple example that uses JAXB:
https://jaxb.java.net/tutorial/section_1_3-Hello-World.html#Hello%20World

Pages: [1] 2 3 ... 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (34 views)
2014-07-23 21:16:32

Riven (22 views)
2014-07-23 21:07:15

Riven (25 views)
2014-07-23 20:56:16

ctomni231 (56 views)
2014-07-18 06:55:21

Zero Volt (48 views)
2014-07-17 23:47:54

danieldean (39 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!