Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
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  Game Development / Shared Code / Re: Simple "console like" chat on: 2011-03-01 00:28:05
You could post some code of you chat, so every could have benefit from using it.
2  Game Development / Shared Code / Re: Simple "console like" chat on: 2011-02-28 10:04:15
I have tried to work with StyledDocument.. I could get it showing correctly different colour line(different colors in the same line). That was the main reason why I started to work with HTML. Another thing, does Styled document will allow to be extended to show emotes and for example links to items?
3  Game Development / Networking & Multiplayer / Re: broadcast on lan? on: 2011-02-27 23:59:19
There are specific mechanisms for broadcasting Wink

Check this article:
4  Game Development / Shared Code / Simple "console like" chat on: 2011-02-27 23:49:05

I want to share with you some code which I have recently finished, which gives respect to the game chat GUI. For the game I'm making, I needed some component, which would allow coloured text, content appending and removing when some limit of lines is reached and some scroll behaviour, which I'll post after I will implement it Wink.

The chat has following aspect

So, as main container of the content I have chosen JTextPane, since it allows HTML(which make possible full personalization of the text, including colour, text styles and much more). But there were several problems and challenges to solve, like appending and removing the text because JTextPane doesn't have such options.

I'm using the following code for creation of the JTextPane, note that there should be set HTMLEditorKit and HTMLDocument to the JTextPane, else HTML will not be rendered(thanks for people from StackOverflow helping me solve this issue)
this.text_panel = new JTextPane();
this.text_panel_html_kit = new HTMLEditorKit();this.text_panel.setEditorKit(text_panel_html_kit);
this.text_panel.setDocument(new HTMLDocument());

scroll_pane = new JScrollPane(this.text_panel);

The next step was creating the append function. You will need to work directly with the HTMLDocument set to the JTextPane in previous step. My append function looks like:
public void append(String line){
   SimpleDateFormat date_format = new SimpleDateFormat("HH:mm:ss");
   Date date = new Date();
   line = "<div><font size=3 color=GRAY>[" + date_format.format(date) + "]</font><font size=3 color=BLACK>"+ line + "</font></div>";
   try {
      this.text_panel_html_kit.insertHTML((HTMLDocument) this.text_panel.getDocument(), this.text_panel.getDocument().getLength(), line, 0, 0, null);
   } catch (Exception e) {

The next step is creating line limit and remove the lines from the start which pass the limit. For this step I have used LimitLinesDocumentListener taken from (read on the blog about how it's being used). Though I needed to do some changes in the removeLines function(which in my case will not use functions removeFromStart and removeFromEnd. And now it's looks like:

private void removeLines(DocumentEvent e)
   Document document = e.getDocument();

   try {
      while (((HTMLDocument) document).getText(0, document.getLength()).split("\\n").length > maximumLines)
         int end = document.getText(0, document.getLength()).split("\\n")[0].length();
         document.remove(0, end+1);
   } catch (BadLocationException e1) {

The last step is adding the listener to the text_panel, this is done with following code:

LimitLinesDocumentListener limitLinesListener = new LimitLinesDocumentListener(Configuration.getInstance().CHAT_VISIBLE_LINES);

And before finishing note, there was also added some scroll behaviour, which makes the scroll jump to the last inserted item, achieved with following code:

DefaultCaret caret = (DefaultCaret)text_panel.getCaret();

I hope this will help some1 and save some time implementing nice chat(console) with colours and appending/removing. If you will find some optimization issues in my code or some things which can be simplified I will be very thankful if you report them in this topic or via pm.

Thanks for attention Wink
5  Game Development / Game Mechanics / Re: Enhancing game engine with scripting capabilities on: 2011-02-24 19:37:42

I'm not too familiar with Groovy, but I am familiar with Jython.  May I ask why do you think Groovy is more attractive that Jython?  One advantage of Jython that I can think of is that Python is very popular among the developer community and if you use Jython, you can leverage a lot of existing developer resources that may or may not exist with Groovy.

One the first things that come in favour of Groovy is it's "proximity" to Java(including syntax), integration seems to be much easier then with Jython, at least this is what I read in some forum posts. I'm aware that Python is more stable and balanced. I have some experience with Python(I have already made Tetris game), but I really prefer Java, just a question of personal preference.

Regarding the actual mechanism in embedding a interpreter into your engine, what I found is that once you have a scripting engine, the possibilities are limitless in terms of what you can do with external scripts vs. what you can do in your codebase.   As long as you pass the relevant objects to your scripts, the scripts can take over the entire execution of your game if you like. 

I already have imagined that potential of scripts is very high, but in large games it's probably very hard to keep the codebase at the minimum, architecture must be planned very carefully and with several "heads"(people) (though this applies almost to all projects)

Thanks for you help and very demonstrative example. Bookmarked for future study Tongue
6  Game Development / Game Mechanics / Enhancing game engine with scripting capabilities on: 2011-02-24 14:24:18
Hello experts Smiley

Maybe few of you remember me with my half-fail(or probably full-fail) game which I released like half year ago(or more). I have learned a lot from making it and was regaining forces during half year to start everything from scratch. Sorry for off top, going now directly to the questions.

I have started making new game engine and I want to enhance it with scripting capabilities. I want be able to use scripting on the map(for now adding new NPCs, objects and items, some map events) and NPC AI programming. I have already read some documentation of Groovy and Jyton, most likely to use Groovy, it appeared to me more attractive, unless some of you could give me advice using any other scripting language. This was the first question.. The second question which I have is about embedding the script. The way I'm thinking to do this for the map for example is:
i) I create the map object with some tiles
ii) In separate file I create the script, which will have access to the map object, granted by embed mechanisms in my server code
iii) I place the script file only on the server and when some event occur I send the data to the client

Do I think correctly? Can you correct me and point the right way of doing this?
Thank you in advance,
7  Discussions / Miscellaneous Topics / Re: I'm Married on: 2010-06-25 08:56:23
Gratz!!! Best wishes!

I'm also planing to marry in 2 month Smiley
8  Game Development / Newbie & Debugging Questions / Re: Initialising threads with a while loop. on: 2010-06-23 14:03:42
Initializing the Thread with same name in this case won't cause problems because of using new Thread(), which will create new instance of the object(in this case Thread), overwriting the old one.

What about Vector, I think(almost 100% sure) that after the death of the thread you will need to remove it from Vector, else Vector will keep growing in it's size.
9  Game Development / Newbie & Debugging Questions / Re: Initialising threads with a while loop. on: 2010-06-23 13:40:27
Hmm if you won't name the Thread you can have memory leaks in your soft, cuz some of the threads could not finish for some reason.. Also if you gonna create the threads and don't save reference to it, you are loosing control over the threads you created.

I'm not sure of the best solution for this, but I would use something like:
Vector <Thread> particle_thread_vector = new Vector <Thread>();
while(true)//put your condition here
Thread tmp_thread = new Thread(new ParticleAI());
10  Discussions / General Discussions / Re: Project Natal on: 2010-06-15 13:34:50
The project it self is very promising. But I think this promotional video overestimate for sure the current state of the project. This is like what happened 2 or 3 weeks ago on the company I work. The television guys came and made some reportage about the new technology which is being worked in the company, but as I was core tester of the project and I have seen the video they made and shown on television I said like: "WTF?". 40-50% of what they said was lies.. And overestimation of what was currently done.. I think the video is kinda proof of concept and not what they actually have. At least this is my opinion(I might be very wrong).
11  Game Development / Performance Tuning / Re: This is killing my computer D: (simple task) on: 2010-06-11 11:38:31
Last time I checked, even single core CPUs could do context-switching Wink

True, have tried now putting 5 infinite cycles running and still getting machine response, though it's kinda slow, but anyway, better then restart Cheesy. But I know for sure, infinite cycle with forks(C) would kill machine in 10 seconds Tongue (not applies to the case, but anyways Tongue)
12  Games Center / Archived Projects / Re: Stickmen Wars #2 feasibility test on: 2010-06-11 08:52:25
Nice! I got it running 10-11 fps in "Quite Mode" on my PC(so probably it doesn't count a lot), going to try in "Gaming" or "Performance" mode when going to be at home.. PC makes too much noise Cheesy

But it's really nice work!
13  Game Development / Performance Tuning / Re: This is killing my computer D: (simple task) on: 2010-06-10 14:46:59
Make the Thread sleep for 25msec for example or read some tutorials about how wait() and notify() works in Java Threads.. Before starting make something it's better to read some documentation before..

EDIT: The code you have is has infinite cycle... probably your PC has 2+ core CPU, this is what saving you from complete freeze of machine...

EDIT2: This question should go to "Newless Clubies" section Wink
14  Game Development / Newbie & Debugging Questions / Re: Thread stopping. on: 2010-06-09 16:21:42

Omg this one is extensive, but probably I'll give it a look Cheesy (interesting)
15  Game Development / Networking & Multiplayer / Re: About UDP on: 2010-06-09 16:19:17
yeah, but how is that string read, by the rechiever? How do you seperate the things?

Check this out Wink
16  Discussions / Jobs and Resumes / Re: Java MMORPG Project - Looking for a team! on: 2010-06-09 16:16:39
I bet you mean 'offline'.

Hmm, I mean people from university, who are kinda lazy and then there is overhead of working for entire group.. It's hard to find some1 addicted and some1 who would really help without making a lot of stupid questions.
17  Discussions / Jobs and Resumes / Re: Java MMORPG Project - Looking for a team! on: 2010-06-09 11:30:56
riven's got a point, its ok if you know them in rl, but online they will flake out

Well even online it's hard to motivate people to write the things in your rhytm... Or even write anything...
18  Game Development / Networking & Multiplayer / Re: About UDP on: 2010-06-09 11:15:55
So how excactly do I check the code for the protocol to know what to do? .startsWith("") ?

I'm not sure about if the JSON I'm positing is esthetically right, since the applications I made previously all used XML and after figuring out the problems using of XML I only planning to investigate how to pass that to JSON and how correct JSON is being created, but the string could look like:
    "request": "upd_pos",
    "character_id": 1,
    "line": 10,
    "column": 10

Using GSON(library of Google that allows JSON) parsing you get every element of the JSON and you can parse the type of request which arrived depending on the "request" element.
19  Game Development / Networking & Multiplayer / Re: About UDP on: 2010-06-09 10:57:47
The article just said how to send a string with a package, but how do I request methods to be ran? :-)

When the data is received on client or server, you should parse what is coming in the string. Imagine, you send from client to server following string: "upd_pos:1:10:15". On server you got some kind of selector(at list I use to call the method which detects what request was received from client), which takes the first part of the string and analyze it. Selector detects that the first string is "upd_pos", so it knows what is the method needed to handle the data, for example method updatePosition. You pass the string, or the unparsed part of the string to the method and the method updatePosition continues parsing.
There should be defined protocol, either made by yourself or already existing one, protocol is need for server to know what each string means. Though the string I gave you is just an example, in case of communication probably I would use JSON or in worth case XML(in my own practice using XML for RT games generates much more traffic then JSON).
20  Games Center / Archived Projects / Re: Chess and Checkers - I have some screen captures here from my Boardgames site !! on: 2010-05-26 16:01:28
currently dont have enough school hours for AI programming for boardgames.

Just a note, you could use MiniMax algorithm for AI programming(for checkers at list, for chess it's quite difficult), which is quite easy and fast to implement, all you need is to do a lot of test in the end, to see if it's working correctly.

If you will think on implementation I would advice you implementing MiniMax with AB Cutoff and some limit for tree expending, since there are too many possible moves.
21  Game Development / Newbie & Debugging Questions / Re: Drawing game elements on the screen on: 2010-05-26 15:41:18
Quote from: teletubo
I think the biggest problem there is using JLabels to old your graphics .
You should load them directly in a BufferedImage and draw those images in a Graphics2D (of a canvas, for example) .

Ok, I see, then I'll need to do the implementation I had before Cheesy
But there is another question.. I still need to track the image positions in case of detection of MouseClicks right?

Quote from: teletubo
I know this has been advised over and over, but there it goes again : Kev Glass' Space Invaders 2d Tutorial :

Thanks, going to check this right after finish working Tongue

Quote from: teletubo
(Oh and I forgot to mention when I played your game : it took an awful lot to download, and i'm pretty sure it's because you're loading external images from  an URL. Don't do that, pack them with your game or a jar, it's way faster)

I was already adviced to do that, didn't got time to test this.
22  Game Development / Newbie & Debugging Questions / Drawing game elements on the screen on: 2010-05-26 15:12:05
Hey folks,

I have a question about performance of drawing elements to the screen and maybe some suggestion at the current scheme I do use to draw the components in my game screen.

I will explain from the beginning what I'm doing and if I'm doing something(or everything wrong) indicate me what is wrong.

Components Loading
- I got my game graphics stored in png images
- I'm using MediaTracker to see when some image is fully loaded
- While I'm loading graphics, I analyze the image content and convert color(255,0,255) to transparency and store them to Hashtable <String, BufferedImage>(I got different Hashtables, depending on what image category is)
At the moment I got in memory: creature graphics, character graphics, menu backgrounds, etc

Map Creation
- Map is created from a dat file which contains array of tile objects
- Map is only created after character does login
- At the moment after I create the map it's 3200x3200px (is it too big??)

Drawing on screen
- All of my components are drawn in personized JLabel(class which extends JLabel)
- When map loaded JLabel is created and in paint method of JLabel map image is drawn
- When characters are loaded, Hashtable <String, JLabel> is filled with characters and kept in memory for repaints
- When map objects are loaded JLabel is created and put in another Hashtable <String, JLabel>
- I got update function which calculates and changes the offsets and positions of elements
- After update is done I'm creating temporary render array were I put the JLabels in the order of drawing them on screen
- Repaint is done

Thanks is advance
23  Games Center / Archived Projects / Re: Suppression on: 2010-05-25 12:07:45
The interface froze for me after clicking login with no text for password or login.

Can you be little bit more specific what you have done? I'm trying to insert empty username/password and there is feedback given "Username or password wrong!"
There are some problems on server related to this issue, I should protect it better.
24  Games Center / Archived Projects / Re: Suppression on: 2010-05-25 02:30:50
I'm not sure, but probably the problem with such slow behavior of the elements on the window can be one of the following(or even all of them all together) :
- I'm directly using a Thread for drawing my world (unless the section below counts as game thread)
java.awt.EventQueue.invokeLater(new Runnable()
            public void run()

- I'm being calculating(for now) all the elements of the world and trying to display them
- I'm being using to large image for the world terrain(all the terrain is a big image generated from tiles - this is going to be changed too)

Because my interface is built from Swing components(JLabels, JPanels, etc) and there components seems to have double buffering enabled by default(at least that is what I understood reading some forum posts), unless I'm wrong with this afirmation..

I need advice please Tongue
25  Games Center / Archived Projects / Re: Suppression on: 2010-05-25 01:24:17
Quote from: teletubo
I couldn't actually understand what is going on, I couldn't place towers and I just got the hero wandering around .
I know it's very confusing Tongue I'll try improve usability on the next release. If you click on "2" key on keyboard(there is an icon in action panel without any identification Cheesy) you can see the tower construction "shadow" and after the construction shadow is shown and there are no red squared in the middle, by clicking with "left" mouse button you are able to construct the tower.. Shame on me... No usability at all Sad

Quote from: teletubo
I didn't quite get also where's the multiplayer fits in .
My idea is, there will be team vs team play(maybe when I'll add minimap it will be more clear, dunno). For example first 20 minutes players from each team are fighting some number of creature, or gathering some creature dropped rewards to destroy some not existing at the moment obstacle to pass to the other team zone. Why players would do that? Because from other player side if the obstacle is not destroyed there will be coming even more creatures. The game vs creature can't be won, only the game agains the other team can be won..

Quote from: teletubo
I see you used Reiner's tileset, I used them myself on a semi-abandoned project of mine, [Tactics Pompster Online .    If you see I'm drawing I think the same ammount of entities and still getting a smooth framerate. Are you using BufferedStrategy ?
As I say I'm very new in Game programming and this is my first project, I will for sure read about BufferedStrategy, thanks for indicating the right path Tongue

Quote from: teletubo
I also modeled a few characters on the same "Reiner" style (you can see some of them in the game), if you want them I can provide their sprite sheet for you.
This would be really nice, since I want to work with my friend and he want to draw and he is not very good in modeling Wink

Quote from: teletubo
By the way, I'm writing a game very much similar to yours right now, the online version of my game "Zombie defense" (see TinyGame competion) . To my defence, I announced it yesterday, so I'm not stealing you idea !!
Hehe, there is nothing to steal Cheesy

Quote from: teletubo
anyway, good luck with your project !
Thanks again!
26  Games Center / Archived Projects / Suppression on: 2010-05-25 00:20:09
Hey guys,

Finally I managed to create a release of the game(made with the game engine and some hardcoding Cheesy) I was working the last 2 month.

The game idea is to be towers of defense multiplayer, where players can fight with incoming waves, construct towers in team and fight another teams present on same map.

This is my first project and there are still tones of things I will polish as soon as my university holidays will start(the most proprietary are: working on improved performance of drawing objects and map, network traffic reduction, implementing connection loss sensitive session and a lot of tweaks like click on buttons, click on spells, etc)

There are still several interface bugs(at list the ones I know) which I'm going to fix in next few weeks.

Game is made in Java Applet and can be found in here:
Test accounts are: test01/test01..test05/test05 (sorry registration and guest access are not implemented yet)

Any critiques and suggestions are welcome.
Thanks everyone.

27  Games Center / Archived Projects / Re: Chess and Checkers - I have some screen captures here from my Boardgames site !! on: 2010-05-23 17:58:35
Well I also think in buying a server Tongue

University provides me one now, but it's 50% uptime over the last 2-3 weeks .. I was going to launch my game on Friday, but the server is down :*(
28  Games Center / Archived Projects / Re: Chess and Checkers - I have some screen captures here from my Boardgames site !! on: 2010-05-23 09:45:17
Nice work I like it :-)

Some considerations:
- Check is not being detected and the side which is under check allowed to do any move
- When pawn reach the other side of board, it should be changed to the figure I like
29  Games Center / Archived Projects / Re: New game developed in Java on: 2010-05-22 23:29:28
Yeah exactly I think in that zone I'm loosing game, can you make it little bit more clear where is walkable area, where is not? For example you can change the color of the floor..
30  Games Center / Archived Projects / Re: New game developed in Java on: 2010-05-22 01:32:11
I'm not sure if there is a bug, on level 6, it seems I'm not beating with the wall and dieying.. Level 6 obstacles could be more definitive.. Hard to understand if wood is obstacle or not?

Nice game anyways Smiley
Pages: [1] 2
Riven (26 views)
2015-07-27 16:38:00

Riven (16 views)
2015-07-27 15:35:20

Riven (20 views)
2015-07-27 12:26:13

Riven (10 views)
2015-07-27 12:23:39

BurntPizza (26 views)
2015-07-25 00:14:37

BurntPizza (39 views)
2015-07-24 22:06:39

BurntPizza (22 views)
2015-07-24 06:06:53

NoxInc (25 views)
2015-07-22 22:16:53

NoxInc (17 views)
2015-07-22 22:13:39

Jesse (39 views)
2015-07-22 03:10:36
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41: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!