Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RL Developement question (Java UI)

1 view
Skip to first unread message

ryan.m...@gmail.com

unread,
May 19, 2005, 12:55:47 AM5/19/05
to
Hey Everyone,

I've long been a fan of rl games and have been playing adom and angband
variants for the past five years. Recently I decided to start creating
my own game and decided to use java(like JADE ;) ). - (with Jbuilder).

I'm pretty familiar with java, but haven't done much with UI stuff and
am stuck on finding the best way (or even a way that works) to display
my "tiles" to the screen (Right now I just want to use ascii).

I'm trying to use swing... What do I use for the components? Can
I can use a single JTextArea? Or somehow hundreds of little jpanels?

It looked like Thomas B. created his own class deriving from
swing.JPanel. Although I'm not sure the how many he used, etc.

I've been googling it but can't seem to find anything. After spending
a couple days reading this newsgroup, I decided to ask here. Let me
know if you can help, or have open source code that does it, or have
found a webpage that tells me.

Thanks,
Nedasa

Kornel Kisielewicz

unread,
May 19, 2005, 1:00:45 AM5/19/05
to
ryan.m...@gmail.com wrote:
> Hey Everyone,
>
> I've long been a fan of rl games and have been playing adom and angband
> variants for the past five years. Recently I decided to start creating
> my own game and decided to use java(like JADE ;) ). - (with Jbuilder).
>
> I'm pretty familiar with java, but haven't done much with UI stuff and
> am stuck on finding the best way (or even a way that works) to display
> my "tiles" to the screen (Right now I just want to use ascii).

Unfortunately Java is a realy bad choice for ASCII graphics. There is no
decent curses implementation for that platform.

> I'm trying to use swing... What do I use for the components? Can
> I can use a single JTextArea?

Oh no! This thingie wasn't designed to handle a direct access,
multicolor character table.

> Or somehow hundreds of little jpanels?

Arggghh!! This one would be realy bad :-(.

You may try searching for JCurses (someone will post a link probably)
but they're incomplete. The only reasonable way (and the way Biskup did
it I guess) is doing a normal Tile engine, with ASCII characters instead
of tiles.

> I've been googling it but can't seem to find anything. After spending
> a couple days reading this newsgroup, I decided to ask here. Let me
> know if you can help, or have open source code that does it, or have
> found a webpage that tells me.

Maybe someone will provide some more useful info.
--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]
"From what I've read, a lot of people believe that GenRogue
exists and will be released some day" -- Arxenia Xentrophore

Nedasa

unread,
May 19, 2005, 1:11:22 AM5/19/05
to
Wow, fast response. (thanks)
Most of what you said confirmed what I was afraid of...

A normal Tile engine? Can you (or anyone else) suggest a good one?
Is there anything in particular I should know about them? It is
possible that's exactly what I need.

I think I downloaded Jcurses a few days back, but haven't looked much
at it yet.

Again, thanks for your help.
Nedasa

Kornel Kisielewicz

unread,
May 19, 2005, 2:16:34 AM5/19/05
to
Nedasa wrote:
> Wow, fast response. (thanks)
> Most of what you said confirmed what I was afraid of...
>
> A normal Tile engine? Can you (or anyone else) suggest a good one?

The best one is your own ;-).

> Is there anything in particular I should know about them? It is
> possible that's exactly what I need.

But you have to make it yourself. I dont remember what Java has for
drawing Bitmaps (a canvas?) but maybe you'd be better of in looking for
a true 2D library. Slash? ABCGi? Anyone?


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"Due to Pascal's original purpose as a teaching language it forces one
to learn good habits - and those good habits stay with you, even when
you later migrate to a much more forgiving language." - Sherm Pendley

ABCGi

unread,
May 19, 2005, 2:44:44 AM5/19/05
to
Kornel Kisielewicz wrote:
> Nedasa wrote:
>
>> Wow, fast response. (thanks)
>> Most of what you said confirmed what I was afraid of...
>>
>> A normal Tile engine? Can you (or anyone else) suggest a good one?
>
> The best one is your own ;-).

Instead use H-World to write your whole game - it has
a "tile engine" built in :)
http://h-world.simugraph.com/
https://sourceforge.net/projects/h-world/

>> Is there anything in particular I should know about them? It is
>> possible that's exactly what I need.
>
> But you have to make it yourself. I dont remember what Java has for
> drawing Bitmaps (a canvas?) but maybe you'd be better of in looking for
> a true 2D library. Slash? ABCGi? Anyone?

*---------------------------^^^^^
|
There is an excellent tileset set (2D and iso-psuedo3D)
available from the excellent Itakura!
http://rltiles.sourceforge.net/

--
ABCGi ---- (ab...@yahoo.com) ---- http://codemonkey.sunsite.dk
Fun RLs in rgrd that I have tested recently!
DoomRL - DwellerMobile - HWorld - AburaTan - DiabloRL
Heroic Adventure - Powder - Shuruppak - TheTombs

Kornel Kisielewicz

unread,
May 19, 2005, 2:48:01 AM5/19/05
to
ABCGi wrote:
>>> Is there anything in particular I should know about them? It is
>>> possible that's exactly what I need.
>>
>> But you have to make it yourself. I dont remember what Java has for
>> drawing Bitmaps (a canvas?) but maybe you'd be better of in looking
>> for a true 2D library. Slash? ABCGi? Anyone?
>
> *---------------------------^^^^^
> |
> There is an excellent tileset set (2D and iso-psuedo3D)
> available from the excellent Itakura!
> http://rltiles.sourceforge.net/

I meant a Java 2D programming library :-P


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"The development cycle for roguelikes never ends..." -- Joseph
Hewitt

ABCGi

unread,
May 19, 2005, 3:39:25 AM5/19/05
to
Kornel Kisielewicz wrote:
> ABCGi wrote:
>
>>>> Is there anything in particular I should know about them? It is
>>>> possible that's exactly what I need.
>>>
>>> But you have to make it yourself. I dont remember what Java has for
>>> drawing Bitmaps (a canvas?) but maybe you'd be better of in looking
>>> for a true 2D library. Slash? ABCGi? Anyone?
>>
>> There is an excellent tileset set (2D and iso-psuedo3D)
>> available from the excellent Itakura!
>> http://rltiles.sourceforge.net/
>
> I meant a Java 2D programming library :-P

Yeah - but once you start using H-World instead
you just need this tileset or one like it :D

ga...@dsdata.it

unread,
May 19, 2005, 4:17:28 AM5/19/05
to

ryan.m...@gmail.com wrote:
> Hey Everyone,
>
> I've long been a fan of rl games and have been playing adom and
angband
> variants for the past five years. Recently I decided to start
creating
> my own game and decided to use java(like JADE ;) ). - (with
Jbuilder).
>
> I'm pretty familiar with java, but haven't done much with UI stuff
and
> am stuck on finding the best way (or even a way that works) to
display
> my "tiles" to the screen (Right now I just want to use ascii).
> I'm trying to use swing... What do I use for the components?
Can
> I can use a single JTextArea? Or somehow hundreds of little jpanels?

JTextArea can be, with difficulty and possibly with performance
degradation, be coerced to display an array of coloured characters
(monospaced font, red only, thousands of ranges and attributes) but
it's unlikely to be a good solution because it's not its job.

An array of hundreds of panels or a borderless JTable are also
inappropriate and probably too heavy.

>
> It looked like Thomas B. created his own class deriving from
> swing.JPanel. Although I'm not sure the how many he used, etc.

I've not read Biskup's code, but I suppose he used the standard
approach of custom widget drawing: a specialized "playfield" panel in
which appropriate high level calls drew letters, highlights and so on.
Swing offers comprehensive drawing primitives. Each letter can be drawn
at pixel precise locations, you can leave room for borders around
letters, you can mix letters drawn on the fly and bitmaps (maybe
pre-rendered letters), and performance is good.

> I've been googling it but can't seem to find anything. After
spending
> a couple days reading this newsgroup, I decided to ask here. Let me
> know if you can help, or have open source code that does it, or have
> found a webpage that tells me.
>
> Thanks,
> Nedasa

You shouldn't need anything more specialized than standard Swing
documentation like the API docs, the official Java Tutorial
(http://java.sun.com/docs/books/tutorial/ ;
http://java.sun.com/docs/books/tutorial/uiswing/ ) and other examples
and tutorials you can find on the web.
The main relevant technicalities are easy ones: installing and
referencing fonts in Java and double buffering.

Lorenzo Gatti

Nedasa

unread,
May 19, 2005, 4:29:12 AM5/19/05
to
Thanks for your help! Your comments definately are helpful, now I
have a more clearly defined path to pursue in trying to figure it out.

Nedasa

Nedasa

unread,
May 19, 2005, 4:32:00 AM5/19/05
to
If I were to make a tile engine, writing my own would be my first
choice. I haven't done much inter-language stuff yet in high level
languages. I assume the easiest way would be to program the tile
engine in C++ or some other language?

Kornel Kisielewicz

unread,
May 19, 2005, 4:35:49 AM5/19/05
to
Nedasa wrote:
> If I were to make a tile engine, writing my own would be my first
> choice.

Exactly :-).

> I haven't done much inter-language stuff yet in high level
> languages.

You mean programming something in C++ to use in Java? No need for such
heavy artillery....

> I assume the easiest way would be to program the tile
> engine in C++ or some other language?

The easiest is FreePascal ;-D.
But if you make a game in Java -- stick to Java.


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"It's much easier to make an army of dumb good people than to
make one single smart good guy..." -- DarkGod

Nedasa

unread,
May 19, 2005, 4:38:11 AM5/19/05
to
As of now I'd like to pursue a purely ASCII based game. I've
never gotten into playing RL games with 2D graphical tiles - always had
too much trouble telling things apart.

There is a simplicity in ASCII that appeals to me (however, the
isographic stuff looked really intresting, hadn't seen much of that
before)

H-World also looked interesting, and if i fail miserably creating a
game from scratch I may take another look at it ;).

Thanks,
Nedasa

Jakub Debski

unread,
May 19, 2005, 5:13:09 AM5/19/05
to
Dnia Thu, 19 May 2005 07:00:45 +0200, Kornel Kisielewicz napisał(a):
> Unfortunately Java is a realy bad choice for ASCII graphics. There is no
> decent curses implementation for that platform.

What for? Java is portable enough without curses library :)

There is something called Charva
http://www.pitman.co.za/projects/charva/
I haven't try it.

read also:
http://www.javaworld.com/javaworld/javaqa/2002-12/02-qa-1220-console.html

regards,
Jakub
--
"We're just toys in the hands of Xom"
xenocide.e-plan.pl - SF roguelike in development
www.graveyard.uni.cc - visit Roguelike Graveyard
www.alamak0ta.republika.pl - my other projects

tongHoAnh

unread,
May 19, 2005, 6:49:18 AM5/19/05
to
ga...@dsdata.it wrote:

> Each letter can be drawn at pixel precise locations, you can leave
> room for borders around letters, you can mix letters drawn on the fly
and
> bitmaps (maybe pre-rendered letters), and performance is good.

...

> You shouldn't need anything more specialized than standard Swing
> documentation like the API docs, the official Java Tutorial

> http://java.sun.com/docs/books/tutorial/ ;
> http://java.sun.com/docs/books/tutorial/uiswing/ ) and other examples
> and tutorials you can find on the web.

I second all these. You could try searching for the drawFromPoint(...)
method description. I personally dont think amassing objects like
JTextField/Area, JPanel is a good idea with Java because:
+ it makes things damn slow
+ using drawFromPoint(...) is more than suffice ;)

SZDev - Slash

unread,
May 19, 2005, 9:14:16 AM5/19/05
to

ryan.m...@gmail.com ha escrito:

> Hey Everyone,
>
> I've long been a fan of rl games and have been playing adom and
angband
> variants for the past five years. Recently I decided to start
creating
> my own game and decided to use java(like JADE ;) ). - (with
Jbuilder).

Nice! what JDK will you be using???

>
> I'm pretty familiar with java, but haven't done much with UI stuff
and
> am stuck on finding the best way (or even a way that works) to
display
> my "tiles" to the screen (Right now I just want to use ascii).
>
> I'm trying to use swing... What do I use for the components?
Can
> I can use a single JTextArea?


No...


> Or somehow hundreds of little jpanels?

NOOOOOO!!!! ;)

>
> It looked like Thomas B. created his own class deriving from
> swing.JPanel. Although I'm not sure the how many he used, etc.

I haven't properly seen Mr. Biskup ideas, but the best thing you can do
to make console output in java is to create a specialized component
which can plot characters at specific positions of the screen.

You can do this by creating a JPanel that stores arrays of arrays of
characters, colors and screen update flags, and paints itself using
this data with standard drawString or more advanced text plotting
methods; and providing printAt(x,y,String) as well as cls(),
setColor(), etc. methods.

I am using this up to now with good results, see
http://peltkore.net/~szdev/crl and http://peltkore.net/~szdev/ga

>
> I've been googling it but can't seem to find anything. After
spending
> a couple days reading this newsgroup, I decided to ask here. Let me
> know if you can help, or have open source code that does it, or have
> found a webpage that tells me.
>
> Thanks,
> Nedasa

--
Slash

airolson

unread,
May 19, 2005, 11:01:47 PM5/19/05
to
Kornel Kisielewicz wrote:
> I meant a Java 2D programming library :-P

I'm using SDLJava for the moment, which is a really nice way to use SDL without having to mess around with JNI.

http://sdljava.sourceforge.net/

I suspect I'll eventually use it anyway (for compilation with gcj) but one step at a time. Anyway, the important thing is not to have too many dependencies on one graphics library; ideally you'd only have to implement some interfaces to switch Java2D to jcurses, for example.

-Aaron

Nedasa

unread,
May 20, 2005, 1:34:08 AM5/20/05
to

> Nice! what JDK will you be using???

Working with Jbuilder right now.

> You can do this by creating a JPanel that stores arrays of arrays of
> characters, colors and screen update flags, and paints itself using
> this data with standard drawString or more advanced text plotting
> methods; and providing printAt(x,y,String) as well as cls(),
> setColor(), etc. methods.

Looking into figuring out the "Graphics", "Graphics2d", and "ImageIcon"
classes (sound familiar at all?). They seem to have some of the needed
methods. Haven't got it working quite yet, but haven't had the time
to.

When you're talking about with creating a JPanel... ( lets say that
the map info is stored in a 2d array ). Do you mean creating a class
derived from JPanel and having the array as a data member?

Nedasa

unread,
May 20, 2005, 1:39:16 AM5/20/05
to
FreePascal eh? hmm, okay.

Sticking to java was the original plan. It seems like it will work,
although not 100% sure until the UI stuff is sorted out.

Nedasa

unread,
May 20, 2005, 1:42:45 AM5/20/05
to
Thanks, the sun.com sites are quite informative although a lot of
info. Hopefully in a day or two I'll either have the basics UI
working or have another more specific question I can ask.

Nedasa

tongHoAnh

unread,
May 20, 2005, 5:52:30 AM5/20/05
to
Nedasa wrote:

> When you're talking about with creating a JPanel... ( lets say that
> the map info is stored in a 2d array ). Do you mean creating a
> class derived from JPanel and having the array as a data member?

I think he means drawing stuff inside one JPanel only.

SZDev - Slash

unread,
May 20, 2005, 8:56:43 AM5/20/05
to

Nedasa ha escrito:

> > Nice! what JDK will you be using???
>
> Working with Jbuilder right now.

Yeah, but what JDK? :)

>
> > You can do this by creating a JPanel that stores arrays of arrays
of
> > characters, colors and screen update flags, and paints itself using
> > this data with standard drawString or more advanced text plotting
> > methods; and providing printAt(x,y,String) as well as cls(),
> > setColor(), etc. methods.
>
> Looking into figuring out the "Graphics", "Graphics2d", and
"ImageIcon"
> classes (sound familiar at all?). They seem to have some of the
needed
> methods. Haven't got it working quite yet, but haven't had the
time
> to.

Well, but you must be the one to provide the methods using your custom
JPanel.

>
> When you're talking about with creating a JPanel... ( lets say that
> the map info is stored in a 2d array ). Do you mean creating a
class
> derived from JPanel and having the array as a data member?

Yes, that's what I mean... however have in mind not to store game
objects (like mapcells or so) as attributes of the JPanel if you want
to provide generic functionality with it... (store characters and
colors instead)

Perhaps I should clean up and provide this small console emulation
panel here???

Nedasa

unread,
May 20, 2005, 10:29:48 AM5/20/05
to

> Yeah, but what JDK? :)
>

Lol, JDK... version 1.4.2

>
> Well, but you must be the one to provide the methods using your
custom
> JPanel.
>

right.

>
> Yes, that's what I mean... however have in mind not to store game
> objects (like mapcells or so) as attributes of the JPanel if you want
> to provide generic functionality with it... (store characters and
> colors instead)
>

Okay, that is what I was originally thinking (as far as not storing
game objects in the user interface). There are a few details
about storing the characters and colors that I'm not sure about yet.
I work a double today, but should have a couple hours to work on
it when I get home tonight.

> Perhaps I should clean up and provide this small console emulation
> panel here???

Sure :) I'll eventually figure it out, but an example would
certainly speed up the process.

Thanks for your help,
Nedasa

Mark 'Kamikaze' Hughes

unread,
May 20, 2005, 4:24:05 PM5/20/05
to
ryan.m...@gmail.com <ryan.m...@gmail.com>

I would highly recommend not using Swing for this. Swing is extremely
bloated and slow, and will typically run at half to 1/10th the speed of
an equivalent AWT solution. If you do use Swing, you'll want to use a
single component, extending JComponent. Using many components will be
unbelievably slow.

For making a terminal screen, you need to make a custom component and
draw each character (or tile) into a grid. While double-buffering and
only redrawing the dirty rectangle can make the display even faster,
it's not really essential in a turn-based game.

I have a simple terminal class I've used for some little apps, I'll
pull that out and publish it on my Java page today or tomorrow, as
"Terminal"
<http://kuoi.asui.uidaho.edu/~kamikaze/Java/>

--
<a href="http://kuoi.asui.uidaho.edu/~kamikaze/"> Mark Hughes </a>
"Gibson and I dueled among blazing stacks of books for a while. [...] The
streets were crowded with his black-suited minions and I had to turn into a
swarm of locusts and fly back to Seattle." -Neal Stephenson, /. interview

Nedasa

unread,
May 21, 2005, 3:56:30 AM5/21/05
to

> I would highly recommend not using Swing for this. Swing is
extremely
> bloated and slow, and will typically run at half to 1/10th the speed
of
> an equivalent AWT solution. If you do use Swing, you'll want to use
a
> single component, extending JComponent. Using many components will
be
> unbelievably slow.

Okay, for some reason I was still equating AWT and Swing in my mind.

>
> For making a terminal screen, you need to make a custom component
and
> draw each character (or tile) into a grid. While double-buffering
and
> only redrawing the dirty rectangle can make the display even faster,
> it's not really essential in a turn-based game.
>

Okay, I'll keep that in mind. I read an article about
double-buffering so sort of understand it.

> I have a simple terminal class I've used for some little apps, I'll
> pull that out and publish it on my Java page today or tomorrow, as
> "Terminal"

Thanks for posting it. I've download it and glanced at it tonight. It
compiled and ran and produced a lot of the output I'm now working to
produce :).

It is based on Canvas which is more heavyweight than Component... What
kind of adv. / disadvantages are there to using the two different
classes?

Twisted One

unread,
May 21, 2005, 4:51:03 PM5/21/05
to
Nedasa wrote:
> FreePascal eh? hmm, okay.

No! Don't take that *seriously*! He meant it as a *joke*!

:)

--
http://www.gnu.org/philosophy/right-to-read.html
Palladium? Trusted Computing? DRM? Microsoft? Sauron.
"One ring to rule them all, one ring to find them
One ring to bring them all, and in the darkness bind them."

Twisted One

unread,
May 21, 2005, 4:53:07 PM5/21/05
to
ga...@dsdata.it wrote:
> I've not read Biskup's code, but I suppose he used the standard
> approach of custom widget drawing: a specialized "playfield" panel in
> which appropriate high level calls drew letters, highlights and so on.
> Swing offers comprehensive drawing primitives. Each letter can be drawn
> at pixel precise locations, you can leave room for borders around
> letters, you can mix letters drawn on the fly and bitmaps (maybe
> pre-rendered letters), and performance is good.

What is this phrase doing here, associated as it is with Java and even
with Swing! ("Performance is good")

Kornel Kisielewicz

unread,
May 22, 2005, 12:53:07 PM5/22/05
to
Twisted One wrote:
> Nedasa wrote:
>
>> FreePascal eh? hmm, okay.
>
>
> No! Don't take that *seriously*! He meant it as a *joke*!

No I didn't :-P

--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"Shadows universe is non-heroic, unfair, cruel and designed to
start playing on your nerves and sanity." -- Anubis

Twisted One

unread,
May 22, 2005, 10:33:03 PM5/22/05
to
Kornel Kisielewicz wrote:
> Twisted One wrote:
>> Nedasa wrote:
>>> FreePascal eh? hmm, okay.
>>
>> No! Don't take that *seriously*! He meant it as a *joke*!
>
> No I didn't :-P

Pascal *is* a joke, somewhat in the same vein as perl and INTERCAL, I
suspect. The more so because it (along with perl) are actually in
production use -- the joke's on hundreds of Webmasters, and even some
Microsoft employees!

Kornel Kisielewicz

unread,
May 23, 2005, 10:00:36 AM5/23/05
to
Twisted One wrote:
>> No I didn't :-P
>
> Pascal *is* a joke, somewhat in the same vein as perl and INTERCAL, I
> suspect. The more so because it (along with perl) are actually in
> production use -- the joke's on hundreds of Webmasters, and even some
> Microsoft employees!

Well, DoomRL is no joke (at least in that sense) so who cares what I
use? Anyway, you'll never fully understand the power of the DarkSide
unless you try... ;-D


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"11 years and no binary. And it's not vapourware" -- Igor Savin

Timothy Pruett

unread,
May 23, 2005, 10:00:39 AM5/23/05
to
Kornel Kisielewicz wrote:
> Twisted One wrote:
>
>>> No I didn't :-P
>>
>>
>> Pascal *is* a joke, somewhat in the same vein as perl and INTERCAL, I
>> suspect. The more so because it (along with perl) are actually in
>> production use -- the joke's on hundreds of Webmasters, and even some
>> Microsoft employees!
>
>
> Well, DoomRL is no joke (at least in that sense) so who cares what I
> use? Anyway, you'll never fully understand the power of the DarkSide
> unless you try... ;-D

You just proved one of the points I've stated all along. Who cares
what language is used? As long as the end-user can't tell, it doesn't
matter. As long as it runs, is not buggy, and is capable of
cross-platform support, it doesn't matter. The end-user doesn't care
about the language, he just cares whether or not it works.


--
Read more about my three projects, SoulEaterRL,
Necropolis, and a little toy RL.

http://www.freewebs.com/timsrl/index.htm

--

Kornel Kisielewicz

unread,
May 23, 2005, 10:14:00 AM5/23/05
to
Timothy Pruett wrote:
> You just proved one of the points I've stated all along. Who cares what
> language is used? As long as the end-user can't tell, it doesn't
> matter. As long as it runs, is not buggy, and is capable of
> cross-platform support, it doesn't matter. The end-user doesn't care
> about the language, he just cares whether or not it works.

Yup. *UNLESS* the language chosen forces him to download a huge load of
Microsoft shit (.NET) or it forces him to download a big Sun pack (Java) :-/


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"Due to Pascal's original purpose as a teaching language it forces one
to learn good habits - and those good habits stay with you, even when
you later migrate to a much more forgiving language." - Sherm Pendley

The Sheep

unread,
May 23, 2005, 12:23:14 PM5/23/05
to
Dnia Mon, 23 May 2005 16:14:00 +0200,
Kornel Kisielewicz napisal(a):

> Timothy Pruett wrote:
>> The end-user doesn't care
>> about the language, he just cares whether or not it works.
> Yup. *UNLESS* the language chosen forces him to download a huge load of
> Microsoft shit (.NET) or it forces him to download a big Sun pack (Java) :-/

Or moderately-sized free interpreter (Python).

--
Radomir @**@_ Bee! The quest for the Real World:
`The Sheep' ('') 3 Try #2: goto -1
Dopieralski .vvVvVVVVVvVVVvv.

Kornel Kisielewicz

unread,
May 23, 2005, 1:37:31 PM5/23/05
to
The Sheep wrote:
> Dnia Mon, 23 May 2005 16:14:00 +0200,
>>Yup. *UNLESS* the language chosen forces him to download a huge load of
>>Microsoft shit (.NET) or it forces him to download a big Sun pack (Java) :-/
>
> Or moderately-sized free interpreter (Python).

For people who don't usualy work on *nix stations this is a pain :-/


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"The development cycle for roguelikes never ends..." -- Joseph
Hewitt

Twisted One

unread,
May 23, 2005, 4:30:23 PM5/23/05
to
Kornel Kisielewicz wrote:
> Timothy Pruett wrote:
>
>> You just proved one of the points I've stated all along. Who cares
>> what language is used? As long as the end-user can't tell, it doesn't
>> matter. As long as it runs, is not buggy, and is capable of
>> cross-platform support, it doesn't matter. The end-user doesn't care
>> about the language, he just cares whether or not it works.
>
> Yup. *UNLESS* the language chosen forces him to download a huge load of
> Microsoft shit (.NET) or it forces him to download a big Sun pack (Java)
> :-/

Or it makes him download a small load of M$ shit (VBRUN6.DLL) or the app
is ridiculously slow and bloated for its capabilities. (Java -- a
typical event-driven, UI- and network-dominated app uses 100MB RAM and
lots of CPU. I'd hate to see how much worse it gets when the problem
domain is actually number-crunching and involves large data sets --
several GB and dual-core 4GHz Duron needed, by any chance?)

Twisted One

unread,
May 23, 2005, 4:31:09 PM5/23/05
to
Kornel Kisielewicz wrote:
> The Sheep wrote:
>
>> Dnia Mon, 23 May 2005 16:14:00 +0200,
>>
>>> Yup. *UNLESS* the language chosen forces him to download a huge load
>>> of Microsoft shit (.NET) or it forces him to download a big Sun pack
>>> (Java) :-/
>>
>> Or moderately-sized free interpreter (Python).
>
> For people who don't usualy work on *nix stations this is a pain :-/

Now, now -- python apps can be packaged into standalone Winblows
executables, for those who enjoy that sort of kink. :)

Tom Seufert

unread,
May 23, 2005, 4:55:59 PM5/23/05
to
My project uses a similar approach, but supports both text and image
graphics by rendering characters into BufferedImage objects...java's
excellent image/graphics libraries make this very easy, and the
performance is excellent. That way, nearly all display code can be
written independently of which graphics mode you're in.

http://roguelike-eng.sourceforge.net/

The classes of interest are rle.core.ui.CameraBase, TileCamera, and
TextCamera...

Drawing text to an image looks like this:

Image image = new BufferedImage(height,width,type);
image.getGraphics().drawString("a",x,baseline);

Good luck!

-Tom

Twisted One

unread,
May 23, 2005, 6:12:40 PM5/23/05
to
Tom Seufert wrote:
> My project uses a similar approach, but supports both text and image
> graphics by rendering characters into BufferedImage objects...java's
> excellent image/graphics libraries make this very easy, and the
> performance is excellent.

The performance is what? I thought you said this was implemented in
Java? ... *hopelessly confused*

Glen Wheeler

unread,
May 23, 2005, 8:43:21 PM5/23/05
to

"Kornel Kisielewicz" <kisie...@gazeta.pl> wrote in message
news:d6t4ad$9mj$2...@inews.gazeta.pl...

> The Sheep wrote:
>> Dnia Mon, 23 May 2005 16:14:00 +0200,
>>>Yup. *UNLESS* the language chosen forces him to download a huge load of
>>>Microsoft shit (.NET) or it forces him to download a big Sun pack (Java)
>>>:-/
>>
>> Or moderately-sized free interpreter (Python).
>
> For people who don't usualy work on *nix stations this is a pain :-/

Replace ``interpreter'' with ``small dll'' and you can d/l an *.exe.

--
Glen
L:Pyt E+++ T-- R+ P+++ D+ G+ F:*band !RL RLA-
W:AF Q+++ AI++ GFX++ SFX-- RN++++ PO--- !Hp Re-- S+


Kornel Kisielewicz

unread,
May 23, 2005, 9:21:50 PM5/23/05
to
Glen Wheeler wrote:
> "Kornel Kisielewicz" <kisie...@gazeta.pl> wrote in message
> news:d6t4ad$9mj$2...@inews.gazeta.pl...
>
>>The Sheep wrote:
>>
>>>Dnia Mon, 23 May 2005 16:14:00 +0200,
>>>
>>>>Yup. *UNLESS* the language chosen forces him to download a huge load of
>>>>Microsoft shit (.NET) or it forces him to download a big Sun pack (Java)
>>>>:-/
>>>
>>>Or moderately-sized free interpreter (Python).
>>
>>For people who don't usualy work on *nix stations this is a pain :-/
>
> Replace ``interpreter'' with ``small dll'' and you can d/l an *.exe.

That's why I think that distributing Windoze self-contained zips is an
excellent idea which rescues Python roguelikes from the fate of their
.NET counterparts :-)


--
At your service,
Kornel Kisielewicz (charonATmagma-net.pl) [http://chaos.magma-net.pl]

"From what I've read, a lot of people believe that GenRogue
exists and will be released some day" -- Arxenia Xentrophore

Tom Seufert

unread,
May 23, 2005, 9:24:25 PM5/23/05
to
In my experience, the approach of subclassing a single JComponent
(using Swing) does not constitute a performance hurdle. AWT is
probably faster, but for my game, the performance profiler reports only
5% or so CPU usage in drawing tasks while the player is running.

The benefit you get with Swing is that for non-speed sensitive parts of
your UI you can use JTable, etc; the Swing components are easily
configurable via renderers to show up however you want them to look...I
use JTable's for my inventory/equipment lists and it saved a lot of
hassle. AWT could probably do most of the same stuff, although I don't
believe there is an AWT table...

BTW, thanks for posting the Terminal class, Mark.

-Tom
http://roguelike-eng.sourceforge.net/

Nedasa

unread,
May 24, 2005, 12:40:02 AM5/24/05
to
I've succeeded in creating a workable interface (based largely on
Terminal - thanks Mark). Right now I'm loading a map from an input
file to a 2d Tile array and then printing it the screen. Then I
printing my character to the screen. When he moves, I check if the
location he's moving into is valid and, if so, move appropriately. The
problem is that I'm repainting the entire screen which does takes too
much time. If I was really playing a game (and being careful) I
might not notice, but when I move fast there is a noteable lag (that
will get worse when I add movable monsters and more code as the
environment becomes increasingly complex.

it consumes about 20x more processor time than angband...

Any way to get around repainting it? I'm don't think that just
repaiting the LOS will save enough clock cycles.

Also is there a way to use the JBuilder graphical designer with user
created classes?

Nedasa

unread,
May 24, 2005, 12:51:08 AM5/24/05
to
Tom,

I've downloaded your code and am going to look through it over the next
couple days (thanks for posting it).

What is your CPU speed out of curiousity?

Twisted One

unread,
May 24, 2005, 1:26:34 AM5/24/05
to
Nedasa wrote:
> I've succeeded in creating a workable interface (based largely on
> Terminal - thanks Mark). Right now I'm loading a map from an input
> file to a 2d Tile array and then printing it the screen. Then I
> printing my character to the screen. When he moves, I check if the
> location he's moving into is valid and, if so, move appropriately. The
> problem is that I'm repainting the entire screen which does takes too
> much time. If I was really playing a game (and being careful) I
> might not notice, but when I move fast there is a noteable lag (that
> will get worse when I add movable monsters and more code as the
> environment becomes increasingly complex.
>
> it consumes about 20x more processor time than angband...
>
> Any way to get around...

Yep. Don't use Java.

Nedasa

unread,
May 24, 2005, 1:53:19 AM5/24/05
to
Lol, I'm not surprised to hear you say that.

Is it really that much easier in C++ or Python?

C++ is obviously faster (something abough being precompiled... ), but I
don't have a good IDE for it, haven't done it in a while, etc.
Would writing the UI stuff in C++ be natural?

VB doesn't seem powerful/flexible enough (although it probable could be
made to work). I wrote a hack and slash game in it a while back, but
ended up stopping due to language issues. Also not terrible fast...

Python... I know viritually nothing about, but its a interpretted
language so I assume it is at best only a small amnt faster than java.

Pascal, Perl... hmm, don't know much about.

Twisted One

unread,
May 24, 2005, 2:04:52 AM5/24/05
to
Nedasa wrote:
> Lol, I'm not surprised to hear you say that.
>
> Is it really that much easier in C++ or Python?
>
> C++ is obviously faster (something abough being precompiled... ), but I
> don't have a good IDE for it, haven't done it in a while, etc.
> Would writing the UI stuff in C++ be natural?

That's a C++ weakness I'm afraid -- UI stuff, graphics, etc. -- you
might want to look into sdl, or for text-mode-only, curses, though I
hear curses is aptly named. Ugly and very low level.

> VB doesn't seem powerful/flexible enough (although it probable could be
> made to work). I wrote a hack and slash game in it a while back, but
> ended up stopping due to language issues. Also not terrible fast...

Nobody in the programming community takes VB seriously, except a few
niche Microsofties who can't get it up so spend their days making
viruses or database report generating applets for some internal use in a
cozy, protected niche in a Microsoft-loving company's internal
operations instead. ;)

> Python... I know viritually nothing about, but its a interpretted
> language so I assume it is at best only a small amnt faster than java.

It can call C routines much more easily than Java can, or so I hear.

> Pascal, Perl... hmm, don't know much about.

Which means you probably already know more than you want to know about
those... ;)

Risto Saarelma

unread,
May 24, 2005, 2:17:31 AM5/24/05
to
On 2005-05-24, Nedasa <ryan.m...@gmail.com> wrote:
> location he's moving into is valid and, if so, move appropriately. The
> problem is that I'm repainting the entire screen which does takes too
> much time. If I was really playing a game (and being careful) I

The Terminal class you're using uses Graphics.drawChars to paint the
stuff on screen. I'm guessing (which I shouldn't do without profiling
the code) that this is the bottleneck. You might get a better screen
update if you use bitmaps with the characters in them instead of the
drawChars method. Better performance is pretty certain if you have Java
1.4 or above and use the graphics acceleration features it has.

Unfortunately this means either extensively rewriting the Terminal
class, or replacing it with a class more suited for tile display in the
first place (with text characters as tiles of course). If you stick with
Terminal, you might want to try some kind of optimization scheme where
you don't scroll the map with each step and only update those parts of
the screen which actually change from step to step. You might get away
with moving just the player character @ a lot of the time, and the
delays would be less noticeable.

If you decide to start tweaking with graphics, Planetation is an
open-source library which contained lots of good uses of the graphics
acceleration tricks last time I looked:
http://www.scottshaver2000.com/template/template.php?page=planetation_main

--
Risto Saarelma

Risto Saarelma

unread,
May 24, 2005, 2:37:17 AM5/24/05
to
On 2005-05-24, Nedasa <ryan.m...@gmail.com> wrote:
> Python... I know viritually nothing about, but its a interpretted
> language so I assume it is at best only a small amnt faster than java.

I've tried making a tile-based game with Python, and performance was a
problem even with my 1.4 GHz machine. Java's main bottleneck is graphics
update, and once I got graphics acceleration working, the game ran very
smooth even on a 700 MHz processor. With Python I end up writing ugly
code with lots of numerical arrays and local variables, since using
Python objects in performance critical parts is way too slow.

The problem with Python, performance-wise, is that it's a lot more
dynamic than Java. When Java classes get compiled, the program can look
up where a class method's code is with a couple of table look-ups. With
Python, methods are stored in a hash, so each method call involves a
hash lookup. This allows neat tricks like adding methods to an existing
object, but it's not something you want to be doing thousands of times
per frame.

You can get good results with Python, but you will probably run into
headaches with acceptable frame rates. Java coding is more work, but
Java can do more heavy lifting for you when running. Python is probably
a very good language for high-level game logic, certainly better than
often quite rigid Java, so it's worth considering for this reason alone.

--
Risto Saarelma

Jim Strathmeyer

unread,
May 24, 2005, 9:52:21 AM5/24/05
to
Nedasa <ryan.m...@gmail.com> wrote:
> C++ is obviously faster (something abough being precompiled... ), but
> I don't have a good IDE for it, haven't done it in a while, etc.
> Would writing the UI stuff in C++ be natural?

Oh, shit! You're stuck in the world of bad IDE's! Break free! Use the
same IDE for everything you work on!

I recommend vim (or emacs (or xemacs)).

--
Jim Strathmeyer

Tom Seufert

unread,
May 24, 2005, 10:29:05 AM5/24/05
to
I test on 2 PIII's, 500 and 700 MHz, and a Pentium M 1.6GHz.

All three test systems are laptops with 128, 320, and 512 MB RAM
respectively, and nothing special in terms of graphics cards.

SimpleGame runs very fast (ie, when the player runs, he moves too
quickly to really see) on the PIII's, and ridiculously fast on the
Pentium M.

Of note with respect to Java's performance in 2D is that recent JVM's
enable the use of hardware acceleration for images, so even in Swing
you can focus on simplicity rather than performance and still be ok, at
least if your system was made in the last 5 yrs or so...

-Tom
http://roguelike-eng.sourceforge.net

The Sheep

unread,
May 24, 2005, 2:56:48 PM5/24/05
to
Dnia 23 May 2005 22:53:19 -0700,
Nedasa napisal(a):

> Python... I know viritually nothing about, but its a interpretted
> language so I assume it is at best only a small amnt faster than java.

The best think about Python (at least as I see it) is that it's easily
extended with C -- so you write your code in Python, and then just
do the parts that are too slow in C.

As fro graphics -- I played a little with PyGame, and I must say it's
pretty fast. Offcourse, as long as you don't go for redrawing whole screen
every frame -- fortunately there are pretty useful functions for
determining which parts have to be redrawn.

R. Alan Monroe

unread,
May 24, 2005, 8:32:19 PM5/24/05
to
In article <d6ui2t$sgu$1...@nyytiset.pp.htv.fi>, Risto Saarelma <rsaa...@gmail.com> wrote:
>The problem with Python, performance-wise, is that it's a lot more
>dynamic than Java. When Java classes get compiled, the program can look
>up where a class method's code is with a couple of table look-ups. With
>Python, methods are stored in a hash, so each method call involves a
>hash lookup. This allows neat tricks like adding methods to an existing
>object, but it's not something you want to be doing thousands of times
>per frame.

On the flip side, can't you bind a local variable in your current loop
to that same method, bypassing a bunch of lookups?

Alan

konijn_

unread,
May 26, 2005, 12:50:27 PM5/26/05
to
Try out
http://sourceforge.net/project/showfiles.php?group_id=14805&package_id=152991

It's not _perfect_ yet ( Colors need modifications, I should add some
scrolling support to make it even faster )

Cheers,
T.

Nedasa

unread,
May 27, 2005, 1:29:28 AM5/27/05
to
> It's not _perfect_ yet ( Colors need modifications, I should add some
> scrolling support to make it even faster )
>

Thanks, I modified it so that I could load a map from a file, etc and
move the character on the screen in the appropriate direction when an
arrow key was pressed. While the code was easier to modify, the
performance of reprinting the entire map was actually slightly slower
than using terminal. There was also a flickering problem (probably
a simple buffering thing).

What are you refering to when you say scrolling support to make it
faster?

Anyhow, thanks for the code. It was useful to look over and see how
you did thing.


> Cheers,
> T.

Twisted One

unread,
May 27, 2005, 3:37:24 AM5/27/05
to
R. Alan Monroe wrote:
> On the flip side, can't you bind a local variable in your current loop
> to that same method, bypassing a bunch of lookups?

Actually, you could bind any methods used in inner loops to variables
outside the inner loops in question, but accessible inside said loops.

The real annoyance is that the Python compiler apparently doesn't
perform such obvious optimizations itself (would still need to track if
the method bindings get changed though).

Python can also call C code (which runs at, well, C speeds), more easily
than Java can, and can be called back from that code apparently.

Twisted One

unread,
May 27, 2005, 3:40:13 AM5/27/05
to

If it isn't a graphical app with a nice visual hierarchy browser and so
on and so on and so on it isn't a bloody IDE. What you recommend aren't
even applications; they're jobs. As in unix jobs, i.e. museum pieces
from the seventies and earlier with minimal to nonexistent UI. And also
as in "work", or "things I'd rather not do if I can get out of having to
do them, especially if I won't get paid for them anyway". ;)

Björn Bergström

unread,
May 27, 2005, 5:35:22 AM5/27/05
to
Twisted One wrote:
> Nedasa wrote:
>
>> I've succeeded in creating a workable interface (based largely on
>> Terminal - thanks Mark). Right now I'm loading a map from an input
>> file to a 2d Tile array and then printing it the screen. Then I
>> printing my character to the screen. When he moves, I check if the
>> location he's moving into is valid and, if so, move appropriately. The
>> problem is that I'm repainting the entire screen which does takes too
>> much time. If I was really playing a game (and being careful) I
>> might not notice, but when I move fast there is a noteable lag (that
>> will get worse when I add movable monsters and more code as the
>> environment becomes increasingly complex.
>>
>> it consumes about 20x more processor time than angband...
>>
>> Any way to get around...
>
>
> Yep. Don't use Java.
>

I guess that's why my Java cellphone roguelike plays quite ok on most
phones on the market...

--
Björn Bergström
roguelike development [http://roguelikedevelopment.org]
dweller - cellphone roguelike [http://roguelikedevelopment.org/dweller]

Björn Bergström

unread,
May 27, 2005, 5:40:51 AM5/27/05
to

Keep track of the cells on screen that actually have changed. There is
no point in repainting everything if nothing has changed...

> Also is there a way to use the JBuilder graphical designer with user
> created classes?
>

--

ABCGi

unread,
May 27, 2005, 8:02:10 AM5/27/05
to
Björn Bergström wrote:

> Twisted One wrote:
>> Yep. Don't use Java.
>
> I guess that's why my Java cellphone roguelike plays quite ok on most
> phones on the market...

OH MY GOD! WHERE IS THE NEXT VERSION!

Did you notice I have defeated your
previous one? (see old post)

I wasn't going to say anything when
I noticed you were back but this direct
reference is more than I can take!!! :)

--
ABCGi ---- (ab...@yahoo.com) ---- http://codemonkey.sunsite.dk
Fun RLs in rgrd that I have tested recently!
DoomRL - DwellerMobile - HWorld - AburaTan - DiabloRL
Heroic Adventure - Powder - CastlevaniaRL - TheTombs

konijn_

unread,
May 27, 2005, 8:45:14 AM5/27/05
to
<SNIP>

screen in the appropriate direction when an
> arrow key was pressed. While the code was easier to modify, the
> performance of reprinting the entire map was actually slightly slower
> than using terminal. There was also a flickering problem (probably
> a simple buffering thing).
>

Hilarious ;)
The terminal class is a dog on my machine ;)
It does use buffers, so that shouldnt be it,
I didnt do the local update thingy yet, and I do always
update the entire screen with the buffer ( which then again
doesnt get updated completely )

> What are you refering to when you say scrolling support to make it
> faster?

Something like ScreenFactory.scroll( int x , int y ),
which just moves the buffer image around and clears the new area, and
does the same with the console[][] and cconsole[][].

Anyway, any hints on making this faster are more than appreciated.

Cheers,
T.

Nedasa

unread,
May 27, 2005, 3:25:50 PM5/27/05
to
> Hilarious ;)
> The terminal class is a dog on my machine ;)
> It does use buffers, so that shouldnt be it,
> I didnt do the local update thingy yet, and I do always
> update the entire screen with the buffer ( which then again
> doesnt get updated completely )

lol, Something didn't sit right with the flicker/terrible performance.
So I ran thru my code and realized I was reseting the entire screen
each time. My mistake! ;)

anyhow, fixed that and it runs about 5x better than terminal. I'll
probably work with some more, add a few more components so its more of
RL GUI and see if i can improve the performance better with localized
updates, etc

> Anyway, any hints on making this faster are more than appreciated.
>

K, i'll probably post back in a few days when I get a chance to work on
it ;) Although who knows if i'll find any ways to improve the general
performace.

konijn_

unread,
May 27, 2005, 3:48:04 PM5/27/05
to
>lol, Something didn't sit right with the flicker/terrible performance.
> So I ran thru my code and realized I was reseting the entire screen
>each time. My mistake! ;)

Wow. Great. I'll be able to work on one of my roguelikes this week-end
then.

Cheers,
T.

Björn Bergström

unread,
May 30, 2005, 2:21:19 AM5/30/05
to
ABCGi wrote:
> Björn Bergström wrote:
>
>> Twisted One wrote:
>>
>>> Yep. Don't use Java.
>>
>>
>> I guess that's why my Java cellphone roguelike plays quite ok on most
>> phones on the market...
>
>
> OH MY GOD! WHERE IS THE NEXT VERSION!
>
> Did you notice I have defeated your
> previous one? (see old post)
>
> I wasn't going to say anything when
> I noticed you were back but this direct
> reference is more than I can take!!! :)

I have actually started writing code again :-) I haven't had access to a
proper newsserver since the german one that I used started charging
people for access. Lot's of work and a few other things have kept me
away from Dweller as well.

I haven't seen the post you're refering to, but congratulations to your
victory!

I cannot give you a date when the next version will be released
though... have patience!

BR,

0 new messages