Author Topic: Creating an entirely new engine from the ground up (Java Project)  (Read 20074 times)

Superjoe224

  • Newcomer
  • Posts: 2
  • Karma: +0/-0
    • View Profile
All right, first off Hi Y'all! I have been a huge fan of rougelikes (angband, Rouge, TOME, POWDER) and similar games (likeDwarf Fortress mainly) and I really REALLY want to make my own preferably in Java (1.6/1.7 hopefully).
I want to make this game from my very own engine, the only problem is I've never created an engine for a rougelike. Now don't misunderstand me, I know how to program (I wouldn't be going to University for it if i didn't know how, but I digress).

Mainly what I would like to know:

1) any GOOD open source code that I can take a look at (preferably one that is not entirely impossible to follow, and also has comments)
2) suggestions on any good Java supplements to creating a rougelike (addons, 'cheats'/shortcuts the like)
   2b) my current IDE is Eclipse 4.2.2
3)Youtube/non-youtube videos on the subject (man, I love watching videos. I used to watch TheCerno program java)

Also I would like to hear from the other developers, their tips and tricks, their 'most common problems' the like. I know it seems like I'm kinda just coming here and demanding these things, but I'm having a hard time locating anything 'useful' from google atm.
Thanks in advance,
Superjoe224

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #1 on: August 23, 2013, 05:30:07 AM »
I think Java is a great choice for RL development. You can easily port things between mobile, desktop and browser. It's good to make your library and design choices now with portability in mind. Here's a list of Java RLs, check them out:
http://roguebasin.roguelikedevelopment.org/index.php?title=Java

Now don't misunderstand me, I know how to program (I wouldn't be going to University for it if i didn't know how, but I digress).
Yeah I thought the same when I was at University :D
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #2 on: August 23, 2013, 06:23:20 AM »
Many people choose Java because it's easy. If you want to see something working quickly, and many people do (because people are impatient), it's pretty obvious that you want to do it in Java. Sure it will give you a great start, but what then? At some point your project will eventually get so complicated that language won't matter anymore. Now assuming that you've been programming only in Java for several years, you will be much less prepared for those problems just because Java programmers are too lazy because Java does everything for them. Let uncle Joel explain this in detail for me. In short: learn C++ first and then maybe write your game in Java (if you still feel the need). Don't make the fundamental mistake and don't choose Java just because it seems to be easy. There aren't any good roguelikes written in Java.
Fame (Untitled) - my game. Everything is a roguelike.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #3 on: August 23, 2013, 07:14:13 AM »
Your hidden point is that someone who hasn't learnt a low level language will have problems with efficient code in high level languages. There is a lot of truth in it. But to religiously tell people to go learn C++ before they code in Java is another thing.  A novice programmer starting a big project in C++ can only lead to disaster (of course it's the best way to learn). If you want to have a chance to actually finish something, I'd say choose and easy language and learn to use a profiler if your code is too slow.

There aren't any good roguelikes written in Java.
Oh that convinced me ;D
« Last Edit: August 23, 2013, 07:18:48 AM by miki151 »
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #4 on: August 23, 2013, 08:14:23 AM »
A novice programmer starting a big project in C++ can only lead to disaster (of course it's the best way to learn)

Yes, you should start from small projects. A novice programmer starting a big project is a disaster waiting to happen, no matter which language he will use. Complexity adds as many problems in C++ as it does in Java, but Java programmers are too lazy and unaware of the evils of the programming world, so that they are unable to deal with those problems.

Quote
If you want to have a chance to actually finish something, I'd say choose and easy language and learn to use a profiler if your code is too slow.

Lack of efficiency is only one problem. Besides, a Java profiler may tell you that a string operation (for example) is slow, but you will never know why until you learn to program in a low-level language.

Quote
Oh that convinced me ;D

Well, let's look at the "Big Five" from the Roguebasin page. All written in C or C++. No Java games. Does that convince you? :P
Fame (Untitled) - my game. Everything is a roguelike.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #5 on: August 23, 2013, 08:56:11 AM »
but Java programmers are too lazy and unaware of the evils of the programming world

If the language doesn't matter, why do you say anything like that? C++ programmers can be "lazy" too, so can it be generalized to all C++ programmers?

About engines, I think there is no reason to create a "generic" engine, because it's almost impossible to know what features a roguelike game requires. However, you can create an engine for a roguelike game with specific features in mind. That way you get firm support for those features which are part of the engine, not just something hacked in quickly.
« Last Edit: August 23, 2013, 08:58:24 AM by Krice »

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #6 on: August 23, 2013, 09:06:09 AM »
If the language doesn't matter, why do you say anything like that? C++ programmers can be "lazy" too, so can it be generalized to all C++ programmers?

If C++ programmers get too lazy, they are punished for that sorely and either retire from real programming or change their approach, work hard and actually achieve something. Of course that does not apply to you because you never make any mistakes, do I need to add?
Fame (Untitled) - my game. Everything is a roguelike.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #7 on: August 23, 2013, 09:10:00 AM »
You mean a lightning bolt strikes you when you do a bad design in C++?  ;D
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #8 on: August 23, 2013, 09:44:20 AM »
You mean a lightning bolt strikes you when you do a bad design in C++?  ;D

Something like that, but less spectacular (and more painful) :). In Java the worst thing that can happen to you is a "Null pointer exception" (Do Java programmers know what is a null pointer, by the way?), but that happens rarely to them, the Java deity is seemingly very forgiving. In the C++ realm, though, a slightest mistake results in a crash. If the C++ god is in a great mood, you only get a one-page-long compiler error which does not differ much from a string of random characters. Needless to say that C++ is a very unfriendly universe. If you want to survive there, you must learn how to code properly.
« Last Edit: August 23, 2013, 09:49:02 AM by TheCreator »
Fame (Untitled) - my game. Everything is a roguelike.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #9 on: August 23, 2013, 10:21:47 AM »
Needless to say that C++ is a very unfriendly universe. If you want to survive there, you must learn how to code properly.

It doesn't work like that. C++ doesn't make you learn anything about good programming. Someone may argue that it's the opposite, because C++ gives the freedom to do things very wrong. Besides whatever the language is really has nothing to do how and why you create the engine.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #10 on: August 23, 2013, 10:41:08 AM »
In C++ in a bigger project you tend to abstract away all the low level stuff into well tested routines anyway. So after a certain point programming in C++ is very similar to programming in Java, with differences only in memory management and all the surrounding technology. And the bugs are pretty similar too, the difference being Java catches them early on, and a C++ program can keep running with corrupted memory.
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com

AgingMinotaur

  • Rogueliker
  • ***
  • Posts: 805
  • Karma: +2/-0
  • Original Discriminating Buffalo Man
    • View Profile
    • Land of Strangers
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #11 on: August 23, 2013, 12:01:33 PM »
There aren't any good roguelikes written in Java.
Yeah, cuz Legerdemain sucks, right? ;)

Anyway, to address the original question: When writing a RL, I think it's quite common to learn from some mistakes in the beginning, having to restart a few times. So I'd say, just start coding and see where it takes you. Some common pitfalls or subtle spots include doors that can be opened and closed, containers, and stairs/portals between levels. Also, be mindful of memory leaks (twice as dangerous in a language with garbage collection, I believe).

I always found this article very inspiring.

As always,
Minotauros
This matir, as laborintus, Dedalus hous, hath many halkes and hurnes ... wyndynges and wrynkelynges.

mrrstark

  • Rogueliker
  • ***
  • Posts: 66
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #12 on: August 23, 2013, 12:06:56 PM »
Quote
There aren't any good roguelikes written in Java.

Lol.

IF there was a performance penalty from Java, a turn based genre like roguelikes are one of the most lenient genres. Most of the time, the CPU is just sitting there waiting for user input.

Usually, the complexity in roguelikes comes from interactions between items/monsters/players, and that has everything to do with the engine structure, and almost nothing to do with the language since you can get more than enough rope to hang yourself in both Java and C++.

I code professionally in C/C++, and code in Java/Python/anything else at home to relax...

Finally, I've been using this Java based framework: libGDX http://libgdx.badlogicgames.com/
Easily ports to Android and other platforms.

TheCreator

  • Rogueliker
  • ***
  • Posts: 370
  • Karma: +0/-0
    • View Profile
    • Fame
    • Email
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #13 on: August 23, 2013, 12:27:42 PM »
It doesn't work like that. C++ doesn't make you learn anything about good programming. Someone may argue that it's the opposite, because C++ gives the freedom to do things very wrong.

If you do wrong, you will be punished, like I said before ;). That's the best learning method ever invented (unless you like to be punished, of course). I wouldn't call that freedom. Otherwise North Korea is a free country.

And the bugs are pretty similar too, the difference being Java catches them early on, and a C++ program can keep running with corrupted memory.

No, a C++ program can't run with corrupted memory. Sometimes it will (notably when it is a debug version), but most of the times it will simply crash sooner or later. It's Java what tends to keep running even when there are serious bugs in the code. So the difference is that C++ programmer will notice and fix a bug quickly, while Java programmer will never learn what some of his bugs really are, because too much is done under the hood. He will either ignore the problems or get discouraged and drop the project. Isn't that what happens to Java roguelike games?

IF there was a performance penalty from Java, a turn based genre like roguelikes are one of the most lenient genres. Most of the time, the CPU is just sitting there waiting for user input.

I wasn't talking just about performance (but the truth is that Java is really talented at slowing everything down, even a turn-based game). Honestly, I don't know why complex Java games do not succeed. I'm only presenting my hypotheses here.

I code professionally in C/C++, and code in Java/Python/anything else at home to relax...

That explains much. I code professionally in C++ (and sometimes in Java) and code in C++ at home to relax ;).
Fame (Untitled) - my game. Everything is a roguelike.

miki151

  • Rogueliker
  • ***
  • Posts: 264
  • Karma: +0/-0
    • View Profile
Re: Creating an entirely new engine from the ground up (Java Project)
« Reply #14 on: August 23, 2013, 12:48:19 PM »
No, a C++ program can't run with corrupted memory. Sometimes it will (notably when it is a debug version), but most of the times it will simply crash sooner or later. It's Java what tends to keep running even when there are serious bugs in the code.
So can or can't it? I've had C++ programs successfully finish and return results that are bogus and even non deterministic because of memory corruption. An uninitialized pointer that accidentally points to a valid address is enough.

On the other hand, please educate me how a Java program can run with a bug that C++ would catch early on.

That explains much. I code professionally in C++ (and sometimes in Java) and code in C++ at home to relax ;).
I code (or have coded) professionally both in C++ and Java, so I'm smarter than both of you  :P
KeeperRL, Dungeon Keeper in roguelike style:
http://keeperrl.com