Coder Social home page Coder Social logo

vrekt / lunargdx Goto Github PK

View Code? Open in Web Editor NEW
50.0 4.0 1.0 432 KB

A networking library for LibGDX utilizing Netty allowing easy creation of multiplayer games.

License: MIT License

Java 100.00%
netty libgdx libgdx-game java-game-dev java java-netty networking-library multiplayer multiplayer-game multiplayer-game-server

lunargdx's People

Contributors

vrekt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

coinarcade

lunargdx's Issues

ISAAC Cipher for packets

This network infrastructure reminds me of RuneScape private server designs. I would suggest the ISAAC Cipher for packet security if that's something you're interested in. I also remember RuneScape used RSA for username and password encryption as well, so another thing to look at. Not really an issue, but a suggestion.

Clean this project up

My brain is broken so I always have the urge to redo a project that is perfectly fine. Regardless, I want this project to be less confusing.

The wiki is pretty good but...

The protocol needs to change and authentication. It's very dirty and not practical at all. You can customize all that but it just seems like alot.

Worlds need to change I think. The way entities and players are handled with the spawning system doesn't allow easy switching between worlds and instances.

Entities are very fleshed out but its still missing some things with context switching.

The way worlds and interiors work is just its hard to implement and manage, I need something different. I think the system with being able to implement your own extended entities is good but sometimes it doesn't always work and causes casting errors.

The server needs a heavy rewrite, it was never a focus point and it should have been. It works but its very barebones.

Instances

Instances within Lunar describes an interior that is networked. For example rooms, interiors, dungeons, etc. They exist within a world.

As such a few issues come up:

  • worldFrom should it still be loaded and receiving/updating data?
    • If not, when entering the instance it could be slow to load back in. This could be combated with a loading screen but may not be desirable.
  • Should probably intiliaze a new LunarWorld but a very barebones implementation to prevent too many resources being used from a simple interior.

Client Design

  • Simple implementation of LunarWorldSkeleton.
    • Separate box2d world and entity/player lists.
    • worldFrom should probably stop updating itself while in interior, implement some kind of lock/pause state for that.
      • (unless desired)
    • Network server should send packets indicating a player has enter the interior, not the parent world.
    • Possibly include a max player capacity for interiors (configurable) (eg. "This room is already full")
    • Will need interior spawn flag and events.
    • Once player leaves interior, keep the interior around in memory until they walk X distance away? (configurable)
      • Alt, X seconds after destroy, or, destroy immediately depending on how large the interior is.
    • If player gets within X distance of interior, load it in depending on how large it is? (configurable)
    • Remove player from parent world, once left, add them back.

Server Design

  • remove player from parent world. Once left, add them back.
  • Max player capacity for interiors. (configurable)
  • Only send the player updates from within the interior, not from whole world.
  • ...

Identify and fix rare memory leaks

Oct 06, 2021 11:17:01 PM io.netty.util.ResourceLeakDetector reportTracedLeak
SEVERE: LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records: 
Created at:
	io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:363)
	io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
	io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178)
	io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:131)
	gdx.lunar.protocol.packet.Packet.<init>(Packet.java:19)
	gdx.lunar.protocol.packet.server.SPacketPlayerVelocity.<init>(SPacketPlayerVelocity.java:43)
	gdx.lunar.server.world.World.handlePlayerVelocity(World.java:176)
	gdx.lunar.server.network.PlayerConnection.handlePlayerVelocity(PlayerConnection.java:69)
	gdx.lunar.protocol.packet.client.CPacketVelocity.handle(CPacketVelocity.java:26)
	gdx.lunar.protocol.LunarProtocol.lambda$initializeClient$15(LunarProtocol.java:124)
	gdx.lunar.protocol.LunarProtocol.handleClientPacket(LunarProtocol.java:198)
	gdx.lunar.server.netty.codec.ClientProtocolPacketDecoder.decode(ClientProtocolPacketDecoder.java:36)
	io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:332)
	io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
	io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
	io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1486)
	io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1235)
	io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1282)
	io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
	io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
	io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
	io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	java.lang.Thread.run(Thread.java:748)

Server tasks

  • Rewrite lobby system
  • Rewrite world system
  • Rewrite entity system using ashley.
  • Better server structure
  • - Allow change username
  • - Allow NULL usernames
  • - Server example

Implement networked tiles and maps

Start working on implementing networked tiles/textures, objects and maps.

Ideally, have a general Tile that has a String texture location and position to spawn locally.

  • Implement Tile class
  • Implement NetworkedTiledMap class
  • Implement Tile update packets
  • Tile IDs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.