Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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 3 ... 33
1  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-15 01:07:10
Also, if we are using a common tool chain then the only way to enforce this is to have the submissions in source files + resources format. I would suggest that an automated submit, compile, compress, return output script be made available.
2  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-15 01:04:53
I would suggest expanding the byte code compiler rule such that other languages that target the JVM can be used. However that, similarly for Java language, only one defined version can be used.

Note that it is not important to me as I will be using java, only that there has been a couple of entries that used different languages that run on the JVM
3  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-09 05:43:12
Executable JARs do not really provide any more benefit over the Java4kLauncher it terms of accessibility for non-developers.

It would, however be easier to submit entries in the absence of the java4k.com website.
4  Game Development / Newbie & Debugging Questions / Re: Creating shapes n stuff out of the BufferedImage.. on: 2014-12-06 21:58:39
I am not entirely sure what you are asking...

If you are wanting to use standard shapes e.g. circle, rect etc then using the Graphics2D object from the BufferedImage is the easiest approach:
1  
2  
3  
4  
Graphics2D g2 = (Graphics2D) img.getGraphics();
g2.setColor(new Colour(pack(r,g,b)));
g2.fillOval(20,20,20,20);
g2.dispose();


if you are wanting custom shapes and effects then it will be per pixel manipulation:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
      int imgWidth = img.getWidth();
      int imgHeight = img.getHeight();
      for (int y = 0; y < imgHeight; y++)
      {
         for (int x = 0; x < imgWidth; x++)
         {
            int temp = (x + y) % 255;
            pixels[y * imgWidth + x] = pack(255 - temp, temp, temp ^ 255);
         }
      }
      ImageIO.write(img, "png", new File("out.png"));
5  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-06 21:21:17
I am warming to the idea of a "code-golfed" competition where only the java source file is submitted.

my reasons:
1. It is in same spirit of the java4k competition, but different that might give freshness to the competition.
2. Does not require complex compression chains. However, it remains to be seen whether the effort to golf code is more than using the compression chains
3. Easy to store entries for prosperity. Java syntax and idioms are quite unchanging. i.e. future proof
4. If people are concerned about malicious code, they can analyse the submission before running it
6  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-06 02:49:31
Maybe I am not the best person to ask for that as I actually would applaud the use of tricks like that as long as they are made public for others to use.
7  Games Center / Contests / Re: Ludum Dare 31: "Entire Game on One Screen" on: 2014-12-06 02:47:14
be a little bit liberal with the interpretation.

e.g. perhaps a top down vertical shooter that takes place on an asian-style reed screen. So you can still scroll as the game is taking place "on One Screen" Tongue
8  Games Center / Contests / Re: Java4K Competition 2015 on: 2014-12-06 02:41:13
My Thoughts Smiley

1. I am a proponent of the current rules. But I enjoy the compression aspect... hunting for those extra bytes! No matter what is decided, there is a delivery problem: will have to be run outside of a browser... so why don't we leave the rules the same and use the Java4kLauncher ?

1. larger than 4k JARs start to remove the equalizer effect. That is, the difference between a 2 year java programmer and a 10+ year java programmer's entry is smaller when the allowed bytes are smaller. This means that more entries are able to compete effectively. 4096 bytes seems to be the sweet spot.

2. Accessibility. Moving from non-standard java libraries restricts the number of potential entrants as they will be required to learn a new library. see underwhelming response to the LWJGL16k competition.

3. One large source file means that you have to embed graphics into the source file meaning that you cannot lever off of standard and byte-cheap image reading methods. Not a big issue I guess. Out of all the options presented thus far this is one i would most likely support. It does have an added benefit of being somewhat future proof.

9  Games Center / Contests / Re: End of 4K. Thanks all! on: 2014-12-05 07:33:32
Well it could be just an informal one. Just create a thread and see if there is any interest.... I did plan on "finally" finishing my java 4k project of the last couple of years in this years competition... so I may be a competitor for you Tongue
10  Game Development / Game Play & Game Design / Re: Transfer an item from world to inventory on: 2014-12-04 09:29:10
Sounds like a case for a Map collection. i.e.
1  
Map<String,Item> inventory = new HashMap<>();


since a Map is a java.util collection, you can iterate over the inventory:
1  
for (Item item : inventory) { System.out.println(item.getId();}


To add to the inventory:
1  
inventory.put(item.getId(),item);


To remove from the inventory:
1  
inventory.remove(item.getId());


To use the item:
1  
inventory.get(item.getId()).onUse();
11  Games Center / Contests / Re: End of 4K. Thanks all! on: 2014-11-30 05:01:51
All things come to an end  Cry

For me it was the perfect blend intoxicating challenges of producing a fun game and compression Smiley

I have enjoyed every year! Thanks for the great memories.

12  Game Development / Game Mechanics / Re: Packing data on: 2014-11-09 12:00:44
Moogie, if the data is just a couple of numbers and a short string, compressing the data will make it larger.

of course that is true, however the OP has stated large amount of data... so if there is any simple correlation within the data then simple GZip streams would work as a quick and simple starting point Smiley

Elaborating on Cas's idea... if you know the probabilities of the data then huffman encoding... or better yet arithmetic encoding might yield better compression.

How much data are we talking about? What is the context of both the data and the situation that the data is being sent in? compression only really works when you know the data.
13  Game Development / Game Mechanics / Re: Packing data on: 2014-11-08 08:18:06
Not sure how you would even achieve bit packing.... floats are 32 bits and java chars are 16bits.

Depending on the nature of the data and any latency requirements... it might be as simple as just using GZipOutputStream and GZipInputStream.
14  Game Development / Networking & Multiplayer / Re: Java not allowing anything from any website. on: 2014-11-04 08:53:58
Unfortunetly java client side applets have been completely neutered in later versions of Java 7 and Java 8. The short answer is no you cannot Sad
15  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-04 08:00:10
I am not I can help you... it looks like you have changed the algorithm significantly...

However from looking at your code I am not sure how you are correctly rendering your tiles... it looks like you are just rendering tiles in a grid.... there is no concept of alternating rows of tiles that are out of phase such that they completely cover the screen with no gaps.

But ignoring that issue, you need to be scrolling in isometric space not cartesian space.
16  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-03 06:24:17
Here is a standalone version of the program using the code above that was used when making the animated GIF.
17  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-02 12:04:00
I can provide complete source of my implementation if desired. Be warned, however that it is probably only going to confuse you more due to the fact that a) it has not been cleaned up in any form, b) it is not completely finished so has a lot of commented out code and c) it was for a java4k entry... thus it is using hacks, dodgy inefficient code so it is not the best to learn from.
18  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-01 20:37:06
Have you used the debugger at all? i.e. have you determined where the problem is occuring? what values does scrollMapX and scrollMapY produce? is it within the range of your tile map? they both should be 0 if no scrolling has occurred.

How about the isoX and isoY values that are passed into the getTile(x, y).render(isoX, isoY, screen) call... are they within the range of pixels of the screen's width and height?
19  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-01 11:44:32
1  
2  
3  
public void renderTile(int xp, int yp, Tile tile) {
      xp -= _xOffset;
      yp -= _yOffset;


exactly as I had mentioned might be the case... you are doubling applying scrolling... remove this as it is not necessary
20  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-11-01 09:15:51
Quote
I am not sure what effect the call to screen.setOffsets(xScroll, yScroll) has...
xScroll and yScroll is the top-left corner of the cartesian map, with the player centered.

Quote
I am suspicious of what getTile(x, y).render(isoX, isoY, screen)
This method gets the Tile at x,y (cartesian) in the map array, and on that Tile it calls the renderTile method on screen, which draws it to the screen in isometric coordinates.

sure, but how do the two methods interact.... i.e. does calling setOfffsets mean that the later render call has these offsets applied to isoX and isoY? if so then you are doubly taking scrolling into account. The isoX and isoY values already have scrolling taken into account and should be used directly when rendering.
21  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-10-31 22:03:44
Well, it does not scroll due to the fact that scrollYScreenUnit is not being updated. What unit is the yScroll in? if it is in pixels then:
1  
2  
scrollYScreenUnit = ((float) yScroll) / Tile.HEIGHT*2;
scrollXScreenUnit = ((float) xScroll) / Tile.WIDTH;


I am not sure what effect the call to screen.setOffsets(xScroll, yScroll) has...

I am suspicious of what getTile(x, y).render(isoX, isoY, screen); does... it should be simply drawing the tile at the isoX, isoY cooridnates. These are in screen co-ordinate space... meaning that 0,0 will be the top left corner of the screen.
22  Discussions / General Discussions / Re: Worried, Scared. Life wasted? [ANSWERED] on: 2014-10-31 20:19:51
The best advise I can give is to be "true" to yourself. You will know what will make you happy and what will make you feel guilty. The trick is to know what you want to be satisfied. Exceeding this point will usually mean you will feel guilty about one or more aspects. Under achieving this point will mean you will feel less happy.

Remember every decision you have made and will make will be the best decision at the time. There is no room in life for regret. Learn and move on.
23  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-10-31 09:59:57
VIEW_PORT_HEIGHT is the "size" of the screen as a multiples of tile height. Similarly with VIEW_PORT_WIDTH is multiples of tile width. Note that my code assumes that the width and heigh of the tiles are the same, however the actual opaque pixels comprising the tile occur from 0.25 to 0.75 of the height of the tile:


 
MAP_SIZE_MINUS_ONE  is just the size of the map array minus one... i.e. int[][] map = new int[100][100] would mean MAP_SIZE_MINUS_ONE is 99

scrollYScreenUnit - yes i believe it is the top left corner... but that can come later... leave as 0 for now.
24  Game Development / Newbie & Debugging Questions / Re: Isometric game get what tiles to draw to the screen on: 2014-10-29 11:59:52
This is the stripped down version of my isometric rendering code I have used for a java4k entry that is on the back burner:

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  
   private static final int VIEW_PORT_HEIGHT = 20; // in cartesian map scale
   private static final int TILE_SIZE_DIV_2 = 16; // in pixels. half of the tile size
   private static final int MAP_SIZE_MINUS_ONE = 99; // maximum size of the map to be rendered minus one. assuming square map.
   private static final int VIEW_PORT_WIDTH = 30; // in cartesian map scale

   {
      float scrollYScreenUnit=0; // should be updated when scrolling the view port. the unit is in cartesian map scale. i.e. 1 unit = 1 tile  
      float scrollXScreenUnit=0; // should be updated when scrolling the view port. the unit is in cartesian map scale.
     
      int alternateScanline = (int) ((scrollYScreenUnit%1) * 2); // determine whether to start on an "alternative" line. i.e. offset x by half the tile width
      int scrollMapX = (int) ((scrollYScreenUnit+0.5F)+0.5F*(scrollXScreenUnit)); // determine the cartesian co ordinate of the top left corner of the current view.
      int scrollMapY = (int) ((scrollYScreenUnit+0.5F)-0.5F*(scrollXScreenUnit)); // determine the cartesian co ordinate of the top left corner of the current view.

      // iterate over the view port
      for (int vy = -1; vy < VIEW_PORT_HEIGHT*2; vy++)
      {
         alternateScanline=(++alternateScanline)%2;
         int xGame=scrollMapX;  // cartesian co-ordniate of current tile to be rendered
         int yGame=scrollMapY;  // cartesian co-ordniate of current tile to be rendered
         for (int vx = -2; vx < VIEW_PORT_WIDTH ; vx += 2)
         {
            int x = (int) ((xGame-yGame-scrollXScreenUnit-1.0F)*TILE_SIZE_DIV_2); // convert to isometric X
            int y = (int) ((0.5F*(xGame+yGame)-scrollYScreenUnit-0.25F)*TILE_SIZE_DIV_2); // convert to isometric Y
           
            // is the tile visible
            if (xGame > 0 && yGame > 0 && xGame < MAP_SIZE_MINUS_ONE && yGame < MAP_SIZE_MINUS_ONE)
            {
               g.drawImage(images[map[xGame][yGame]], x, y, null); // get the tile from the map at the cartesian co-ordniate and render at isometric coordinates.
            }
   
            xGame++;
            yGame--;
         }
         scrollMapY+=alternateScanline; // update the statring point of the next line of tiles based on whether it is an alternative line
         scrollMapX+=1-alternateScanline; // or not. if it is then the line is shifted out of phase by half.
      }
   }


it may or may not help you as it is not the nicest code around. however it does work (well at least for me Tongue ) as proven by the following screen capture:

25  Discussions / General Discussions / Re: painful maths that will hurt your brain... on: 2014-10-12 07:15:45
well i aint no fancy pants skolar with dem book smarts...

so I turn to wolframalpha for these sorts of problems Smiley

so it has given me:

x = 0.285842 or 5.9836 as possible values for x

source: http://www.wolframalpha.com/input/?i=logx%28274625%29+mod+17%3D7
26  Game Development / Newbie & Debugging Questions / Re: I'm desperate on: 2014-10-09 21:04:18
There is a set of tutorials by a forum member that would seem to perfect for your skill level (i.e. know java but not game concepts)

http://www.cokeandcode.com/main/tutorials/
27  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-08 21:06:10
That's kind of the point  Tongue

Ah, if that is the case then I think I may not have the "correct" competition psyche... I personally like arriving at a solution in a collaborative manner.

If it offends I can remove the solution.
28  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-08 20:57:47
yep Smiley

it frustrated me that I could not look at other submissions to see if there is any other "tricks" I could utilise! I try to share my insights to help others avoid similar frustration.
29  Game Development / Newbie & Debugging Questions / Re: Generate Platforms (Rectangles) Randomly on: 2014-10-08 05:38:56
Clarifying BurntPizza's explanation:



The reachable platforms are those which are to the left of the apogee of the arc or left of the arc past the apogee. i.e. those platforms that are ORANGE. Unreachable plat forms are in PINK.

To illustrate a possible implementation, I have knocked up a simple platformer:

http://pastebin.com/jPqihGKY

Keys:
Left
Right
Up for jump
30  Discussions / Miscellaneous Topics / Re: Name that Poker hand - Tiny Code Challenge on: 2014-10-08 05:37:35
I WILL NOT BE DENIED



Yay i also achived 7.0.

I would be interested in seeing how our implementations differ...

my solution:

1  
class S{public static void main(String[]a){for(int i=0;i<100;)System.out.println((++i%3<1?"Fizz":"")+(i%5>0?i%3>0?i:"":"Buzz"));}}
Pages: [1] 2 3 ... 33
 

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

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (13 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (84 views)
2014-12-05 12:39:02

SHC (94 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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