Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (756)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Looking for 'professional' indie game-code to read.  (Read 3619 times)
0 Members and 1 Guest are viewing this topic.
Offline AvivC

Junior Devvie


Projects: 1



« Posted 2014-03-22 11:29:15 »

I am an intermediate Java programmer, and a beginner game developer. I created a number of simple games, with simple AI and game mechanics.

I'm looking for some source code to read, in order to get a feel of what more 'professional' source code looks like, and what more 'professional' game and application structure looks like.

The code should be:

A) Understandable. Nothing that is too hard to follow.

B) "Common". I want the code to use common ideas and practices, nothing "revolutionary", because I want to get a feel of what game code 'commonly looks like'.

C) Doesn't rely too much on a library or engine that I don't know. Basically currently I'm only familiar with Java2D and Swing. The code of course can be using different libraries (and most probably would), but I don't want it to rely too much on the specific library, so I'll be able to understand it.

D) Preferably 2D game.

E) Not too big and not too small.

I want it to be a good 'first introduction' to some 'professional' indie code, so I'll get a feel of what it looks like, and how the game and app are structured.

Thanks
Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #1 - Posted 2014-03-22 11:36:55 »

Not a lot of big indie developers tend to release code, especially if it as original game.

However, there is the super jumper, open source game made by the creator of LibGDX:

Source

Or, if you want to see something truly "amazing", download minecraft and decompile it using the forge thing. However to my understanding, a lot of minecraft is still old code and terribly written but look into some of the new stuff, recently changed stuff. Check out the forums for that info, I think recently it was audio/sounds and how it was loaded.

However, do this at your own discretion, I am pretty certain that developers do not appreciate others ripping their games down and checking out the code...but in the name of learning, those people can go f**k themselves.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline nsigma
« Reply #2 - Posted 2014-03-22 11:40:07 »

Not a lot of big indie developers tend to release code, especially if it as original game.

But luckily we have people like princec!  Grin

http://www.puppygames.net/blog/?p=914

Praxis LIVE - hybrid visual IDE for (live) creative coding
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline AvivC

Junior Devvie


Projects: 1



« Reply #3 - Posted 2014-03-22 11:45:30 »

Thanks both of you Smiley Which one of the two games you mentioned better suits what I asked? (Be understandable, 'common', doesn't rely too much on some library, etc).
Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #4 - Posted 2014-03-22 11:51:34 »

Thanks both of you Smiley Which one of the two games you mentioned better suits what I asked? (Be understandable, 'common', doesn't rely too much on some library, etc).

The link by nsigma, that game is legit. Even so, both would be fine to look at for the simple fact both games are very well polished and Super doodle jump is actually on android and is literally a famous game. Here in Scotland when you go to arcades, they have a super jumper machine, just for that game.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline Opiop
« Reply #5 - Posted 2014-03-22 14:28:28 »

Just as a side note, indie developers are not automatically better coders! I don't know if that's what you think, but some developers can write absolutely crappy code and still become famous because the player only cares about the end result, not the code! You also should develop your own code style instead of copying someone else's, believee its a really good idea to do it early on! Although there are conventions and some basic structures most programmers follow, it doesn't mean you can't branch out and do something different, most everyone does it!

Good luck Smiley
Online Longarmx
« Reply #6 - Posted 2014-03-22 14:58:05 »

Or, if you want to see something truly "amazing", download minecraft and decompile it using the forge thing. However to my understanding, a lot of minecraft is still old code and terribly written but look into some of the new stuff, recently changed stuff. Check out the forums for that info, I think recently it was audio/sounds and how it was loaded.
Don't even bother with this. This breaks points a, b, d, and e in the op. Plus, Minecraft code != amazing.

@Reffering to your point c, there are very few games in comparison that use Java2D. I would recommend learning an OpenGL based wrapper/library/engine. LWJGL, JogAmp, Libgdx, and JME are all good examples of this. There are example games on the wikis of these respective projects along with some nice tutorials that can help you out.

Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #7 - Posted 2014-03-22 15:04:51 »

Or, if you want to see something truly "amazing", download minecraft and decompile it using the forge thing. However to my understanding, a lot of minecraft is still old code and terribly written but look into some of the new stuff, recently changed stuff. Check out the forums for that info, I think recently it was audio/sounds and how it was loaded.
Don't even bother with this. This breaks points a, b, d, and e in the op. Plus, Minecraft code != amazing.

Hence why I quoted amazing, sarcasm is hard to imitate over a keyboard.

Minecraft code is terrible, however terrible code does not mean terrible game. That was why I mentioned it.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 167
Projects: 5
Exp: 6 years



« Reply #8 - Posted 2014-03-22 16:21:35 »

Why is minecraft code bad now?

@OP I think you'll get further learning from specific tutorials rather than full games. Obviously full games are a lot of source code, and it'll take longer to understand that than if you have a tutorial of some sort. Also, game and app structure are really dependent on the game sometimes, so the same structure for your game may not be optimal. I'm not saying not to look at these game source codes, but don't rely on it as your main learning source.
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2014-03-22 16:51:39 »

Most "professional" stuff is terribly coded. Revenge of the Titans especially so, and I bet Minecraft is abysmal too. The reason is because we are focused on actually finishing something than doing fancy engineering and making things pretty, readable, or understandable beyond getting the product out there.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline AvivC

Junior Devvie


Projects: 1



« Reply #10 - Posted 2014-03-22 17:55:00 »

Most "professional" stuff is terribly coded. Revenge of the Titans especially so, and I bet Minecraft is abysmal too. The reason is because we are focused on actually finishing something than doing fancy engineering and making things pretty, readable, or understandable beyond getting the product out there.

What you're saying is interesting. Let me see if I get something.

The reason why people work hard and study hard to learn how to code clean, readable and maintainable code, is because at the end, it's supposed to increase your chances of creating software with few bugs. The idea is that clean readable code means better chance for good software (of course, that's only part of it). It will be easier to maintain, debug, and code further.

And you're saying that "most 'professional' stuff is terribly coded", and that's because "we are focused on actually creating something rather than doing fancy engineering", etc.

This means that clean code doesn't help with creating good software.
Am I understanding correctly?
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 485
Exp: 7 years



« Reply #11 - Posted 2014-03-22 18:04:40 »

Different situations, at least somewhat.

In enterprise programming, clean, easily-maintainable code is important because it will likely need to be maintained for a long time (years, maybe decades), and many people will be working on it, so you can't write everything in that horrible weird way that only you can understand.

In gamedev (especially indie), the maintenance aspect is greatly reduced (although some parts are long-lasting, e.g. core engine to be used for multiple games, multiplayer servers, etc. These are also often supplied as a 3rd party library for these exact reasons), eventually you will simply move on the the next game, yes you might be pushing updates, but it's not going to be (well hopefully not) a complete overhaul or product revision. Also there are fewer people that need to work on it, and they are usually tighter-knit. (Again, this goes especially for indie development)

Gamedev is heavily effected by deadlines, enterprise by maintainability over many product iterations. Respective codebases tend to reflect that.

Quote
This means that clean code doesn't help with creating good software.

You have to define "good software." It may be good because it's cleanly coded, or it may be good because you got it released on time. Ideally, it would be good because you did both.
Offline atombrot
« Reply #12 - Posted 2014-03-22 18:13:06 »

We learned it like this. In a perfect world with an unlimited amount of time and budget you can write perfect code. The thing is, both time and budget is limited. So you have to take shortcuts.

I've worked with people that were geniouses in their field, but they never managed to complete a project on budget, because something in the code was always badly engineered (even though it was working completely ok) and they had to fix it. A friend once got a week of work thrown out of source control, because our architect thought "It just doesn't feel right", without having any specific reason why.

It makes me cringe a little to not go the clean way, but sometimes you have to sacrifice clean code for getting a project done. The problem is that most customers (or players in games) don't really care how nice the code is. They just want that damn thing to run.
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #13 - Posted 2014-03-22 18:54:46 »

For the most part, I agree with the people in this thread.

Learning how to write professional code off of games, and seeing how others write code in games is going to vary by developer. What is worse is that you'll not be seeing the best code available, at least professionally.

There is a few options, though, I'd suggest actually looking for games that are open source. Sometimes, they are forced to write code a bit more readable than other projects since, they are actually trying to get people to join their coding projects. Scouring open source repositories like Github and Sourceforge for gaming projects will give you a large pool of gaming code to look at. Especially if you are just looking for how people structure code overall.

The other way is just to code like they do in tutorials and demos. The Java tutorials has some of the best written code when it comes to how to organize Java in a readable way. If you want to learn how to write code in the most beautiful way possible, then just emulate the tutorials.

From my experience

It is double work. First, you have to make the code work... then you have to make it readable and organized. The shorter the code is, the better it runs. The more you make things readable, the bigger your overall program gets. It is just inefficient to make things 100% readable. I usually strike a balance between both. For modules, I usually have it slightly unreadable but I work in the readability by having descriptive comments. For stuff that other people have to read, I usually write variable names that tell people what things do, and separate the code into readable functions.

It is a style thing. When you begin to code games, you'll realize that readable code will short circuit your productivity. You'll fail to make your prototype, and you'll learn. Game making requires a balance between rapid prototyping, and... more rapid prototyping.

Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2014-03-23 11:06:08 »

There is a balance. We all start off with the best of intentions, and then... we need to get it finished.

Enterprise code is probably the worst for it. So elegantly over-engineered, usually, that most of the time nobody knows how it works anyway. But it can look quite pretty. It rarely works very well. Most of the worst code I've come across is from my days as an enterprise developer. I'm proud to say mine was some of it Smiley

Cas Smiley

Offline KevinWorkman

« JGO Plugged Duke »


Medals: 283
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Reply #15 - Posted 2014-03-26 18:19:28 »

Shameless self-promotion: There are a bunch of simple open-source games done in Swing and Java2D at Static Void Games!

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Offline gouessej
« Reply #16 - Posted 2014-03-26 19:06:19 »

nothing "revolutionary", because I want to get a feel of what game code 'commonly looks like'.
Then don't look at my source code  Grin

I'm joking a bit of course, I like very long ... variable names, you see what I mean.

Julien Gouesse | Personal blog | Website | Jogamp
Pages: [1]
  ignore  |  Print  
 
 

 
DesertCoockie (53 views)
2018-05-13 18:23:11

nelsongames (84 views)
2018-04-24 18:15:36

nelsongames (75 views)
2018-04-24 18:14:32

ivj94 (760 views)
2018-03-24 14:47:39

ivj94 (88 views)
2018-03-24 14:46:31

ivj94 (644 views)
2018-03-24 14:43:53

Solater (103 views)
2018-03-17 05:04:08

nelsongames (185 views)
2018-03-05 17:56:34

Gornova (427 views)
2018-03-02 22:15:33

buddyBro (1087 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org 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‑gaming.org
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!