Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Asteroids / Space Stations on: 2014-03-20 17:30:09
Asset Manager has been updated - all assets can now be exported as png's or xml

Instructions
Right click > Regenerate (Will randomly create X no of assets based on selected tab - all existing assets on the selected tab will be lost)
Right click on asset > Save as PNG (Will output the selected asset as a PNG (raw un-blurred version and finished version) in the same folder as the jar file)
Right click on asset > Save as XML (Will output the selected asset in XML format)

Double click on an asset to bring up the pixel editor (you can tweak the pixels using left and right clicks)

Asset Manager Jar https://dl.dropboxusercontent.com/u/36532713/Procedural2DPixelAssetsManager/Procedural2DPixelAssetManager.jar


2  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Asteroids / Space Stations on: 2014-03-18 09:17:22
What I originally had in mind was that the different colors represent different resource types - red would be for military purposes, blue for science etc but I am first going in another direction.
3  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Asteroids / Space Stations on: 2014-03-17 17:44:01
If you just want the generated end result (image) then I will soon be producing a tool that will make this easy.

Yessss! Grin

I'm planning on making a first person game using this. Excellent Work!

EDIT: I also agree that the asteroids look like certain Countries/Continents Cheesy

- Jev

See my first post in this topic for the asset manager jar file - bit basic at the moment but I will be working on it. Will let you know when I have updated it.
4  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Asteroids / Space Stations on: 2014-03-17 10:03:55
Awesome stuff! Looks really cool.
Are we allowed to use it in our games? Couldn't find a licence.


Feel free to use - best to fork from git hub as it is being updated quiet frequently at the moment. If you just want the generated end result (image) then I will soon be producing a tool that will make this easy.
5  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 18:17:09
and... space stations - needs some work...

6  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 17:22:56
Different colours...



and asteroids...

7  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 12:09:41
Quote
If I'm understanding correctly then this is possible as the generation and rendering logic are completely separate - check out the source.

No. These look very organic, if they are grown, living ... as mentioned.
If they were out of metal -default-, they would be less frayed.

gotcha - for the idea I have in mind these fit okay but to make them more structural maybe rather than drawing individual pixels it could draw groups of pixels in recognised shapes squares, rectangles etc
8  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 07:59:36
Agree.
You should find a way to smooth them after generation for other kinds...

If I'm understanding correctly then this is possible as the generation and rendering logic are completely separate - check out the source.
9  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 07:57:10
You know, seeing these things makes me want to fly them. Have you given any thought towards deriving flight characteristics from these shapes? E.g. every pixel = a certain amount of mass making the ship more sluggish to move.

That's kind of the plan the mass will be determined on size then you can design the ship by adding shields, armour, engines, modules, cargo bays, fighter bays and weapons etc each will take up a certain amount of mass (think full thrust style).

At the moment though I am just concentrating on getting the asset's to look right - going to move onto generating asteroids, gas clouds and then space stations. Don't get allot of time however so progress is very slow!

Also plan to be able to design / modify the ships on the fly (think simple pixel editor) so that you can remove bits you don't like fill in gaps or completely change it.
10  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2014-03-10 07:37:57
Merged and unlocked.

Thanks Jimmit
11  Games Center / WIP games, tools & toy projects / Procedural 2D Pixel Spaceships on: 2014-03-09 18:58:56
Thought I would post the progress made with my procedurally generated 2d vessels.

Source - https://github.com/andybennett/ajbVesselGeneratorFactory

12  Games Center / WIP games, tools & toy projects / Re: Hexboard generator / factory on: 2013-07-21 07:57:09
You seem to have two hexagons labelled 2,2.

Personally I would pick two of the three natural axes, call one x and the other y, and work out which 2 of the 4 vectors (-1,-1), (-1,1), (1,-1), and (1,1) correspond to the third axis.

Good call - funny, but I never noticed that allot of the identifiers are duplicated. needs some more work!

Fixed the issue with the identifiers and checked it in - have update the image and the code blocks.
13  Games Center / WIP games, tools & toy projects / Re: Hexboard generator / factory on: 2013-07-21 07:32:30
Superb!  Thank you for sharing!  I have been thinking about doing hex for the longest but keep getting distracted from it.   Looks like you are planning a space game!

That's the plan Smiley if I ever find enough time to put into it.
14  Games Center / WIP games, tools & toy projects / Re: Hexboard generator / factory on: 2013-07-20 02:51:25
You seem to have two hexagons labelled 2,2.

Personally I would pick two of the three natural axes, call one x and the other y, and work out which 2 of the 4 vectors (-1,-1), (-1,1), (1,-1), and (1,1) correspond to the third axis.

Good call - funny, but I never noticed that allot of the identifiers are duplicated. needs some more work!
15  Games Center / WIP games, tools & toy projects / Re: Hexboard generator / factory on: 2013-07-19 16:37:50
is it just drawing or even calculating hexagons?

Calculating then drawing to an image (in this example) you can specify how big you want the board based on "rings" around the center hex. You can see it all at the github link I posted.

Here's some code.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
import java.awt.Color;
import java.awt.Polygon;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;

public class Hex {

    private String identifier;
    private int size = 100;
    private Point2D.Double middlePoint;
    private Point2D.Double[] points;
    private Polygon poly;

    private Hex adjacentHexNorth;
    private Hex adjacentHexNorthEast;
    private Hex adjacentHexSouthEast;
    private Hex adjacentHexSouth;
    private Hex adjacentHexSouthWest;
    private Hex adjacentHexNorthWest;

    private Color lineColor = Color.decode("#BED6FF");
    private Color fillColor = Color.decode("#1E1E1E");

    private boolean accessible = true;
    private boolean decorated = false;
    private BufferedImage decoration;

    /**
     * Constructor
     *
     * @param point {@link Point2D.Double}
     * @param identifier {@link String}
     */

    public Hex(Point2D.Double point, String identifier) {

        this.identifier = identifier;
        this.middlePoint = point;

        double h = calculateH(size);
        double r = calculateR(size);

        double x = (point.getX() - (size / 2));
        double y = (point.getY() - r);

        this.points = new Point2D.Double[6];
        this.points[0] = new Point2D.Double(x, y);
        this.points[1] = new Point2D.Double(x + size, y);
        this.points[2] = new Point2D.Double(x + size + h, y + r);
        this.points[3] = new Point2D.Double(x + size, y + r + r);
        this.points[4] = new Point2D.Double(x, y + r + r);
        this.points[5] = new Point2D.Double(x - h, y + r);

        int[] xPoints = new int[6];
        int[] yPoints = new int[6];

        for (int i = 0; i < points.length; i++) {
            xPoints[i] = (int) points[i].getX();
            yPoints[i] = (int) points[i].getY();
        }

        this.poly = new Polygon(xPoints, yPoints, 6);
    }

    /**
     * Returns true if the passed in point is within this hex
     *
     * @param point {@link Point2D.Double}
     * @return {@link boolean}
     */

    public boolean isPointInHex(Point2D.Double point) {

        int j = points.length - 1;
        boolean oddNodes = false;

        for (int i = 0; i < points.length; i++) {
            if (points[i].getY() < point.getY() && points[j].getY() >= point.getY() || points[j].getY() < point.getY() && points[i].getY() >= point.getY()) {
                if (points[i].getX() + (point.getY() - points[i].getY()) / (points[j].getY() - points[i].getY()) * (points[j].getX() - points[i].getX()) < point
                        .getX()) {
                    oddNodes = !oddNodes;
                }
            }
            j = i;
        }

        return oddNodes;
    }

    // Split these 3 functions into separate util class?
   private float calculateH(float side) {
        return (float) (Math.sin(degreesToRadians(30)) * side);
    }

    private float calculateR(float side) {
        return (float) (Math.cos(degreesToRadians(30)) * side);
    }

    private double degreesToRadians(double degrees) {
        return degrees * Math.PI / 180;
    }

    // Getter and Setters
   public float getHeight() {
        float r = calculateR(size);
        return r + r;
    }

    public float getWidth() {
        float h = calculateH(size);
        return size + h;
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public Point2D.Double getMiddlePoint() {
        return middlePoint;
    }

    public void setMiddlePoint(Point2D.Double middlePoint) {
        this.middlePoint = middlePoint;
    }

    public Point2D.Double[] getPoints() {
        return points;
    }

    public void setPoints(Point2D.Double[] points) {
        this.points = points;
    }

    public Polygon getPoly() {
        return poly;
    }

    public void setPoly(Polygon poly) {
        this.poly = poly;
    }

    public Color getLineColor() {
        return lineColor;
    }

    public void setLineColor(Color lineColor) {
        this.lineColor = lineColor;
    }

    public Color getFillColor() {
        return fillColor;
    }

    public void setFillColor(Color fillColor) {
        this.fillColor = fillColor;
    }

    public boolean isAccessible() {
        return accessible;
    }

    public void setAccessible(boolean accessible) {
        this.accessible = accessible;
    }

    public boolean isDecorated() {
        return decorated;
    }

    public void setDecorated(boolean decorated) {
        this.decorated = decorated;
    }

    public BufferedImage getDecoration() {
        return decoration;
    }

    public void setDecoration(BufferedImage decoration) {
        this.decoration = decoration;
    }

    public Hex getAdjacentHexNorth() {
        return adjacentHexNorth;
    }

    public void setAdjacentHexNorth(Hex adjacentHexNorth) {
        this.adjacentHexNorth = adjacentHexNorth;
    }

    public Hex getAdjacentHexNorthEast() {
        return adjacentHexNorthEast;
    }

    public void setAdjacentHexNorthEast(Hex adjacentHexNorthEast) {
        this.adjacentHexNorthEast = adjacentHexNorthEast;
    }

    public Hex getAdjacentHexSouthEast() {
        return adjacentHexSouthEast;
    }

    public void setAdjacentHexSouthEast(Hex adjacentHexSouthEast) {
        this.adjacentHexSouthEast = adjacentHexSouthEast;
    }

    public Hex getAdjacentHexSouth() {
        return adjacentHexSouth;
    }

    public void setAdjacentHexSouth(Hex adjacentHexSouth) {
        this.adjacentHexSouth = adjacentHexSouth;
    }

    public Hex getAdjacentHexSouthWest() {
        return adjacentHexSouthWest;
    }

    public void setAdjacentHexSouthWest(Hex adjacentHexSouthWest) {
        this.adjacentHexSouthWest = adjacentHexSouthWest;
    }

    public Hex getAdjacentHexNorthWest() {
        return adjacentHexNorthWest;
    }

    public void setAdjacentHexNorthWest(Hex adjacentHexNorthWest) {
        this.adjacentHexNorthWest = adjacentHexNorthWest;
    }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import ajb.domain.Hex;
import ajb.domain.HexBoard;

public class HexBoardFactory {

    /**
     * Creates a new {@link HexBoard} with the amount of rings as per the passed in value
     *
     * @param amountOfRings {@link int}
     * @return {@link HexBoard}
     */

    public HexBoard createHexBoard(int amountOfRings) {
        HexBoard hexBoard = createBlankHexBoard(amountOfRings);
        return hexBoard;
    }

    /**
     * Creates a new {@link HexBoard} with the amount of rings as per the passed in value
     *
     * @param amountOfRings {@link int}
     * @return {@link HexBoard}
     */

    private HexBoard createBlankHexBoard(int ringCount) {

        List<Hex> hexList = new ArrayList<Hex>();

        Hex hex00 = new Hex(new Point2D.Double(0, 0), "0,0");
        hexList.add(hex00);

        for (int i = 1; i < ringCount + 1; i++) {
            createHexRing(i, hexList);
        }

        HexBoard hexBoard = new HexBoard(hexList);
        hexBoard.setAmountOfRings(ringCount);
        hexBoard.setHexesByIdentifier(createHexesByIdentifierMap(hexList));
        calculateAdjacentHexes(hexBoard);
        return hexBoard;
    }

    /**
     * Returns a Map of {@link Hex}'s by their identifier
     *
     * @param hexList {@link List} of {@link Hex}
     * @return {@link Map}[Key:{@link String}][Value:{@link Hex}]
     */

    private Map<String, Hex> createHexesByIdentifierMap(List<Hex> hexList) {

        Map<String, Hex> hexesByIdentifierMap = new HashMap<String, Hex>();

        for (Hex hex : hexList) {
            hexesByIdentifierMap.put(hex.getIdentifier(), hex);
        }

        return hexesByIdentifierMap;
    }

    private void createHexRing(int modifier, List<Hex> hexList) {

        Hex sampleHex = new Hex(new Point2D.Double(0, 0), "SampleHex");

        float height = sampleHex.getHeight();
        float width = sampleHex.getWidth();
        float halfHeight = height / 2;

        Integer hexCount = 1;
        // North
       Hex hex = new Hex(new Point2D.Double(0, 0 - (height * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createNorthToNorthEastFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);

        // North East
       hex = new Hex(new Point2D.Double(0 + (width * modifier), 0 - (halfHeight * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createNorthEastToSoutEastFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);

        // South East
       hex = new Hex(new Point2D.Double(0 + (width * modifier), 0 + (halfHeight * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createSouthEastToSouthFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);

        // South
       hex = new Hex(new Point2D.Double(0, 0 + (height * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createSouthToSouthWestFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);

        // South West
       hex = new Hex(new Point2D.Double(0 - (width * modifier), 0 + (halfHeight * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createSouthWestToNorthWestFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);

        // North West
       hex = new Hex(new Point2D.Double(0 - (width * modifier), 0 - (halfHeight * modifier)), modifier + "," + hexCount);
        hexList.add(hex);
        hexCount++;

        hexCount = createNorthWestToNorthFillerHexes(modifier, height, width, halfHeight, hexList, hexCount);
    }

    private int createNorthToNorthEastFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 + width;
        float posY = 0 - (height * modifier) + halfHeight;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posX += width;
            posY += halfHeight;
            hexCount++;
        }
       
        return hexCount;
    }

    private int createNorthEastToSoutEastFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 + (width * modifier);
        float posY = 0 - (halfHeight * modifier) + height;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posY += height;
            hexCount++;
        }
       
        return hexCount;
    }

    private int createSouthEastToSouthFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 + (width * modifier) - width;
        float posY = 0 + (halfHeight * modifier) + halfHeight;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posX -= width;
            posY += halfHeight;
            hexCount++;
        }
       
        return hexCount;
    }

    private int createSouthToSouthWestFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 - width;
        float posY = 0 + (height * modifier) - halfHeight;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posX -= width;
            posY -= halfHeight;
            hexCount++;
        }
       
        return hexCount;
    }

    private int createSouthWestToNorthWestFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 - (width * modifier);
        float posY = 0 + (halfHeight * modifier) - height;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posY -= height;
            hexCount++;
        }
       
        return hexCount;
    }

    private int createNorthWestToNorthFillerHexes(int modifier, float height, float width, float halfHeight, List<Hex> hexList, int hexCount) {
        float posX = 0 - (width * modifier) + width;
        float posY = 0 - (halfHeight * modifier) - halfHeight;

        for (int i = 1; i < modifier; i++) {
            Hex hex = new Hex(new Point2D.Double(posX, posY), modifier + "," + hexCount);
            hexList.add(hex);
            posX += width;
            posY -= halfHeight;
            hexCount++;
        }
       
        return hexCount;
    }

    private void calculateAdjacentHexes(HexBoard hexBoard) {

        for (Hex hex : hexBoard.getHexList()) {

            Point2D.Double currentHexCenter = hex.getMiddlePoint();

            Point2D.Double adjacentNorthHexCenter = new Point2D.Double(currentHexCenter.getX(), currentHexCenter.getY() - hex.getHeight());
            Point2D.Double adjacentNorthEastHexCenter = new Point2D.Double(currentHexCenter.getX() + hex.getWidth(), currentHexCenter.getY()
                    - (hex.getHeight() / 2));
            Point2D.Double adjacentSouthEastHexCenter = new Point2D.Double(currentHexCenter.getX() + hex.getWidth(), currentHexCenter.getY()
                    + (hex.getHeight() / 2));
            Point2D.Double adjacentSouthHexCenter = new Point2D.Double(currentHexCenter.getX(), currentHexCenter.getY() + hex.getHeight());
            Point2D.Double adjacentSouthWestHexCenter = new Point2D.Double(currentHexCenter.getX() - hex.getWidth(), currentHexCenter.getY()
                    + (hex.getHeight() / 2));
            Point2D.Double adjacentNorthWestHexCenter = new Point2D.Double(currentHexCenter.getX() - hex.getWidth(), currentHexCenter.getY()
                    - (hex.getHeight() / 2));

            Hex adjacentNorthHex = null;
            Hex adjacentNorthEastHex = null;
            Hex adjacentSouthEastHex = null;
            Hex adjacentSouthHex = null;
            Hex adjacentSouthWestHex = null;
            Hex adjacentNorthWestHex = null;

            List<Hex> otherHexes = new ArrayList<Hex>();
            otherHexes.addAll(hexBoard.getHexList());
            otherHexes.remove(hex);

            for (Hex otherHex : otherHexes) {
                if (otherHex.isPointInHex(adjacentNorthHexCenter)) {
                    adjacentNorthHex = otherHex;
                }

                if (otherHex.isPointInHex(adjacentNorthEastHexCenter)) {
                    adjacentNorthEastHex = otherHex;
                }

                if (otherHex.isPointInHex(adjacentSouthEastHexCenter)) {
                    adjacentSouthEastHex = otherHex;
                }

                if (otherHex.isPointInHex(adjacentSouthHexCenter)) {
                    adjacentSouthHex = otherHex;
                }

                if (otherHex.isPointInHex(adjacentSouthWestHexCenter)) {
                    adjacentSouthWestHex = otherHex;
                }

                if (otherHex.isPointInHex(adjacentNorthWestHexCenter)) {
                    adjacentNorthWestHex = otherHex;
                }
            }

            hex.setAdjacentHexNorth(adjacentNorthHex);
            hex.setAdjacentHexNorthEast(adjacentNorthEastHex);
            hex.setAdjacentHexSouthEast(adjacentSouthEastHex);
            hex.setAdjacentHexSouth(adjacentSouthHex);
            hex.setAdjacentHexSouthWest(adjacentSouthWestHex);
            hex.setAdjacentHexNorthWest(adjacentNorthWestHex);
        }

    }
}
16  Games Center / WIP games, tools & toy projects / Hexboard generator / factory on: 2013-07-19 06:52:12
Hey all,

Needed a hex board factory / generator for when I hopefully have time to put a game together and have come up with the following...

https://github.com/andybennett/ajbHexBoardFactory

17  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-18 19:58:58
Some red tinted ones

18  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-18 17:11:07
Bit more work done on this - kind of happy where I'm at. Going to start seeing about using this in a hex based game similar to full thrust etc...





and some big ones...


19  Game Development / Newbie & Debugging Questions / Re: Drawing images in Jpanel, JFrame and game loop on: 2013-07-18 07:59:21
Took your code and tweaked it so that a frame displays with a rectangle displayed in the top left.

If your JFrame is not even appearing make sure you call setVisible(true);

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
public class Example extends JFrame implements Runnable {

    // FIELDS
   public static int WIDTH = 800;
    public static int HEIGHT = 600;

    private boolean running;
    private Thread t1;

    // METHODS
   public synchronized void start() {
        running = true;
        t1 = new Thread(this);
        t1.start();
    }

    public synchronized void stop() {
        running = false;
        try {
            t1.join();
            System.out.println("The game stopped");
        }
        catch (InterruptedException e) {
            // TODO Auto-generated catch block
           e.printStackTrace();
        }
    }

    // INIT
   public Example() {
        setSize(new Dimension(WIDTH, HEIGHT));
        setFocusable(true);
        requestFocus();
       
        setVisible(true);
    }

    // MAIN RUN METHOD

    public void run() {
        while (running) {
            //load();
           System.out.println("The game runs");
            repaint();
        }
    }

    // PAINT WITH GRAPHICS METHOD
   public void paint(Graphics g) {
        super.paint(g);
        g.setColor(Color.BLACK);
        g.drawRect(0, 0, 100, 100);

    }

    // LOAD IMAGES IN MEMORY
//    public void load() {
//        try {
//            String path1 = "res/bg.png";
//            bg = ImageIO.read(new File(path1));
//            String path2 = "res/charac.png";
//            charac = ImageIO.read(new File(path2));
//        }
//        catch (IOException e) {
//
//            e.printStackTrace();
//        }
//
//    }
   
    @SuppressWarnings("unused")
    public static void main(String[] args) {
        Example example = new Example();
    }    
}
20  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-18 05:18:44
Working on filling in some of the flat areas... first attempt, what do you think?

21  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-17 06:58:39
Very impressive. I might take a look at your code to give me an idea of procedural terrain generation possibly. Or anything else I could maybe think of.

The generation process is very simple its manipulating the shape you have generated which takes time. Experiment with the code and see what you can come up with. I have done a few experiments and creating random caverns, land masses etc have been possible with some code tweaks.
22  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-17 06:36:07
Small ships are looking really good, almost like "hand-drawn" ships.

There is still something to do with bigger ships - many of them don't look too natural.

What about asymmetrical and wide ships?

First thing to sort out is the flat areas on the larger ships need to get some noise in there which should make them look a lot better - so far only been concentrating on symmetrical ships but the code that generates the basic shape is very adaptable so asymmetrical and wide ships should be possible.
23  Games Center / WIP games, tools & toy projects / Re: Procedural 2d Pixel Vessels / Space Ships on: 2013-07-17 06:31:48
Wow!  Grin Looks really cool. I will definitely use those of these in my game. If it's okay of course.  Wink

go for it  Smiley will likely be making some improvements soon so keep an eye on the repo
24  Games Center / WIP games, tools & toy projects / Procedural 2d Pixel Vessels / Asteroids / Space Stations on: 2013-07-16 22:02:40
Thought I would update the main page, have done allot of refinement on the generated assets so that I can finally move onto using this in a game - see below...







Source Code - https://github.com/andybennett/Procedural2DPixelAssetsFactory

Asset Manager
Right click > Regenerate (Will randomly create X no of assets based on selected tab - all existing assets on the selected tab will be lost)
Right click on asset > Save as PNG (Will output the selected asset as a PNG (raw un-blurred version and finished version) in the same folder as the jar file)
Right click on asset > Save as XML (Will output the selected asset in XML format)

Double click on an asset to bring up the pixel editor (you can tweak the pixels using left and right clicks)

Asset Manager Jar https://dl.dropboxusercontent.com/u/36532713/Procedural2DPixelAssetsManager/Procedural2DPixelAssetManager.jar
25  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-02 20:58:55
Full screenshot showing all windows open.

26  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-02 20:17:24
We can play a game of 'name that space ship silhouette' later  Grin

Heh - I do get a bit excited when one of the generated designs reminds me of a vessel in a sci-fi program.

Very difficult to get Federation Star Trek shapes though as the algorithm is not really suited to having isolated sections like the nacelles. Might have to work on that.
27  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-02 20:14:23
Try these settings for more angular - straight looking ships

http://dl.dropbox.com/u/36532713/Update1/StraightAngluar.properties

Open the Drawing Configuration screen and Settings > Load

28  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-02 19:50:45
I have a new update ready to try! - see the first post in this thread.

This update allows you to select a fleet of ships - Frigate, Destroyer, Cruiser, Battleship and Carrier.

On the Fleet Factory screen use the right click mouse button to access the menu.

Next - Will generate a new fleet if you are at the end of the list otherwise will move you one forwards.
Previous - Will take you back one step to a previously generated fleet.

Change X - This will take you to a separate ship factory for the selected ship type. From this screen you can generate new ships by right click menu or by using the mouse wheel. Find a ship you like then click Add To Fleet - this will replace the current ship type with one you have selected.

Edit Pixel Drawing Settings - Allows you to modify some of the settings that are used to generate the ships. Very much work in progress - if you try it I recommend you do small changes then generate a few ships then some more changes and so on. If you really mess up the settings just restart. Any changes you make to the settings on this screen will be in effect instantly.

Change Fleet Colour - Changes the colour of all ships to your choice.

On all screens you can save the window size and position via the Window menu - got fed up re-sizing and re-positioning the darn things every time I restarted. The application will store properties files in the same directory as the jar file.

I only have 4 stencils at the moment but I am going to add more when I get a chance. A mix of these, the length of the drawn pixels and the frequency should produce even more interesting designs.

Let me know how you get on!













29  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-02 08:03:21
Nice work!
30  Games Center / Archived Projects / Re: Procedural 2d Space Ships on: 2011-08-01 19:53:56
Getting better I think...





More fill example



lol Whale ship!



and spiky ships

Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

atombrot (20 views)
2014-08-19 09:29:53

Tekkerue (21 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (55 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (27 views)
2014-08-08 02:01:56

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!