Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
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 ... 5
1  Game Development / Game Mechanics / Re: Infinite level generation? on: 2014-02-12 18:41:04
Just to make this clear to anyone, the java.util.Random object has a constructer that accepts a seed and will produce the same values every time when using the same seed. It is exactly what you want and 100% reproduceable when running exactly the same procedure.

In cases where you have for some reason no reproduceable random generator, you might consider to genereate 100 or more random values and store them. Running through the same list of values over and over may be random enough for many cases and all you need to store is 100 or 200 or somewhat integers.

But generally, stick with the Random class and give it a seed.

2  Game Development / Newbie & Debugging Questions / Re: How to build Java program with many images, without java heap error ?? on: 2009-08-26 21:49:18
Well I thought about maybe loading the raw bytes of a jpeg and decode it on the fly and use only the required portion. But the idea of splitting might be even better, splitting the image into several images of a few hundred pixels wide. I'd just need to reencode unused image parts into jpeg or compressed binary data.

But actually, you are right there too, nowadays Gigabytes of Ram are typical. I should just go ahead an do something, and measure and optimize afterwards. One should not try to optimize beforehand, for you never know, if the optimization is needed at all.

3  Game Development / Networking & Multiplayer / Re: Need a way to discover if i'm behind a proxy on: 2009-08-25 23:31:15
Did you google it? Sounds like a typical problem. Maybe a HTTP response contains some info in the header from a proxy, when one is active. I cannot look for more details myself right now, I have no more time. But this is what I would try, to find out if a proxy somehow gives a sign in its HTTP response.

4  Game Development / Networking & Multiplayer / Re: Firefox and applet focus on: 2009-08-25 23:28:55
Usually the applet shoul receive focus when the user clicks on it (again). It should not force focus otherwise, the user might want to have the focus elsewhere, like in the address bar. Dont steal that.

When your applet doesnt get focus when the user clicks on it, its hard to tell with the few information given. I would at first assume, that there is something top level that is not enabled or not focusable or anything that blocks the java focus handling.

5  Games Center / Featured Games / Re: Stickmen Wars on: 2009-08-25 23:21:57
Although simple, it is pretty fun for a while. With some more AI, maybe some Buildings, it can really make it into a nice game.
6  Games Center / Archived Projects / Re: Browser-Game: Helicopter-flying, voxel-based on: 2009-08-25 22:38:46
Really cool. I always wished I would understand Voxel Engines. Well I read them and I never could imagine how to create a decent framerate with tracing every pixel on screen. Its like I basically understand the math and algorithm, but it feels like far too much to be done several times a second. I considered using a Voxel Engine for a RTS. Well,actually it is probably easier to learn real 3D. But somehow 3D is not my thing.

Well steering sucks, but you probably know that. But the rest is really cool.

7  Game Development / Newbie & Debugging Questions / Re: How to build Java program with many images, without java heap error ?? on: 2009-08-25 22:27:28
I'll use this thread because I have a similar question. For example when I think about a game like worms, that allows pixel based manipulation of the level and seems to be based on an image. When creating a BufferedImage big enough to span a few screens, you quickly have a big file. For example 3000 x 2000 pixels, which is about 3 screens wide and 2 screens high, using the default 4 byte per pixel RGBA, takes 22 MB.

I am wondering, if it is possible to store images in a compressed format, like jpeg, and only decode the visible part of it, so that the in memory impact of big images is smaller like a few MB.

8  Game Development / Newbie & Debugging Questions / Re: New to Java game programming. Need help with threads? on: 2009-08-05 23:28:35
I would say you usually have one thread for each independent communication. When you have an established dialog of request and response, you only need one thread wjich will send and receive in turns. If you want to handle each direction of communication on its own, you have two threads.

9  Game Development / Newbie & Debugging Questions / Re: super newbie! on: 2009-08-05 23:24:14
I usually advise the use of books when starting with something completely new. There are enough books on Java, and there are some on Java Game Programming too. That gives you good starting point. After that, you need exercise and you will find advanced articles on the web. The most problems in game programming are not language dependent.

10  Java Game APIs & Engines / Java 2D / Re: Drawing image flipped on: 2009-08-05 23:03:18
Its okay to do so. Drawing an image with negative width or height does a mirror effect, which is not equal to a rotation.

11  Java Game APIs & Engines / Java 2D / Re: Isometric terrain with uneven tiles on: 2009-08-05 23:01:54
Well Ill use this thread anyway, because I had just the same idea, to experiment with different heights for every corner in a tile map, and I have the same problem, applying correct lighting and textures. On one hand, I would appreciate any more ideas considering the problem. On the other hand, I'd like to share my ideas so far:

My first attempt would be using a simple flat texturing, so that the texture is not perspectively morphed but just clipped to the tiles shape. And to create the look of depth just using lighting / shadows on each tile. That could be done by manipulating the image data and lighten or darken pixels row by row, or painting a fading from light white or black to transparent over the tile. Anyway, one really needs to buffer the result and do the texturing only once, everything else would be to slow.

My attempt number two would be writing my own texture routine. I have the book from David Brackeend and he describes 3d software rendering and texturing. Using some rather simple math is already enough to calculate the position of each point of a texture to a destination point on the morphed tile. For each different shape and texture, you'd need to at least one apply the texture to the tile shape by calculation each pixel value using 3d math. You probably want to buffer the resulting images, for you cannot calculate this every frame.

The problem here is not actually texturing but perspective morphing. Isometric graphics use some simple math to produce results that look like having a perspective. When you consider it the way a 3d engine does, each tile is a flat shape with some angle along the 3 axes. There is some math involved in projecting a shape in 3d into a view from a given point of view. The basic calculations for 3d transforming can probably found on the web.

12  Game Development / Networking & Multiplayer / Re: Protect Password in Applet on: 2009-08-05 22:42:36
Well I thought about some SessionID or one use only Action Token to protect against invalid calls to the scripts. This does not protect against a namipulated java program, but illegal actions should be cought when the server validates the input. But it would at least compilcate manual calls to the scripts or "just for fun" calls.

Ill think it through. Maybe ill rather do a normal offline game.

13  Game Development / Networking & Multiplayer / Re: Protect Password in Applet on: 2009-08-04 17:57:14
Thanks so far

What would be the cheapest and easiest solution using the typical webhosting offers?
So far I would try using PHP Scripts on a webhosting with a MySQL database and use
URLConnections from the applet to the server.

Doing so, I would still need some kind of security method, so that no one can
invoke the PHP Scripts with bad data.

14  Game Development / Networking & Multiplayer / Protect Password in Applet on: 2009-07-25 15:53:01

I am considering to develop a java applet browser game, which would require the use of a database. But since the applet runs on the client and needs to make a db connection, it needs the password at this point in clear text. Anyone could decompile the applet and insert a system.out.println to get the db pass and do bad things to my db.

Is there a way to make a java based browser game while protecting the system from manipulation through a hacker attack?

15  Java Game APIs & Engines / Java 2D / Re: Please...need help with 2D game in Java. on: 2008-05-09 16:05:52
- Use an offscreen buffer
- Read java painting tutorials, there are a lot
- Why do you use an BufferedImageOp? You do that on each paint, its expensive. I dont know what it does, but perhaps you only need it done once?
- You can cast Graphics to Graphics2D, which allows using AffineTransform, so you probably dont need the Op.
- Use better variable names than bi, bim, img, and so on. No one can easly read your code with such names. Additionally you seem to use x_speed and y_speed as coordinates for the drawimage, either the name of the var or its use is wrong.

With a little work, there are many examples in the web, you can solve this yourself.

16  Java Game APIs & Engines / Java 2D / Re: Java 2D performacje on fullscreen mode on: 2008-05-09 15:55:14
Its a stupid idea, but maybe getFPS is wrong Cheesy

Actually, drawing some images should defintely be faster.
17  Game Development / Artificial Intelligence / Re: (in)Finite State Machines (or: my first steps in the AI domain) on: 2008-05-09 15:51:05
I think you are on the right path. State Machines are usually programmed as graphs. Each state is a node and each change is a connection.

So you have a reference to a current state, forward all events to it, the state would go through a list of connections, see of any is set for the given event and then change the state. So its very dynamic. You need a state object with some state identification information. You need a state transition object which has a list of events. You set up states and then for each state add transitions to other states. To each transition you add a list of events / condition which will trigger this transition. So you usually dont even need to program individual state objects.

The task of the state machine itself is only to tell you its current state and to handle an event, which might possibly change its state. The real AI would use the state machine, ask for the current state, and perform respective actions.

So your basic simple monster AI has a state machine with 3 states: idle, attack and flee. It has events spot player, lose player and low health. The transitions would be spot player in idle changes state to attack, and lose player in attack changes state to idle. Low health in both states change state to flee. Probably you would want to add some event when fleeing stops and returns to idle.

You dont need individual state objects. Just give the states a name. The real actions are made up by the AI algorithm that uses the state machine, not by the states themselves.

18  Game Development / Artificial Intelligence / Re: Multiple pathfinders and memory usage on: 2008-05-09 15:40:20
There has been said a lot already, I might repeat some but I must admit I didnt read everything:

1) Finding 5 paths the same time would actually not be faster than finding 5 paths sequentially. The CPU has the same amount of work to do, plus thread scheduling. Concurrent threads would give you an advance, when you have one big and one small search, the small one would be done soon and does not have to wait for the big one.

2) Pathfinding information does NOT belong to the node. Either you keep a visited list with nodes, or you use a PathFindingNode object which keeps reference to a node. Both ways, you can use map nodes concurrently.

3) Groups of units can share a pathfinding. Either all use the same path or you move the path of each one by its distance to the starting cell of o the search. But it can happen that a moved path runs into an obstacle, so you must check and correct such paths, but its still cheaper than searching again.

19  Game Development / Artificial Intelligence / Re: RTS AI on: 2008-05-09 15:31:45
I think it is well possible and not the hardest thing to do. Sure its not easy, but its possible. The problem is knowledge. I've read 3 books about game AI and have some ideas how to do it. But you cannot just type it in a few words. So I will rather tell you, there are ways to do this, but you will have to learn a lot about game ai.

The idea is very good alredy. A stimulus, or trigger, or event, influences the soldiers. One important rule is, that the event makes it self known to all objects in the area of effect, and not that all objects query for events in their sourrounding. But I do not see player actions as a stimulus in that way. The player gives rather high level targets, like attack that enemy, move to that position. The AI must break it down into simple actions like fire a shot or move north 1 field.

Dynamic terrain and pathfinding, finding cover, acting as squad, everything is possible and has a lot of solutions.


I read the first three editions of AI Game Programming Wisdom, and they cover a lot of such stuff. But they arent exactly cheap. Quite some of the articles are also available freely in the web, but you have to find them.

If you have more specific problems or questions I can maybe give a better help.

20  Game Development / Artificial Intelligence / Re: NPC Scripting on: 2008-05-09 15:21:36
I never really did it, but I once had the same thoughts about how to control the actions of game objects like npcs or such.

I would basically add all orders into a list, and the object will do the current task until it is finished, then it removes the task and continues with the next one.

Operations on the list would be:
- Add a task to the end
- Add a task to the beginning, so that the object now does the new task first, but then continues where it was before
- Remove tasks (and add new ones)

I was plannig for a RTS and how I could handle a dozen of tanks all do something senseful. Whenever they encounter a problem, there must be a way to add a task at the beginning and resume the remaining tasks after that. I would have atomic tasks (like move north) and semantic tasks like find path to or react on enemy, which involve more AI and produce atomic tasks. React on AI would probably look for cover, which would then add find path to cover position, which would start pathfinding and add simple move orders from tile to tile. Then it would add some kind of "analyse situation", which would either continue to react on the enemy or if it is destroeyed or away would continue the old tasks.

So you dont actually need to freeze the script. You need to set the elements into a list. Each frame the NPC would perform the current task, like turning into a direction or making a move or playing an animation. If the task is done, it is removed and the next one is performed. Something like headTo(treasureChest); would add a task to turn the NPC by some degrees each frame until it has the right direction.

21  Game Development / Performance Tuning / Re: Math.random() on: 2008-05-09 15:00:23
You could look into the source code of the Math or Random class and see, what it actually does. They should be pretty fast at all. You probably have to call random a lot to see an advantage when using a lookup table.

But generally the idea is true. Games only need a really limited amount of randomness, so storing some values and using them would be enough and is really faster. Its enough to store maybe 1000 values and if you used all, begin with the first again. You wont notice it.

22  Game Development / Performance Tuning / Re: 2D Game - Problems with Images (Memory & CPU) on: 2008-05-09 14:48:26
Just something general:
Using compatible BufferedImages often can improve performance. There are createCompatibleXXX methods around somehwere in the GraphicsConfiguration or so. I dont know what type of Image you get from ImageIO.

And second, no transparency is fastest, bitmask transparency is almost as fast, but full alpha is costly. PNG supports full alpha, and maybe even without having transparent areas, they are treatet that way?

I would try to create a compatible bitmask transparency image for your sprites.

23  Game Development / Performance Tuning / Re: ... performance on: 2008-05-09 14:42:41
As far as I know the varargs is internally changed into an Array. When speaking about a perfomance issue, keep 2 things in mind:

- The method has to be called often in order to generate an issue on perfomance just because of the array parameter.
- The method has to be called a lot of times with only one parameter, where the simple version would be better.

Especially the second point brings me to:
If you have a method with varargs, it should usually be called with multiple arguments. If it is called like 90% with one argument and 10% with more than one, it could be strange programming.

Generally I would say this is another case for: Code first, optimize later. You can think a lot about the performance of the varargs method, but probably when you use it you will never measure a performance bottleneck caused by varargs. So I would suggest only to care about it, if you actually have a performance issure with varargs on your hand, otherwise feel free to use it.

24  Game Development / Networking & Multiplayer / Re: RMI, Sockets or ...? on: 2008-05-09 14:35:58
Untrue, read above


1) Where exactly, i cant find it?

2) I think signed applets should allow free connections too, as an alternative?

3) Even if they change it in a current version, I am still developing and targeting Java 1.5. Sadly, many people dont run the newest version. Automatic Updating helps a lot, but there are still plenty of clients which are not up to date.

25  Game Development / Networking & Multiplayer / Re: RMI, Sockets or ...? on: 2008-05-09 12:00:43
The problem on applets is, that they can only connect to their server. This requires a program to run on the server which forwards any messages to other players. A standalone Java application would be able to send messages direct to other players, not requiring a distributor on the server side.

Games usually go with UDP. But depending on the number of players and messages, TCP can be just as fine or even better.

26  Game Development / Networking & Multiplayer / Re: Java's biggest disadvantage (compared to Flash) on: 2008-05-09 11:58:04
Would it be possible to develop some kind of simple ad proxy which can be run on the server where the applet comes from? The server can open connections, for example using php. So your applet would call some PHP scripts from its source which pass on the relevant ad data. You need some java classes along that handle the communication and supply the game with ready to use ads.

What do you need for ads? Cant be that hard. Image, URL, maybe Sound? The applet can get that from its source server, where PHP scripts can do a proxy job and actually get the data from anywhere. And PHP is available almost anywhere.

27  Game Development / Networking & Multiplayer / Re: Problem losing data on: 2008-05-09 11:49:45
At first I would log anything as it gets received. Can you already tell if the data never arrives at the most basic read method? When using TCP, I am very certain, that everythin arrives correctly. So I would be very sure, that it is a programming error somewhere in the data handling of the application.

So I would log what arrives and log what the application gets and try to find the place where its lost.

The problem is, finding such bugs is extremely hard when you cannot reproduce the error systematically. So you really have to log a lot, hope the error happens, and then search the logs.

28  Game Development / Game Play & Game Design / Re: How to improve my Iso Engine? on: 2008-05-09 11:31:14
An Isometrich Engine handles Z Order by the drawing order.

You draw the tiles in lines, beginning with the top row. First draw the ground, then the top wall and the right wall (if any). Then draw objects on the tile like player, monsters, trees and stuff. Then draw left wall and bottom wall, if they exist, and the tile is done. Draw from left to right and top to bottom.

This way the player is always drawn over walls top of him and is overlayed by walls from tiles below him. The layering is not applied to the whole screen, but actually to every tile. Every tile is drawn back to front in means of the viewing perspective. Elements far away from the camera are drawn first, then elements that are nearer. That way, everything closer to the camera will overlay things further away.

29  Game Development / Game Play & Game Design / Re: What do you want in a web game? on: 2007-10-25 15:32:10
Well, speaking of games, I like different kind of games... Speaking of an applet web game, it should usually be a minigame. something you can just play a few minutes. Nothing big. No saving or so required. Like the usual Tetris / Pong stuff. Quick and Fun.

There were ads for a game a few months ago, Loco Roco or so, that looked quite interesting. You could turn the world left and right and your character would roll left or right based on gravity. Or this Paper Mario, where you can switch between two 2D perspectives which reveals secrets or new ways. These ideas are simple but innovative and create an easy and fun gameplay.

Personally, I do not like "unbeatable" games. I hardly like "endless" games either. (There is a difference: in unbeatable you must fail at some point, I dont like that. Endless games you just have no final goal, so you wont win, but there is a difference in not winning and losing). I prefer games that you can master and finish. You can still improve score, time, find more secrets, etc.

30  Game Development / Game Play & Game Design / Re: Interesting theory for game structure on: 2007-10-25 15:23:35
Your block information needs loading as well. And you can use the same method of allocating and freeing on any other geometry structure as well. No need to load lego blocks. Just load an area of geometry data.

Generally, there are already some games that got rid of loading screens and created a seamless world. Chrome did so, it has huge levels and no loading. I wonder, doesn't Halflife 2 have as well no more loading screens?

Pages: [1] 2 3 ... 5

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (28 views)
2014-04-15 18:08:23

BurntPizza (25 views)
2014-04-15 03:46:01

UprightPath (40 views)
2014-04-14 17:39:50

UprightPath (22 views)
2014-04-14 17:35:47

Porlus (38 views)
2014-04-14 15:48:38

tom_mai78101 (62 views)
2014-04-10 04:04:31

BurntPizza (121 views)
2014-04-08 23:06:04

tom_mai78101 (221 views)
2014-04-05 13:34:39

trollwarrior1 (188 views)
2014-04-04 12:06:45

CJLetsGame (195 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30 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!