Open JustGregory-zz opened 9 years ago
Thanks for issue I wasn't the best at handling them back then but thanks anyway :)
There is a new tutorial about it
there are in general a couple of more suggestions that I as a professional enterprise developer can give you. One of them is to avoid static finals, and instead go for a lazy singleton holder/creator pattern. Mainly because I see that Game for example is a singleton object, EntityHandler is a singleton object and some other classes also have the same signature. An object with mutable state. Another suggestion is to use lombok, because I see two things, either you are missing a get or you are missing some variable in the constructor. Lombok will give you time to think about the code and forget about the boiler plate stuff. No more getters and setters! (well implicitely of course).
Hello, thank you for spotting these things. I have realised that the code is terrible, and needs redoing, which I might do at some point. I just don't have much time on my hands at the moment which makes development very hard.
Thanks
Contact details Skype: tommohawkaction
Sent from Outlookhttp://aka.ms/Ox5hz3
On Wed, Nov 25, 2015 at 12:27 AM -0800, "Jarl André Hübenthal" notifications@github.com<mailto:notifications@github.com> wrote:
there are in general a couple of more suggestions that I as a professional enterprise developer can give you. One of them is to avoid static finals, and instead go for a lazy singleton holder/creator pattern. Mainly because I see that Game for example is a singleton object, EntityHandler is a singleton object and some other classes also have the same signature. An object with mutable state. Another suggestion is to use lombok, because I see two things, either you are missing a get or you are missing some variable in the constructor. Lombok will give you time to think about the code and forget about the boiler plate stuff. No more getters and setters! (well implicitely of couse).
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159532968.
Btw, do take a look at my Tile-Game project on github. I have added sprite animations with best practices ;) so now I can move around with adws keys and the sprite changes with left right leg continously ;) took a loooong time to get it up and working since I am noob in game devving. Luckily not so noob in java so I found it out ;) Its made with sbt, but I think you can basically just copy the source into yours or make an eclipse project from sources
If you need help with anything just let me know, I am currently learning unity c# but I have 2 years of game engine dev and gameplay in Java, so any questions just let me know
Sent from Outlookhttp://aka.ms/Ox5hz3
On Wed, Nov 25, 2015 at 5:20 AM -0800, "Jarl André Hübenthal" notifications@github.com<mailto:notifications@github.com> wrote:
Btw, do take a look at my Tile-Game project on github. I have added sprite animations with best practices ;) so now I can move around with adws keys and the sprite changes with left right leg continously ;) took a loooong time to get it up and working since I am noob in game devving. Luckily not so noob in java so I found it out ;)
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159605219.
If you know the answer it would be nice to know the general concept of switching screens. I am thinking about lazily creating the screens that can be entered in a 2d world. Lets say a castle that when you walk up to it you enter another screen, with its own layout, preferably as a dungeon style thingy. I have to keep a global game state, with players health (maybe), player assets, quest line (maybe? advanced. .) et cetc ... i think switching screens is easy. the global state is difficult. any directions, good tuts on this?
I have made a tutorial about screens, if you have followed my tutorial series, all you would need to do is create a new object which extends Screen (don't forget to override the methods)
and then use the static class called ScreenHandler to change the screen e.g ScreenHandler.setScreen(screenObject);
Hope that helps
From: Jarl André Hübenthal notifications@github.com Sent: 25 November 2015 18:07 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
If you know the answer it would be nice to know the general concept of switching screens. I am thinking about lazily creating the screens that can be entered in a 2d world. Lets say a castle that when you walk up to it you enter another screen, with its own layout, preferably as a dungeon style thingy. I have to keep a global game state, with players health (maybe), player assets, quest line (maybe? advanced. .) et cetc ... i think switching screens is easy. the global state is difficult. any directions, good tuts on this?
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159690244.
Btw ScreenHandler is a class that we created, it is not a class which is already there
From: Jarl André Hübenthal notifications@github.com Sent: 25 November 2015 18:07 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
If you know the answer it would be nice to know the general concept of switching screens. I am thinking about lazily creating the screens that can be entered in a 2d world. Lets say a castle that when you walk up to it you enter another screen, with its own layout, preferably as a dungeon style thingy. I have to keep a global game state, with players health (maybe), player assets, quest line (maybe? advanced. .) et cetc ... i think switching screens is easy. the global state is difficult. any directions, good tuts on this?
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159690244.
I managed to change my tilegame to detect a collision with a dungeon tile and then change screen to a dungeon screen. The same player is used across all screens. In effect that means that this player entity can house points or health or whateva. I renamed Game to Plains. So there is no concept of a Game object anymore. So I am wondering if I should keep the game state in the player object.
try to run my project now. Quite simply just download the jar file from the dist folder and java -jar run it. It requires java 8 though. But thats the newest Java anyway so. Or double click it.
Hello, I have attempted to try out your game, however after putting it into eclipse I had to add getters and setters and I have noticed that you have used LomBok. So it didn't work even after fixing all the errors.
I do not recommend using LomBok for such a simple bit of code like getter and setters, as LomBok will create horrible errors as I have just experienced. You should consider writing them out in Eclipse as Eclipse has some really good ways of handling that for you.
Regards
Tom
From: Jarl André Hübenthal notifications@github.com Sent: 25 November 2015 22:21 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
I managed to change my tilegame to detect a collision with a dungeon tile and then change screen to a dungeon screen. The same player is used across all screens. In effect that means that this player entity can house points or health or whateva. I renamed Game to Plains. So there is no concept of a Game object anymore. So I am wondering if I should keep the game state in the player object.
try to run my project now. Quite simply just download the jar file from the dist folder and java -jar run it. It requires java 8 though. But thats the newest Java anyway so.
https://github.com/jarlah/Tile-Game
[https://avatars2.githubusercontent.com/u/404102?v=3&s=400]https://github.com/jarlah/Tile-Game
jarlah/Tile-Game Tile-Game - Tile Game 2D Read more...https://github.com/jarlah/Tile-Game
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159744656.
I get the point. I am currently working on a level editor system with one line for each horizontal group of tiles, stored in a plain file. So I'll propably remove the lombok stuff together with that work. Its just for convenience. I have been using it for two years constantly and its tedious to and VERY error prone to create all those getters/setters/constructors by hand. If its problem with lombok you can easily download lombok from https://projectlombok.org/downloads/lombok.jar and double click to execute which will give you a nice gui for locating the eclipse installation and patching it.
But as I said Ill most propably remove it for the sake of open source ;)
2015-11-26 21:00 GMT+01:00 tommohawkaction notifications@github.com:
Hello, I have attempted to try out your game, however after putting it into eclipse I had to add getters and setters and I have noticed that you have used LomBok. So it didn't work even after fixing all the errors.
I do not recommend using LomBok for such a simple bit of code like getter and setters, as LomBok will create horrible errors as I have just experienced. You should consider writing them out in Eclipse as Eclipse has some really good ways of handling that for you.
Regards
Tom
From: Jarl André Hübenthal notifications@github.com Sent: 25 November 2015 22:21 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
I managed to change my tilegame to detect a collision with a dungeon tile and then change screen to a dungeon screen. The same player is used across all screens. In effect that means that this player entity can house points or health or whateva. I renamed Game to Plains. So there is no concept of a Game object anymore. So I am wondering if I should keep the game state in the player object.
try to run my project now. Quite simply just download the jar file from the dist folder and java -jar run it. It requires java 8 though. But thats the newest Java anyway so.
https://github.com/jarlah/Tile-Game
[https://avatars2.githubusercontent.com/u/404102?v=3&s=400]< https://github.com/jarlah/Tile-Game>
jarlah/Tile-Game Tile-Game - Tile Game 2D Read more...https://github.com/jarlah/Tile-Game
Reply to this email directly or view it on GitHub< https://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159744656
.
— Reply to this email directly or view it on GitHub https://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-159986593 .
Mvh, Jarl André Hübenthal
Hi again :)
Take a look it should work much better than before now. Fully static level definition, much better than random ;) If i want random I can make 10 different plains and random between them ;)
if you hit an ogre you will see "Whoaa (...)" in the console. if you go to a dungeon (there is only one) you will enter a black todo screen.
So I "think" I have grasped what I need to know before I can begin to sketch how my game should work now.
Takes some seconds to load. I wonder if I should make a loading screen soon.
do you have any idea why this game does not work for java 7? Maybe its my build system, but its plain java. Even from eclipse the exported runnable jar will look crazy if compiled with java 7.. player is moving around incredibly fast.
After converting your project into eclipse, I have finally got it to work, and yes it looks nice.
From: Jarl André Hübenthal notifications@github.com Sent: 27 November 2015 09:51 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
do you have any idea why this game does not work for java 7?
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-160099746.
A few suggestions. · Issue #1 · tommohawkaction/YoutubeTileGame Hello. I've been watching your tutorial series, as I've been watching a lot of Java programming video series lately. I've been developing in Java for quite some time now, so I do have some experien... Read more...https://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-160099746
+1
Ironically I just pushed the following changes while i saw your email :D
Still havent got to make a game of it yet.
Btw, the kindle book "Killer game programing in Java" just made me cry to read after learning from you. It seems that this dude starts off with something that is not an accepted way to do main thread. So i just stopped reading it in fear I would be brainwashed.
Haha the Killer game programming book for java, is building everything from scratch.. The Cherno Project has some good tutorials on Game Programming for Java.
However what you have to notice is that Java isn't that powerful for gaming, if you really want to make games/engines for java I suggest you have a look at some open gl tutorials using LWJGL
I am thinking about doing some tutorials on these using modern open gl
If you want help at all just let me know
Skype: tommohawkaction
From: Jarl André Hübenthal notifications@github.com Sent: 27 November 2015 19:33 To: tommohawkaction/YoutubeTileGame Cc: tommohawkaction Subject: Re: [YoutubeTileGame] A few suggestions. (#1)
+1
Ironically I just pushed the following changes while i saw your email :D
Still havent got to make a game of it yet.
Btw, the kindle book "Killer game programing in Java" just made me cry to read after learning from you. It seems that this dude starts off with something that is not an accepted way to do main thread. So i just stopped reading it in fear I would be brainwashed.
Reply to this email directly or view it on GitHubhttps://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-160194106.
A few suggestions. · Issue #1 · tommohawkaction/YoutubeTileGame Hello. I've been watching your tutorial series, as I've been watching a lot of Java programming video series lately. I've been developing in Java for quite some time now, so I do have some experien... Read more...https://github.com/tommohawkaction/YoutubeTileGame/issues/1#issuecomment-160194106
Hello. I've been watching your tutorial series, as I've been watching a lot of Java programming video series lately. I've been developing in Java for quite some time now, so I do have some experience to share. This isn't so much an 'issue' so much as some (hopefully) acceptable hints for your coding.
I've noticed that in classes with two constructors to instantiate the same things, a lot of duplication of code is taking place. This example:
the first constructor can be streamlined to merely throw the parameters to the other constructor, with an invocation to a new Vector2f object:
In other places, you have a field initialized to
null
, then set it to a value in the constructor. For example, in thePlayer
class, for theTexture
instance:but texture is not modified anywhere after instantiation. Why not simply drop the " = null" part of the field declaration, and make the field
final
? A few of your classes could use similar cleanup, wherever the fields are instantiated in a constructor, but not changed in the class itself.