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 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?

 2 
 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;
            }
           
         }
      }

 3 
 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.

 4 
 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!


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

 6 
 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.

 7 
 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

 8 
 on: 2014-07-28 10:23:08 
Started by theagentd - Last post by SkyAphid
Freezes during loading screen, or kinda slightly after loading but before any game.

Quote
...

No gamepad support. Now come on guys - you really wanna play a game like this with a keyboard ? ^^'

Long time fan of these games: DMC 3, 4, Bayonetta, Prototype, Infamous, MGS Rising.   Actually did some DMC 3 and mostly 4 speedruns back then, so this excites me. Would love a well written story of course... x)

I'm working on the gamepad support. Unfortunately Java has terrible gamepad support due to Input issues, such as the infamous "triggers share the same axis" thing. It's really making this more complicated than I'd like it to be.

But I'll figure it out.

In terms of story, I think I've written a pretty interesting one - it's pretty off the wall. Haha. Most of it will be told through ingame documents though since I'd rather not drag the player through all of the background information. It'll basically be a basic rival-story with underlying themes and messages.

 9 
 on: 2014-07-28 09:37:56 
Started by Rayvolution - Last post by Herjan
Finally actually built a "real" lumber mill graphic, what do you think?



How about an upgradeable lumbermill/buildings, because they both are good Smiley

And about Riven's feedback, that's a great tactic. Exponentially growing wood as loot won't do though..
More like bombs (which can also exponentially get stronger Wink), a strong warrior or a super rare flying warrior called airplane/eagle (depends on your gamestyle) which you can get upward of wave 100. (Just throwing some ideas at you), since I felt really involved after reading the following quote Smiley

As for naming villagers, I was going to eventually allow you to rename them. But currently I was going to make up a pool of names that get randomly assigned to villagers based on people here on JGO, friends, and other people who contribute support to the game one way or another. Cheesy
Oeh, will I become a celebrity? You better call that super rare eagle after me Grin

 10 
 on: 2014-07-28 08:40:00 
Started by Rayvolution - Last post by Riven
Look at the insidious knowledge gained from the Skinnerbox experiments. Introduce random perks (loot) to keep them pressing that 'lever', [with loot that gets exponentially stronger, like the monsters get exponentially stronger], and you'll entertain them for months.

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!