Every time I get close to catching up, a new part releases! I look forward to following along with this one soon, too. Thank you!
@Loggog2 жыл бұрын
I'm always so excited when i see a new video on your channel!
@TaariBarungsi2 жыл бұрын
As always nice and informative. Remember to dispose of Graphics2D object when you are done drawing to the BufferedImage(image), since you are creating Graphics2D g2 = image.createGraphics(), unless you dispose it, the resource will stay open. Its something that's easily forgotten.
@RyiSnow2 жыл бұрын
Oops you're right, I forgot about that. I will fix it in the next video. Thank you for pointing that out!
@TaariBarungsi2 жыл бұрын
@@RyiSnow No problem, I have an old computer, hence i always try to save memory as much as I can...
@deepseatrip2 жыл бұрын
@@TaariBarungsi I checked out my memory usage , I was using a 100x100 map and 32x32 tiles. It was pretty high and I have a nice computer , so I cut the map back to 50x50 and it helped a good amount. Ive now upped my tiles from 8x8 >16x16>32x32 and kind of wish I stayed at 16x16 lol but I love the crisp look of the 32x32 and Im too deep with over 200 tiles lol. One thing I noticed with my memory usage is that it consistently climbs and does not stop going up. I haven't really payed attention to this yet cause most the time I am not actually leaving the game running long but this would inevitably cause a crash. I am wondering if yours does the same thing, Ive added some random things like growable plants with a timer , so this probably something I have done or maybe it only significant to me cause tile/maps sizes and assets ive added in game.
@TaariBarungsi2 жыл бұрын
@@deepseatrip Since java uses CPU instead of GPU there is not much you can do about that, but i would recommend you to cut down over-creation of objects inside loops(for/while) and also if you can call on objects only when needed inside game-loop(update,render/draw). Instead of creating a new variable every loop-iteration, create the variables outside of the loop. That way you have a reference to the variable and can change its value instead of creating a new variable n-number of times inside a loop. Think about it for a moment, if you have a reference, you only need to access the memory location of that reference to make changes you don't request the allocation of new memory, but when you create a new variable inside a loop, you allocate memory for that variable and the garbage collector then deletes that variable at the end of a single-iteration and the loop may run for n-amount of times. The memory usage may not be that high for smaller projects but since there are images and drawing involved then surly you would begin to notice the lag. English isn't my language so i hope i explained it in a way that you could understand what i was trying to say.
@deepseatrip2 жыл бұрын
@@TaariBarungsi Thank you, you explained it great!
@OneLatteComingRightUp9 ай бұрын
Hey, Ryisnow! I was looking back and wondered if it was possible to add interactive tiles on the map to avoid confusion. Thanks!
@ProjCRys Жыл бұрын
how do you include the other entities such as NPCs and objects into the map? because if I wanted to display a map with abundance of objects the map looks desolated when it only displays the tiles.
@hatdog23882 жыл бұрын
Wow cant wait to make my own game to enjoy
@JacobBohley Жыл бұрын
So when I try to start the game after implementing the map for the first time, it crashes and sends this error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space I think it's cause my map is too large, cause when I shrink it down it works fine. Right now my map is 341x193. Do you know any way to fix this without changing the map size?
@cristofferostberg1297 Жыл бұрын
I am too getting this error with a 250x250 map.
@cristofferostberg1297 Жыл бұрын
You need to increase the heap memory in your JVM (only a plaster fix, i know, but its working temporarily, atleast) What IDE are you using? In IntelliJ = 1. Go to Help menu in IntelliJ 2. Scroll down to Edit Custom VM Options 3. Paste these lines (or update the existing, if they're lower than Xmx2024m) -Xms512m -Xmx2024m -XX:MaxPermSize=700m -XX:ReservedCodeCacheSize=480m 4. Now your IntelliJ IDE is implemented with more JVM memory for your every project, and you can run the game.
@JacobBohley Жыл бұрын
Yeah I use Eclipse@@cristofferostberg1297
@Jushy_9 ай бұрын
Did you ever figure this out? I'm having the same problem
@JacobBohley9 ай бұрын
@@Jushy_ No I didn't cause I decided to do world size changes as well so map doesn't really work with that anyway.
@Langostaz2 жыл бұрын
Exciting stuff!
@basilbijichirathilattu719311 ай бұрын
I am getting white gaps between the tiles, how do I fix this @RyiSnow ?
@64_bit_coding2 жыл бұрын
When will you implement the load game function? In the title screen video, you mentioned implementing load game
@RyiSnow2 жыл бұрын
It's coming pretty soon. I was waiting until all the data that we need to save/load are implemented in the program.
@64_bit_coding2 жыл бұрын
@@RyiSnow Ok. Thanks!
@su4amp3972 жыл бұрын
Thank you very much!!!
@mightymeet2 жыл бұрын
Hello, I need some help. I have a problem in KeyHandler, where I want the player to move. Can you solve my problem? Thank you
@dumdum70992 жыл бұрын
You are a hero my man
@darkpaladin.2 жыл бұрын
Amazing 👏
@droidlycodes2 жыл бұрын
Can I request how to make tiles clickable with mouse 😁
@MrLoser-ks2xn Жыл бұрын
🥰🥰🥰
@MrLoser-ks2xn2 жыл бұрын
Thanks!
@momagi60392 жыл бұрын
NICE!
@alexanderlara68502 жыл бұрын
Good man!
@deepseatrip2 жыл бұрын
YAY THANKS! If anyone has added new tilesets/maps I Was running into issue where I would get a : Cannot read field "image" because "this.tile[tileNum]" is null at tile.Map.createWorldMap(Map.java:40) at tile.Map.(Map.java:17) at main.GamePanel.(GamePanel.java:83) at main.Main.main(Main.java:17) Took me a second to figure out, but it was because I still had old maps that were not being used with old tilesets but I had not commented/deleted them out yet. Once I commented it worked just fine again.
@D.jerome3872 жыл бұрын
Hey, got the same issue and for me the problem was that there were no indexed tiles at 0,1,2,3,4,5,6,7,8,9 . I filled them in and it worked for me.
@mck1680 Жыл бұрын
Hello! Can you please tell me what you did? Because I have the same error code. I wanna full screen map work and Mini map too
@mck1680 Жыл бұрын
Hello! Can somebody help me? When I am doing Map Screen and Minimap - How to Make a 2D Game in Java #47. I get errors: Exception in thread "main" java.lang.NullPointerException: Cannot read field "image" because "this.tile[tileNum]" is null at tile.Map.createWorldMap(Map.java:40) at tile.Map.(Map.java:19) at main.GamePanel.(GamePanel.java:61) at main.Main.main(Main.java:16). I have checked it and nothing is wrong. So please help me.
@teemukaik Жыл бұрын
You probably don't have maps after 1 or 2?, You should set your maxMap to be same as your mapcount
@drefter4 Жыл бұрын
@@teemukaik ok but where shall I put it? please tell me?
@drefter4 Жыл бұрын
@@teemukaik The error I get when I try to get worldMap. They say Exception in thread "main" java.lang.NullPointerException: Cannot read field "image" because "this.tile[tileNum]" is null
@adnan27349 ай бұрын
@@drefter4 in the GamePanel class, //World Settings, you will see public final int maxMap = something.I matched the map number i have so it fixed.You can press CTRL + left click while pointing maxMap to show its location.