egordorichev / lasttry Goto Github PK
View Code? Open in Web Editor NEW:deciduous_tree: LastTry is open-source game written in Java, using LibGDX library and inspired by Terraria :deciduous_tree:
License: MIT License
:deciduous_tree: LastTry is open-source game written in Java, using LibGDX library and inspired by Terraria :deciduous_tree:
License: MIT License
The issue is everything between the player and the destination is ignored. Only the destination matters.
Here's a video of the issue:
1: Get user's biome
2: Get 'spawn rate' & 'max spawns' of biome.
3: calculate the spawnRate(Spawn Rate, Max Spawns)
{
1--- Check what events are active
If event has a hardcoded 'Max spawns', 'Spawn rate' & 'Monsters list' we call 'getTotalSpawnWeightOfActiveMonsters'
else
2--- Check time of day
Increase/decrease spawn rate
3 -- Check items in the environment
Increase/decrease spawn rate
4 -- then call getTotalSpawnWeightOfActiveMonsters
5 - then call '5'
}
function getTotalSpawnWeightOfActiveMonsters()
Calculate player spawn area.
Go through enemies and check if they are in player area.
Generate list of enemies in player area.
Calculate and return total spawn weight of monsters in player area.
4 -- Receives spawn rate, max spawns, spawn weight of active monsters.
If spawn weight of active monsters greater than max spawns - exit
else
calculate difference between max spawns and spawn weight of active monsters
based on the difference, we apply a multiplier to the spawn rate.
A lot of monsters already existing, we reduce spawn rate
Not a lot of monsters, we increase spawn rate
5 -- Gets a random number and compares to spawn rate, then returns true
6 -- SUCCESSFUL
--- Check if event is active and check if monsters exist for event.
else
--- Get list of eligible monsters based on Biome
--- Get coefficient from previous calculation.
--- Choose monster randomly
--- Call getValidCoOrdinates()
--- Pass co ordinates and monster, to spawn function.
function getValidCoOrdinates()
Returns valid co ordinates for spawning
7 -- Pass entity and co ordinates to 'spawn' function outside of class.
From the README.md
-Djava.library.path=lib/YOUR_SYSTEM-NAME_HERE (lookup the lib folder):lib/
With the vm args -Djava.library.path=lib/windows:lib/
the following occurs:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path
Removing :lib
and using -Djava.library.path=lib/windows/
results in:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no luajava-1.1 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.keplerproject.luajava.LuaState.<clinit>(LuaState.java:86)
When the luajava-1.1.dll
is dropped in the lib folder dependencies of the dll cannot be found:
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Programming\Java\Terraria\LastTry\lib\windows\luajava-1.1.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.keplerproject.luajava.LuaState.<clinit>(LuaState.java:86)
at org.keplerproject.luajava.LuaStateFactory.newLuaState(LuaStateFactory.java:59)
Any idea on what it's missing? The exception doesn't exactly state what is missing, rather just that something is missing.
This can be temporarily ignored by commenting out the lua
field instantiation in LastTry.java
's initStatesList
method since the lua
field isn't used anywhere else.
It shouldn't be possible to have a blank world name or player name.
It should probably check for weird non alphanumeric characters too.
Right now, we have only a few methods for the movement, such as:
move(direction)
And this allows you only move right and leftfly(vx, vy)
Also is not prettyWe need to change this API completely , also, implement A* path finding.
I have tried to build and run the project on both my Mac and Windows and have gotten the same errors on both computers. I followed the steps in the Readme and I can get "mvn package" to run. But after that I can't get anything to work.
target>java -jar lasttry-1.0.0-SNAPSHOT.jar
no main manifest attribute, in lasttry-1.0.0-SNAPSHOT.jar
I have tried several variations of this including being in the target folder, out of it and using an absolute path, quotes, even trying to run the main class using the jar as the classpath:
target>java -cp lasttry-1.0.0-SNAPSHOT.jar org.egordorichev.lasttry.LastTry
Error: Could not find or load main class org.egordorichev.lasttry.LastTry
The only warnings I get while running maven is that it's using platform encoding, could this be it?
Where is the main manifest? Or how do I get it to generate properly?
Are you distributing assets from Terraria, because the note above the license makes it sound you does?
All text is currently hardcoded to the game. Probably, we need a basic Language class, so we can easily change the game language. Something like this should work:
public class Language {
public static void load(String locale) {
}
public static String dirt = "dirt".
}
And so on.
Some of the blocs, like furniture, workbenches and other working stations are more then 1x1 in size.
The engine must have support for multi-tile blocks.
Also on a kinda related slime note sometimes when you kill something you can attack the place where it last was. This hitbox doesn't despawn.
@Col-E, found this bug.
Take this clip for example. I have 2 zombies. One is behind a wall and I am looking away from the wall. When I click it behaves as if I'm attacking it.
I am adding maven
dependency management to the project.
I see that you have asm-5.2.4.jar
as a lib, though looking online the highest I can find is 5.2
.
https://mvnrepository.com/artifact/org.ow2.asm/asm
The problem is that
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.2</version>
</dependency>
Doesnt contain ClassAdapter
:java.lang.NoClassDefFoundError: org/objectweb/asm/ClassAdapter
Where did you find this artifact?
A small clip showcasing the issue.
Moved todo list to trello: https://trello.com/b/X3o5KsSG/lasttry-development
Tool
classLuaMod
And more to come. Feel free to post more in comments.
It can't handle them for some reason, it crashes and then crashes on startup if you don't remove the actual file
Is this part of the TODO list? It applies for all entities, slimes are just the first thing I noticed.
Also on a kinda related slime note sometimes when you kill something you can attack the place where it last was. This hitbox doesn't despawn.
According to the, #40 we must impove save system for the world. Added to todo list https://trello.com/c/SG1TeEc6/26-make-world-file-size-smaller-a-ton.
Probably, we should implement chunks system. If we will use chunks method, will we need to create infinite worlds?
I get the following crash when running the DesktopLauncher
via gradle
in IntellijIdea
(Java SE 8u121)
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: splash.png
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:147)
at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at org.egordorichev.lasttry.state.SplashState.<init>(SplashState.java:16)
at org.egordorichev.lasttry.LastTry.create(LastTry.java:84)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: splash.png (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:144)
... 7 more
@Col-E wants us to have docs. I think, that's a good idea. We have three ways of doing it:
I like the second way. The only thing is, that this will make our code pasta-looking. As the "Clean Code" book tells, javadoc is not always good.
Any thoughts?
Right now we have this code:
public static Enemy create(int id) {
switch(id) {
case EnemyID.none:
default:
return null;
case EnemyID.greenSlime:
return new GreenSlime();
case EnemyID.blueSlime:
return new BlueSlime();
case EnemyID.eyeOfCthulhu:
return new EyeOfCthulhu();
}
}
And if we want to add more enemies, we must update this list. But this is not the best way to do that. For example, if some wants to add custom enemy from mod, he will be not able to do that.
The build is failing because org.egordorichev.lasttry.graphics.Fonts
no longer exists
I did a bit of research on this theme, and it turns, that it is better to use build in gdx assets manager,
then the way, we do that now. Will move to it today.
In our project we use different texture packing method, and while I was adding evil block,
I hated process of moving texture path so much!
We need to make a script, that will do this automatically.
When you click on any of the boxes to the right of the main inventory the game crashes giving this error
Exception in thread "LWJGL Application" java.lang.NullPointerException at org.egordorichev.lasttry.ui.UiItemSlot.canHold(UiItemSlot.java:165) at org.egordorichev.lasttry.ui.UiItemSlot.onStateChange(UiItemSlot.java:196) at org.egordorichev.lasttry.ui.UiComponent.update(UiComponent.java:153) at org.egordorichev.lasttry.ui.UiComponent.render(UiComponent.java:44) at org.egordorichev.lasttry.ui.UiItemSlot.render(UiItemSlot.java:82) at org.egordorichev.lasttry.ui.UiInventory.render(UiInventory.java:237) at org.egordorichev.lasttry.ui.UiManager.render(UiManager.java:11) at org.egordorichev.lasttry.state.GamePlayState.render(GamePlayState.java:118) at com.badlogic.gdx.Game.render(Game.java:46) at org.egordorichev.lasttry.LastTry.render(LastTry.java:166) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
This system is one of the core mechanics. Recepies will be stored in json. The only hard thing is ui. If we will make something simular to terraria, this will also require scrollable ui.
Slick2d is no longer in the development. We must move to LibGDX. Staring to port code on the libgdx
branch.
This fragment in TileData.java is very strange:
if (wall != null) {
wall.renderWall(this, x, y);
}
if (block != null) {
block.renderBlock(this, x, y);
}
If I run it and using the Ghost mode and go down into the earth a bit, my FPS drops. To 30.
But if I replace it with this code:
if (wall != null) {
wall.renderWall(this, x, y);
wall.renderWall(this, x, y);
}
or even with this:
if (block != null) {
block.renderBlock(this, x, y);
block.renderBlock(this, x, y);
}
All works fine. What is the catch?
@Col-E, I see, that my java doc style is not perfect (in fact, it is first time I use it a lot). So can you figure out the code style and java doc style for the project. Is this a good style?
/**
* Handles window resize
* @param width new window width
* @param height new window height
*/
@Override
public void resize(int width, int height) {
super.resize(width, height);
viewport.update(width, height);
camera.update();
}
I was building a test ground for something and all of a sudden the terrain to reset to what it had looked like when I loaded up the game.
Just returned from a trip, pulled and run the new source:
LastTry had crashed!
-------------------
LastTry had stopped running, because it encountered a problem.
Please, copy and report the entire text to email [email protected] or
submit an issue https://github.com/egordorichev/LastTry/issues
--- BEGIN ERROR REPORT ---
LastTry version: v.0.3
OS: Linux (amd64) version 3.18.9-gentoo
Java version: 1.8.0_72, Oracle Corporation
Java VM version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Java VM flags: 0 total;
Memory: 222811528 bytes (212 MB) / 243269632 bytes (232 MB) up to 3596091392 bytes (3429 MB)
Exception cause: java.util.MissingResourceException: Can't find bundle for base name language, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
at org.egordorichev.lasttry.language.Language.load(Language.java:10)
at org.egordorichev.lasttry.LastTry.create(LastTry.java:106)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
--- END ERROR REPORT ---
Something with language is missing.
We should star thinking about biomes.
Can I ask what the experience level of the main developers are?
The idea is to pre-bake lighting initially so runtime updates will be small. So loading the chunks should happen. What should happen next is a step that unloads all chunks after setting up the world's light. Then when the player spawns in everything will behave as intended.
The player's hair flickers, appearing and disappearing regularly as you walk along the ground. But this doesn't happen while moving through the air, it only happens during the walking animation.
On the main branch the hair was sometimes moving towards the player's feet too so I removed this line from org.egordorichev.lasttry.entity.player.PlayerRenderer:
pixmap.drawPixmap(hair, 0, 748);
and it stopped happening, I have no idea what that line was for but removing it didn't seem to break anything.
Addition of Lighting to LastTry.
Lighting from sources, such as torches and Sun.
This can be an interesting thing to play around. Each empty block can have liquid level and liquid type (water, lava, honey). Liquids shouldx be drawn on top of all entities. Physics part shouldn't bed hard to implement: just compare neighbors every 0.5 - 1 second. Also, liquids should slow down entities.
Please, add this to trello.
Many blocks in the future, should work as platforms. This is called solid top blocks.
Also, thing to add is block slopes. We hae to variants of doing them:
Second one is not so good, because you will have to many variants, to hammer through.
Just now the README.md
is completely unuseful. We need to fix that. New structure:
Would you be able to provide some information about this jar?
Now that maven is being used, are the .jar files in /lib
still required?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.