ExFate : sen. Classic Platformer 2D game without using popular game engine

Hey Guys!
This is my first post and its about publication of my first game.

I Couldn’t believe it at first. Java is really capable making a game without any popular game engine.
I want to share some of my story about how i make this game but i couldn’t get it right.
So if u guys want to ask some question about it. Im gonna answer it in this post

You guys can check it here :

https://img.itch.zone/aW1hZ2UvMzI1OTgzLzE2MTYxNjUucG5n/original/iMiA%2BC.png

What unpopular engine did you use? :slight_smile:

well done so far! I’m not sure about the tutorial… I mean attack using which key exactly?
Graphic is nice and a gravity is fine, solid foundation for a platformer.

Btw: an option to mute music in game? Is boring after a while…

@ral0r2 No game engine ???

@Gornova
You can attack enemy when you already level 2 its because it doesnt have anything to attack enemy
there is some neat button on fourth and fifth level its called mute button because the music is too hypnotic and when im working on it im getting dizzy just by hearing it over and over again :-X
(is this thing a spoiler? I put a hint on fourth level there is a mute button)

Yeah the game is boring

  1. no camera shake for more epicness
  2. java arraylist were useful but at the sametime it has a drawback that can lag the game and i couldnt find a solution about that

Topic: ExFate : sen. Classic Platformer 2D game without using popular game engine
@ral0r2: What unpopular engine did you use? :slight_smile: :point:

What exactly is your problem? Did you profile your code (using VisualVM or something)?

You could show us the code that you suspect slows your game down. Arraylist is heavily optimized, it’ll be very fast if you use it correctly.

@cylab
i still dont know. Sometimes, my game cause a little lag and noticable maybe i use too many for loops for spawning particle
but i still dont know is it really the cause or something

@VaTTeRGeR
heres my code gameengine >> http://pastebin.java-gaming.org/507ce277d5b16
heres my code at levela1 >> http://pastebin.java-gaming.org/07ce73d7b561d

I hope you can understand it. because it still a big mystery on why java can cause sudden lag
feel free to ask even more or roast that code ;D

I didn’t experience any lag whatsoever.
That is on an i5-2520M w/ dog slow integrated Intel HD 3000 graphics, 8gig ram and an SSD.

My eyes are still burning from looking at that code but what i can tell you is:

  • Get rid of all System.gc() calls.
  • Clean up your code a bit whole f**king lot. Spacing, indentation, …

I can’t find anything particularly sinful in there and your use of Arrayslist seemed fine tbh.
I noticed you use ArrayList.trimToSize() a lot and also inside tight loops, that’s unnecessary (you don’t gain any speed and maybe a few kilobytes of memory) but what you are doing with the ArrayLists shouldn’t kill your performance.

Just avoid constantly resizing and creating stuff, better pre-allocate a larger array, even if it wastes a few kilobyte in most situations.

If you think collision detection (Iterating over all items in your level) is killing your performance you can use techniques like spatial-partition: http://gameprogrammingpatterns.com/spatial-partition.html

This is especially easy and efficient with a 2d tile based game.

@VaTTeRGeR
Thank you for your attention and your coding advice. 8)

if java have automatic garbage collect system why am i still bother about system.gc()

  • I did this because loading some assets and i was nulling all of my assets i would gain some speeds. but it didn’t do anything relevant to my lag problems.
    So the code was just dumped there

Collision detection was the hardest for me to understand that. So i didnt care about memory back there.
i did focus about bug in there and i call it jumping pogo stick madness.
that wasn’t nice experience but i survived and gave me some big laugh about there when i drop a pillar
I guess thats the joy of game programmer ;D