Red Game 2D Engine (redone!)

https://raw.githubusercontent.com/matanui159/Red-Game-2D-Engine/master/logo.png

I have recently been redoing my 2D game engine as there where many problems with it… But this one is much better (I swear :persecutioncomplex: )…

I haven’t got any demo or pictures (except the one above) but I will be working on that…

FEATURES: https://github.com/matanui159/Red-Game-2D-Engine/blob/master/README.md#features
SOURCE CODE: https://github.com/matanui159/Red-Game-2D-Engine

Any positive feedback will be great, any negative feedback will be helpful…
If you find any problems, I will attempt to fix them to the best of my ability…

Sorry it is not much yet… at the moment it is only a simple renderer, entity system, sound system and input system along with a set of utilities…

Thx in advance…

Can I please get some feedback on this? I really need it at this point…

I fixed the images…
What more information do you want?
I just want feedback on the ideas…
I don’t want to release anything yet although I might release it later for people to mess around with…

A few questions,
Is there a public source code repository?
What renderer are your using, Java2D, OpenGL, JavaFX …? My bad, didn’t read that part of the post
Can I have the source to your text rendering class, I was thinking of implementing that into my engine.

Thanks in advance!

Java experience: 10-12 months
Coding experience: 2 years

and you are writing an engine ?
GOOD experienced programmers use and rely on engines, so the engine should be top notch

It’s just hard to be supportive, even if you do a great job all things considered

experience != knowledge. People rely on engines, yes. But that doesn’t mean it has to be 100% bug-free and completely polished. This could be just a little engine he’s making to test his programming knowledge. He’s probably not expecting it to make the new Call of Duty.

Either way, I can’t really give feedback without the source code.

EDIT; Also OP, use [.img width=X] to resize a picture, (800 is great).

I will release the source code soon on Github but for security sakes I want to have a license on it first…
I’m not really good with this part (too much stuff complicated stuff… why can’t things be like the DBAD licence… :slight_smile: )… All I want is a general license which states that people cannot make it their own… Does anyone have any suggestions?

Also, I would want to release this when it is finished along with my website I am working on… I don’t really care if it gets popular but I will use it for my 2D games and maybe in the future I’ll make a 3D game engine…

One more thing…

I don’t think you would want my text rendering class… It is very bad because instead of rendering all the letters of a font onto an image (which is faster and what your supposed to do)… I just render the text itself onto an image…

I will fix the images…

Thx for the feedback

Also, just a note… the ‘CODE SNIPET’ image above is not a code snipet of the game engine but a code snipet of the test game (GENERAL PICTURE) I made in the engine to show an idea of how it works…

But for a better idea… here is a simple program:


import rg.core.Sprite;
import rg.core.World;
import rg.input.Input;

public class Main {
	public static void main(String[] args) {
		World.add(new Player());
		World.start();
	}
	public static class Player extends Sprite {
		private static final long serialVersionUID = 0;
		public Player() {
			super("img/player/red.png");
		}
		public void start() {
			set(World.getWidth() / 2, World.getHeight() / 2);
		}
		public void update() {
			turn(Input.getAxis("left", "right") * 300);
			move(0, -Input.getAxis("down", "up") * 500, angle);
			loop(-100, World.getWidth() + 100, -100, World.getHeight() + 100);
		}
	}
}

This program turns the ship using the left and right arrow keys and moves the ship using the up and down arrow keys then loops it around the screen…

Any questions? Just ask and I shall answer…

I found this very helpful website and I think I might chose the GPL v3 license…
Again, I don’t really know much about this so some help would be nice…

But, help or no help, I’ll release the code through github under that license (or another one if I change my mind) tomorrow…

Source code released!
https://github.com/matanui159/Red-Game-2D-Engine

Plz give feedback

Thx in advance…

Ie

Fist impressions :

  • Camera is a Sprite, which is confusing to me
  • Reflection is not neccesary to have an events system
  • Having a static world class “where everything goes” is bad because it makes decoupling different components of a game very difficult.

The camera is a sprite which doesn’t draw anything… I just like using sprites because that is the core of the engine…
I’m using reflection for the events system to call the methods in the sprites (if they exist)…
You can group sprites by changing the ‘name’ attribute of the sprite and getting all of the sprites with a certain name using:
World.getAll();

The camera sprite idea is honestly a terrible design choice. A sprite, by definition:
“a computer graphic that may be moved on-screen and otherwise manipulated as a single entity.”

The camera is NOT sprite, and should not be allowed to behave like a sprite. The camera is a special component; its not an entity or a sprite. Its not rendered, and in fact it doesn’t do any of the rendering. The camera is simply a way to determine what is, and what isn’t inside the frustum and projecting vertices onto the screen using matrix math. Cameras do not move, there is no such thing as a camera. The geometry moves within the window.

I agree with saucymeatman when he says having a static world is a bad decision. There’s no issue with having the user create a world object. A static implementation just confuses everything and makes stuff way more complicated then it should be.

Honestly? I think your library needs a lot of work to make it more user friendly, and you need to research design templates. There’s a reason programmers use the same code templates, they work well and do their job.

I also have an issue with getting components using a string. There’s just something very wrong about that, use getters.

Keep it up though! Don’t expect a lot of feedback from such an early version of your library though. People already have the libraries they need, breaking into the game engine/library market is hard unless you are very good at your job.

The sprite is something which does something, it does not need to draw anything
I named it a sprite because the only other two names I could think of were:

  • Object, which is already in Java
  • GameObject, which would sound like I am copying Unity

So I named it sprite…

Also, my main idea for this engine is similar like Game Maker (or other engines), where you tell an object what to do and it will do it when you add it, but in a code kind of idea…

It probably won’t become that major but I still like the idea of it and I find it easier then other engines…

I’m trying to tell you there are standards and terminology for the stuff you are doing.

I know this is a personal project, but if you ask for advice and throw your library out there, then you have to use the correct terminology so everyone knows what you are talking about. Creating a camera from a Sprite base class makes absolutely no sense in the game development world.

You say you don’t to name it GameObject because you are going to sound like you are copying Unity, I say that’s a silly thing to worry about. Don’t worry about what other libraries or engines name their classes or else you will never have names for anything.

Do research on the correct terminology before doing anything else, and restructure your library so that the camera is not a child object of Sprite. I mean, come on you draw the player with the Sprite class. How does that even make sense? Player and Camera extending from the same base class? They share almost none of the same functionalities.

I can see where u r coming from, I agree that it doesn’t make sense…

But other than that one problem, how do u think it is?

Agree.

I thought the same when reading: [quote]The good thing with using reflection is that other people can add their own events and just add the methods to all the sprites which they want to catch the event.
[/quote]
Number one (or two? :wink: ) rule in programming: don’t reinvent the wheel. If you have an idea how to do stuff I would recommend to first do an intense online search that could match the concept you were thinking about. Often you will encounter some great library that does exactly that what you wanted to achieve. I’ve been there many times.

So maybe for your event system you could just use Google’s EventBus? Always try to minimize the complexity of your own code.

For feedback to your code: I just scanned a few of your classes on GitHub. Overall they look clean and nicely documented. I can’t give feedback on the implemented logic at this time. I didn’t try out the engine, but I would recommend you put up some tech demos for people to easily look at. (Or do you have already and I didn’t see them?)

Ad “sprite” debate: Just name it “entity” :wink: Everything can be an entity. And the component-entity-event approach (http://en.wikipedia.org/wiki/Entity_component_system) is something I personfits most games the best.

All the best for your engine! I hope I could give some good input.

I don’t like other libraries unless I have no idea how to make one…
That is why I made a game engine and, in my opinion, I thought it went pretty well…
But that is why I don’t really search up that kind of stuff to find another person’s library…
Anyways, some people say this is the number one rule in programming and others say that is the number one rule in programming… Ie, my number one rule in programming is ‘K.I.S.S. (keep it simple stupid)’…

But thx for the feedback and I might change it from ‘Sprite’ to ‘Entity’

EDIT: no I don’t have any tech demoes (other than those pictures, but that isn’t that much of a game) but I may make some in the future…

Hey I didn’t want to sound like I’m the one who knows the “one true path”. I’m sorry if I put it accross this way.

I also put this " ;)" because I know it is not THE number one rule. For me personally I think it is a good rule. I like your KISS approach. It’s also a really important one I believe. Another great rule that is definitely in my top 10 or even top 5: DRY (don’t repeat yourself) Strictly following this principle saves you a lot of time in the future (especially when you are maintaining your code later on)

But one more thing about writing everything on your own: Good libraries (used by a lot of users, long living) usually went through lots and lots of iterations where bugs got fixed, performance got improved and so on. If you decide to implement a well-known concept on your own you will end up fixing a lot of bugs, improving performance, … - energy that other people have already invested.

Also if you are using the JDK, you already use a lot of other people’s implementations and libraries. :wink:

But I do believe that you should do what you think is best.

I know that other things are bug free, but something like calling a method using reflection doesn’t really have that many bugs…

Also, I did note out that I like too make my own if I can and something like JDK isn’t really something I can do…

Finally, I wasn’t trying to make u sound like (and I quote [literally])…

It is just that with text, u can’t really hear the tone of their voice. Someone could just point something out and people might think they are angry…

Again, thx for the feedback…

Ps. Yes, I do put a lot of '…'s everywhere… I’m not being creepy, exaggerated or anything else, I just do it a lot for some reason… I don’t know why tho… … … … …

Pps. Another one of my fav rules which I made up is ‘make it fast or make a loading bar’… In other words, make something happen fast or give the user something which tells them it will take a while. This is more of applications rather then games but it is still good to remember