Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (702)
Games in Android Showcase (203)
games submitted by our members
Games in WIP (775)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 ... 8 9 [10]
 on: 2016-12-04 21:02:24 
Started by mike_bike_kite - Last post by mike_bike_kite
I'm using very basic paint, drawImage type commands in my games and I have some  (probably) simple graphics questions.

Resizing: at the moment my games play at 800x600 resolutions (I like the photo realism!) and I use display mode to alter the users screen to this resolution so they can play full screen. This works OK'ish on most folks screens but on others it doesn't work at all or just shows a black screen. I know images can be resized so is it possible to resize the whole screen to fit the users current resolution? can it be done easily? and is it moderately efficient?

Darken: Is it possible to darken a whole screen and then slowly un-darken it? I tried painting a black rect over the whole image and slowly making the image transparent but this wasn't very pretty or gradual.

Mist: I'm after a similar effect to the above in a different game but this game is set on an ice planet with falling snow and I wanted the "mist" to clear to show the game. Any ideas?

Image: I was quite happy with the look of the game above with the snow but a few people pointed out that the images I'm using are at odds with the game. I have bubbles floating around in the mist and snow above ice caps etc and some bubbles contain bombs that, when you shoot the bubble, the bomb will drop down onto the surface and restrict your movement. These bombs look like the round cartoon bombs with a lit fuse that sparkles away. They said that the old fashioned image of the bomb looked at odds with the space game - I think they're right but I'm at a loss as what to use instead. Any thoughts?

 on: 2016-12-04 19:53:41 
Started by HenBagel - Last post by HenBagel
that's all ive ever wanted thank you :}

 on: 2016-12-04 19:44:28 
Started by ziozio - Last post by ndnwarrior15
I could of course make a very large buffer to begin with but this has issues itself.

Such as?

For drawing my sprites in a 2D game I have a VBO with a max capacity of 1,000 yet usually I'm only drawing ~300 different things each frame. So the buffer almost never get's full but there's adequate space for rendering my game and I can increase the maximum if I need to. I declare the FloatBuffer as final but each frame clear and reset it's position to 0 then start populating it again.

For text I'm not using this ttf --> bitmap approach you're talking about but instead have one .png that has ALL sprites including font. So each character has it's own UV (ST) coordinates within the texture and it get's mapped to a bunch of quads on the screen, which get lumped into the max 1,000 VBO.

 on: 2016-12-04 15:21:44 
Started by Fishbreath - Last post by Fishbreath
AI improvements are in flight: I've tried and undone some interesting ideas for speed reasons, and made some improvements to the evaluation function which make it easier to adjust (albeit a bit slower, since it involves a fair bit of floating-point math).

I have one final structural improvement to make: piece-square tables, a technique borrowed from chess where the evaluation function consults premade tables relating piece type to space on the board, which give a flat score for that kind of piece being on that space. This should help immensely with making the defending taflmen flow outward and the attack taflmen flow inward. It's also relatively simple, and carries effectively no speed penalty. I hope to have that done today.

Also on my to-do list, though this is a little less likely, is tournament support for the OpenTafl server, and UI for same in the client. This is less likely to happen in time, and my expectation is that, for 2016, at least, I'll be running the tournament by hand.

 on: 2016-12-04 12:20:31 
Started by TomCoenen - Last post by TomCoenen
At first I thought it was that bug, but removing the or commenting out the assistive_technologies line did nothing.

I'm thinking I need to upgrade my Ubuntu installation in order to fix this problem.

I used the Redhat OpenJDK for Windows to test the game instead. Everything looks ok, from the font to the graphics and sound. So I'm going to stop trying to get it to work on my current Ubuntu installation.
So I won't be needing assistance for this issue, thanks for the offer.

 on: 2016-12-04 09:52:06 
Started by chinonshou - Last post by Optimo
This is hard to help without seeing what you have, but I think I understand enough to help. What you have here is how my current project was until I moved to OpenGL. For your classwork, awt and this linked code source should have what you need.

I'm not sure how you are trying to structure this. If I were you, I'd make a messageBox object. Create that and then draw it. You don't need an object, but is easier imo.

However you do it, you can use:
int textOffsetX = 5;
int textOffsetY = 7; //example offsets

//draw message box background image at given coordinates
g.drawImage(messageBoxImage, messageBoxImageX, messageBoxImageY, this); //I think you can pass null instead of "this"?

//draw text for message box at given coordinates plus an offset
g.drawString("Contents of message box.", messageBoxImageX + textOffsetX, messageBoxImageY + textOffsetY);

If you want the text to be multiple lines, use a line break character. You can do:
String newline = System.getProperty("line.separator");

And then do:
g.drawString("Contents of message box" + newline + "And another line now too.", 
messageBoxImageX + textOffsetX, messageBoxImageY + textOffsetY);

Oh, also, what I did was make static strings and stored them in a class. You also don't have to do that. But if you want many messages, it may get out of hand. But you can have various string variables that hold all the text, then just say g.drawString(messageString1, x, y) for each. Makes it all cleaner and more manageable.

 on: 2016-12-04 07:47:14 
Started by ziozio - Last post by ziozio

A little bit of background to the question, I have something already which I use to draw text on to the screen. I first generate a bitmap from a ttf font file then I use this bitmap to texture a set of quads to draw strings of text on the screen. This works fine and I have no issues with this, the question is more around how to design things if you want to have something like a text editor where the text changes in length and that length can be unknown to begin with.

The current strategy uses a VBO, but if I have a VBO built for text of size 10 and then I need it to be 11 I have to create a new ByteBuffer of data which can hold 11 bits of data rather than 10. I could of course make a very large buffer to begin with but this has issues itself.

So my question is, what coding strategy could I use to make a text editor, that reduces the need to create new buffers all the time but maximises the easiness of adding new text to an existing string.

 on: 2016-12-04 07:26:33 
Started by chinonshou - Last post by ziozio
I haven't used awt for a long time (very long!), if you want to stick to this then go for it Smiley but you can also use javafx / opengl (there are quite a few engines around to help you out there) if you want to use some more modern api's.

Without going through all that code I would structure things as follows :

- Draw all the game objects first
- Then draw any 2d items on top of this (dialogs / hud type panels / etc)

When you program your game I would try to isolate things in to different units and to keep them separate when drawing to the screen

 on: 2016-12-04 04:11:26 
Started by BurntPizza - Last post by wessles
Christmas came early Smiley.

 on: 2016-12-03 23:14:42 
Started by BurntPizza - Last post by princec
Wrote a long post on the Puppyblog.
Give me your filthy cash!!! If I could blag a buck a month out of everyone on JGO...

Cas Smiley

Pages: 1 ... 8 9 [10]
Lunch (62 views)
2016-12-06 16:01:40

ral0r2 (287 views)
2016-11-23 16:08:26

ClaasJG (420 views)
2016-11-10 17:36:32

CoffeeChemist (512 views)
2016-11-05 00:46:53

jay4842 (560 views)
2016-11-01 19:04:52

theagentd (584 views)
2016-10-24 17:51:53

theagentd (567 views)
2016-10-24 17:50:08

theagentd (515 views)
2016-10-24 17:43:15

CommanderKeith (509 views)
2016-10-22 15:22:05

Roquen (468 views)
2016-10-22 01:57:43
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!