Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Desarrollo v0.1.15 #381

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
703c0f0
Arreglos a WidgetFactory
cpbeto Dec 3, 2020
d18e942
Pide confirmación para cerrar el juego con ESC
cpbeto Dec 3, 2020
05fcd85
Agrega botones para agregar y eliminar servidores de la lista
cpbeto Dec 3, 2020
37adcb2
Normaliza sintaxis en SoundsSystem
cpbeto Dec 6, 2020
24a8f2a
Crea Slider en LoginScreen para controlar el volumen de la música
cpbeto Dec 6, 2020
a0fa99f
Implementa volumen global para el sistema de sonido
cpbeto Dec 7, 2020
82d2b43
Mantiene una instancia única y global de MusicSystem
cpbeto Dec 7, 2020
e3ab497
Fix: Música se reinicia al volver a la pantalla de login
cpbeto Dec 7, 2020
4a9df6a
Arreglos a MusicSystem
cpbeto Dec 7, 2020
f5d07f7
Crea aplicación de testing para hacer pruebas de interfaz gráfica
cpbeto Dec 11, 2020
48ce23f
Usa switch expressions de Java 8
cpbeto Apr 14, 2022
484469e
Merge branch 'master' into develop
cpbeto Apr 14, 2022
a96c6e1
chore(): merge branches `develop` and `overwhelmed`
joaquinodz Apr 15, 2022
53884af
login screen small bug fix and cosmetic
bestiardo Apr 16, 2022
035d265
generic scrollpane creator
bestiardo Apr 16, 2022
5a61338
Merge pull request #380 from bestiardo/develop+overwhelmedFix
joaquinodz Apr 16, 2022
8bd5a06
Add Server Button update
bestiardo Apr 16, 2022
e3b4216
Remueve artemis-fluid de ServerSystem
cpbeto Apr 17, 2022
d405233
Remueve artemis-fluid de UserSystem
cpbeto Apr 17, 2022
41ba070
Remueve artemis-fluid de ServerNotificationProcessor
cpbeto Apr 17, 2022
2cc9986
Deshabilita proyecto design para evitar errores de CI
cpbeto Apr 17, 2022
3128bc8
imagen faltante para animacion de fantasma
bestiardo Apr 17, 2022
632c74d
Merge pull request #385 from bestiardo/d+o_add_server_button_update
cpbeto Apr 17, 2022
7da169e
Refactor CommandSystem
cpbeto Apr 17, 2022
74b3dee
Arreglar proyecto design #388 - Vuelve a compilar
bestiardo Apr 17, 2022
47e4350
Merge pull request #390 from bestiardo/desarrollo-v0.1.15-desing
joaquinodz Apr 17, 2022
1d1ca0f
Merge branch 'master' into desarrollo-v0.1.15
joaquinodz Apr 17, 2022
e45164f
Revert path changes
matisandacz Apr 18, 2022
8dd0636
Merge pull request #392 from matisandacz/desarrollo-v0.1.15
cpbeto Apr 18, 2022
fb3b716
Update AOConsole.java
bestiardo Apr 18, 2022
b8572b2
Update UserInterfaceSystem.java
bestiardo Apr 18, 2022
cae4d6d
Merge pull request #396 from bestiardo/desarrollo-v0.1.15-consoleupdate
cpbeto Apr 18, 2022
baa2ac2
Comando /help #389
bestiardo Apr 20, 2022
e04e66c
Update CommandSystem.java
bestiardo Apr 20, 2022
dc72002
Merge pull request #398 from bestiardo/comando-help
cpbeto Apr 20, 2022
e471fe6
Remueve artemis-fluid de PlayerActionSystem
cpbeto Apr 20, 2022
7debd55
Desacoplar el connectionId por fuera del modulo Network
matisandacz Apr 21, 2022
df4434c
Desacoplar connectionId de Drop Item
matisandacz Apr 21, 2022
e435f3e
merge with branch desarrollo-v0.1.15
matisandacz Apr 21, 2022
df2c38d
Merge pull request #401 from matisandacz/F400
cpbeto Apr 21, 2022
fc969f6
Remueve artemis-fluid de NetworkDictionary
cpbeto Apr 21, 2022
a775b66
Remueve artemis-fluid de WorldSaveSystem
cpbeto Apr 21, 2022
095ec97
Remueve artemis-fluid de ItemActionSystem
cpbeto Apr 21, 2022
54f4071
Remueve artemis-fluid de MovementSystem
cpbeto Apr 21, 2022
224931a
Remueve clase no usada TagManager
cpbeto Apr 21, 2022
e9a371e
Remueve todo en PlayerActionSystem
cpbeto Apr 21, 2022
a9a1c23
Remueve anotación @Wire de ComponentSystem
cpbeto Apr 21, 2022
c7ba897
Refactor EntityFactorySystem
cpbeto Apr 21, 2022
59103db
Deshabilita ProfilerSystem para no floodear el stdout
cpbeto Apr 21, 2022
f5ab5c5
F4 toggle roof
bestiardo Apr 23, 2022
6d9ea9e
Se agrega TP al clickear shift + click izquierdo con animacion
matisandacz Apr 23, 2022
005f12f
refactor FX number
matisandacz Apr 23, 2022
02d11e2
remove duplicated code and refactor
matisandacz Apr 23, 2022
e154058
#408 Limpiar el repositorio - removido carpeta graficosx2
bestiardo Apr 23, 2022
bd9bd4d
Merge pull request #411 from bestiardo/eliminar-graficosx2
joaquinodz Apr 23, 2022
0180193
Merge pull request #409 from bestiardo/map-layer-roof
joaquinodz Apr 23, 2022
30d4cb4
Revierte cambios a ProfilerSystem
cpbeto Apr 24, 2022
7e6e9db
Merge pull request #410 from matisandacz/F401
cpbeto Apr 24, 2022
e4f1e3a
Como iniciar el proyecto
Lorwik Apr 27, 2022
b37b589
Merge pull request #412 from Lorwik/desarrollo-v0.1.15
cpbeto Apr 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ subprojects {
apply plugin: "java-library"

// Establecemos la version de Java a usar.
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

// Configuraciones del compilador Java
tasks.withType(JavaCompile) {
Expand Down
6 changes: 2 additions & 4 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ dependencies {
implementation group: "org.jetbrains", name: "annotations", version: "19.0.0"
implementation group: "com.badlogicgames.gdx", name: "gdx-freetype", version: "$gdxVersion"
implementation group: "com.badlogicgames.gdx", name: "gdx-freetype", version: "$gdxVersion"
implementation group: "com.badlogicgames.gdx", name: "gdx-backend-lwjgl3", version: "$gdxVersion"
implementation (group: "com.badlogicgames.gdx", name: "gdx-tools", version: "$gdxVersion") {
exclude group: "com.badlogicgames.gdx", module: "gdx-backend-lwjgl"
}
// @todo: Revisar estas dependencias
api group: "com.badlogicgames.gdx", name: "gdx-backend-lwjgl3", version: "$gdxVersion"
implementation group: "com.badlogicgames.gdx-controllers", name: "gdx-controllers-core", version: "$gdxControllerVersion"
//implementation group: "com.badlogicgames.gdx-controllers", name: "gdx-controllers-desktop", version: "$gdxControllerVersion"
implementation group: 'net.mostlyoriginal.artemis-odb', name: 'contrib-plugin-profiler', version: '2.5.0'
implementation group: "org.reflections", name: "reflections", version: "$reflectionsVersion"
}
20 changes: 11 additions & 9 deletions client/src/game/AOGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.artemis.World;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.utils.PerformanceCounter;
import com.esotericsoftware.minlog.Log;
import game.handlers.DefaultAOAssetManager;
import game.screens.LoadingScreen;
Expand All @@ -11,6 +12,9 @@
import game.systems.resources.MusicSystem;
import shared.util.LogSystem;

import static game.screens.ScreenEnum.GAME;
import static game.screens.ScreenEnum.LOGIN;

/**
* Esta es la <b>clase principal</b> de la aplicación.
* Ver la documentación de libGDX sobre {@link ApplicationListener}
Expand All @@ -30,6 +34,7 @@ public class AOGame extends Game {
public AOGame(ClientConfiguration clientConfiguration) {
Log.setLogger(new LogSystem());
this.clientConfiguration = clientConfiguration;
musicSystem = new MusicSystem();
}

// Crea la ventana del juego.
Expand All @@ -40,26 +45,23 @@ public void create() {
assetManager = DefaultAOAssetManager.getInstance();
LoadingScreen screen = new LoadingScreen(assetManager);
setScreen(screen);

screen.onFinished((assetManager) -> {
ScreenManager screenManager = new ScreenManager(this);
this.world = WorldConstructor.create(clientConfiguration, screenManager, assetManager);
screenManager.to(ScreenEnum.LOGIN);
this.musicSystem = world.getSystem(MusicSystem.class);
musicSystem.playMusic(101, true);
this.world = WorldConstructor.create(clientConfiguration, screenManager, assetManager, musicSystem);
world.inject(musicSystem);
screenManager.addListener((screenEnum -> {
switch (screenEnum) {
case LOGIN:
this.musicSystem = world.getSystem(MusicSystem.class);
musicSystem.stopMusic();
this.world = WorldConstructor.create(clientConfiguration, screenManager, assetManager);
this.musicSystem = world.getSystem(MusicSystem.class);
this.world = WorldConstructor.create(clientConfiguration, screenManager, assetManager, musicSystem);
musicSystem.playMusic(101, true);
break;
case GAME:
this.musicSystem = world.getSystem(MusicSystem.class);
musicSystem.playMusic(1, true);
break;
}
}));
screenManager.to(LOGIN);
});
}

Expand Down
121 changes: 121 additions & 0 deletions client/src/game/PixelPerfectViewport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package game;

import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.utils.Scaling;
import com.badlogic.gdx.utils.viewport.Viewport;

import static com.badlogic.gdx.utils.Scaling.fill;
import static com.badlogic.gdx.utils.Scaling.fit;


/**
* A viewport that scales the world using {@link Scaling}, but limits the scaling to integer multiples or simple halving
* if the zoom would be 0x. Handy for keeping a pixelated look on high-DPI screens. The {@code conversionX} and {@code conversionY}
* configurations correspond to the scaling difference from a screen pixel to a world unit.
* <p>
* {@link Scaling#fit} keeps the aspect ratio by scaling the world up to fit the screen, adding black bars (letterboxing) for the
* remaining space.
* <p>
* {@link Scaling#fill} keeps the aspect ratio by scaling the world up to take the whole screen (some of the world may be off
* screen, potentially in both directions regardless of whether fill, fillX, or fillY is used).
* <p>
* {@link Scaling#stretch} (NOT RECOMMENDED) does not keep the aspect ratio, the world is scaled to take the whole screen. It is not pixel perfect.
* <p>
* {@link Scaling#none} keeps the aspect ratio by using a fixed size world (the world may not fill the screen or some of the world
* may be off screen).
*
* @author Daniel Holderbaum
* @author Nathan Sweet
* @author Tommy Ettinger
*/
public class PixelPerfectViewport extends Viewport {

private Scaling scaling;
private int conversionX, conversionY;
private float currentScale = 1;
/**
* Creates a new viewport using a new {@link OrthographicCamera}.
*/
public PixelPerfectViewport(Scaling scaling, float worldWidth, float worldHeight, int conversionX, int conversionY) {
this(scaling, worldWidth, worldHeight, conversionX, conversionY, new OrthographicCamera());
}
public PixelPerfectViewport(Scaling scaling, float worldWidth, float worldHeight, int conversion) {
this(scaling, worldWidth, worldHeight, conversion, conversion, new OrthographicCamera());
}

public PixelPerfectViewport(Scaling scaling, float worldWidth, float worldHeight, int conversionX, int conversionY, Camera camera) {
this.scaling = scaling;
this.conversionX = conversionX;
this.conversionY = conversionY;
setWorldSize(worldWidth, worldHeight);
setCamera(camera);
}

@Override
public void update(int screenWidth, int screenHeight, boolean centerCamera) {
//Vector2 scaled = scaling.apply(getWorldWidth(), getWorldHeight(), screenWidth, screenHeight);
float worldWidth = getWorldWidth(), worldHeight = getWorldHeight();

int viewportWidth = 0;
int viewportHeight = 0;

if (fit.equals(scaling)) {
float screenRatio = screenHeight / (float) screenWidth;
float worldRatio = worldHeight / worldWidth;
float scale = (int) (screenRatio > worldRatio ? screenWidth / (worldWidth * conversionX) : screenHeight / (worldHeight * conversionY));
if (scale < 1) scale = 0.5f;
viewportWidth = Math.round(worldWidth * scale);
viewportHeight = Math.round(worldHeight * scale);
this.currentScale = 1f / scale;
} else if (fill.equals(scaling)) {
float screenRatio = screenHeight / (float) screenWidth;
float worldRatio = worldHeight / worldWidth;
float scale = (int) Math.ceil(screenRatio < worldRatio ? screenWidth / (worldWidth * conversionX) : screenHeight / (worldHeight * conversionY));
if (scale < 1) scale = 0.5f;
viewportWidth = Math.round(worldWidth * scale);
viewportHeight = Math.round(worldHeight * scale);
this.currentScale = 1f / scale;
} else if (Scaling.fillX.equals(scaling)) {
float scale = (int) Math.ceil(screenWidth / (worldWidth * conversionX));
if (scale < 1) scale = 0.5f;
viewportWidth = Math.round(worldWidth * scale);
viewportHeight = Math.round(worldHeight * scale);
this.currentScale = 1f / scale;
} else if (Scaling.fillY.equals(scaling)) {
float scale = (int) Math.ceil(screenHeight / (worldHeight * conversionY));
if (scale < 1) scale = 0.5f;
viewportWidth = Math.round(worldWidth * scale);
viewportHeight = Math.round(worldHeight * scale);
this.currentScale = 1f / scale;
} else if (Scaling.stretch.equals(scaling)) {
viewportWidth = screenWidth;
viewportHeight = screenHeight;
} else if (Scaling.stretchX.equals(scaling)) {
viewportWidth = screenWidth;
viewportHeight = (int) worldHeight;
} else if (Scaling.stretchY.equals(scaling)) {
viewportWidth = (int) worldWidth;
viewportHeight = screenHeight;
} else {
viewportWidth = (int) worldWidth;
viewportHeight = (int) worldHeight;
}
// Center.
setScreenBounds((screenWidth - viewportWidth * conversionX) / 2, (screenHeight - viewportHeight * conversionY) / 2, viewportWidth * conversionX, viewportHeight * conversionX);

apply(centerCamera);
}

public Scaling getScaling() {
return scaling;
}

public void setScaling(Scaling scaling) {
this.scaling = scaling;
}

public float getCurrentScale() {
return currentScale;
}
}
39 changes: 28 additions & 11 deletions client/src/game/WorldConstructor.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
import game.systems.physics.MovementProcessorSystem;
import game.systems.physics.MovementSystem;
import game.systems.physics.PlayerInputSystem;
import game.systems.render.BatchRenderingSystem;
import game.systems.profiling.ProfilerSystem;
import game.systems.render.BatchBeginSystem;
import game.systems.render.BatchEndSystem;
import game.systems.render.BatchSystem;
import game.systems.render.chars.PrerenderCharCache;
import game.systems.render.world.*;
import game.systems.resources.*;
import game.systems.screen.MouseSystem;
Expand All @@ -41,6 +45,7 @@
import game.systems.world.WorldSystem;
import game.utils.CursorSystem;
import net.mostlyoriginal.api.system.render.ClearScreenSystem;
import net.mostlyoriginal.plugin.ProfilerPlugin;
import shared.systems.IntervalSystem;

import java.util.Arrays;
Expand All @@ -56,7 +61,12 @@ public class WorldConstructor {
private static final int DECORATION_PRIORITY = 3;
private static final int UI = 0;

private static WorldConfiguration getWorldConfiguration(ClientConfiguration clientConfiguration, ScreenManager screenManager, DefaultAOAssetManager assetManager) {
private static WorldConfiguration getWorldConfiguration(
ClientConfiguration clientConfiguration,
ScreenManager screenManager,
DefaultAOAssetManager assetManager,
MusicSystem musicSystem
) {
return new WorldConfigurationBuilder()
// Sistemas de uso global (no necesitan prioridad porque son pasivos)
.with(clientConfiguration,
Expand Down Expand Up @@ -106,7 +116,6 @@ private static WorldConfiguration getWorldConfiguration(ClientConfiguration clie
new DescriptorsSystem(),
new MessageSystem(),
new MapSystem(),
new MusicSystem(),
new ObjectSystem(),
new ParticlesSystem(),
new SoundsSystem(),
Expand All @@ -119,6 +128,9 @@ private static WorldConfiguration getWorldConfiguration(ClientConfiguration clie

// Rendering
.with(PRE_ENTITY_RENDER_PRIORITY,
new BatchSystem(),
new BatchBeginSystem(),
new PrerenderCharCache(),
new ClearScreenSystem(),
new MapGroundRenderingSystem(),
new ObjectRenderingSystem(),
Expand All @@ -127,7 +139,7 @@ private static WorldConfiguration getWorldConfiguration(ClientConfiguration clie

.with(ENTITY_RENDER_PRIORITY,
new EffectRenderingSystem(),
new CharacterRenderingSystem(),
new CharacterRenderSystem(),
new WorldRenderingSystem())

.with(POST_ENTITY_RENDER_PRIORITY,
Expand All @@ -138,7 +150,7 @@ private static WorldConfiguration getWorldConfiguration(ClientConfiguration clie
.with(DECORATION_PRIORITY,
new StateRenderingSystem(),
new CharacterStatesRenderingSystem(),
new BatchRenderingSystem())
new BatchEndSystem())

// UI
.with(UI,
Expand All @@ -156,18 +168,23 @@ private static WorldConfiguration getWorldConfiguration(ClientConfiguration clie
// Otros sistemas
.with(new MapManager(),
new TagManager(),
new UuidEntityManager())

new UuidEntityManager(),
new ProfilerSystem())
.build()
.register(assetManager);
.register(assetManager)
.register(musicSystem);
}

/**
* Construye el Artemis World, inicializa e inyecta sistemas.
* Este método es bloqueante.
*/
public static World create(ClientConfiguration clientConfiguration,
ScreenManager screenManager, DefaultAOAssetManager assetManager) {
return new World(getWorldConfiguration(clientConfiguration, screenManager, assetManager));
public static World create(
ClientConfiguration clientConfiguration,
ScreenManager screenManager,
DefaultAOAssetManager assetManager,
MusicSystem musicSystem
) {
return new World(getWorldConfiguration(clientConfiguration, screenManager, assetManager, musicSystem));
}
}
1 change: 1 addition & 0 deletions client/src/game/handlers/AOAssetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import model.descriptors.*;
import model.textures.AOAnimation;
Expand Down
9 changes: 8 additions & 1 deletion client/src/game/handlers/DefaultAOAssetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.utils.I18NBundle;
import com.badlogic.gdx.utils.PerformanceCounter;
import com.esotericsoftware.minlog.Log;
import game.ClientConfiguration;
import game.loaders.*;
Expand Down Expand Up @@ -76,6 +77,7 @@ public class DefaultAOAssetManager extends AssetManager implements AOAssetManage
private Map<Integer, HelmetDescriptor> helmets;
private Map<Integer, WeaponDescriptor> weapons;
private Map<Integer, BodyDescriptor> bodies;
private TextureAtlas textureAtlas;

private DefaultAOAssetManager(ClientConfiguration clientConfiguration) {
this.languagesFile = SharedResources.LANGUAGES_FOLDER + "messages";
Expand Down Expand Up @@ -113,6 +115,11 @@ public void load() {
loadSkins();
loadFonts();
loadMessages();
loadAtlas();
}

private void loadAtlas() {
load(Resources.GAME_ATLAS_PATH + "images.atlas", TextureAtlas.class);
}

@Override
Expand Down Expand Up @@ -342,7 +349,7 @@ private void loadTexture(String fileName) {
TextureParameter param = new TextureParameter();
param.minFilter = TextureFilter.Linear;
param.magFilter = TextureFilter.Linear;
param.genMipMaps = true;
param.genMipMaps = false;
param.wrapU = Texture.TextureWrap.Repeat;
param.wrapV = Texture.TextureWrap.Repeat;
load(fileName, Texture.class, param);
Expand Down
4 changes: 2 additions & 2 deletions client/src/game/loaders/ImageLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public void loadAsync(AssetManager manager, String fileName, FileHandle file, De

@Override
public ArrayList<AOImage> loadSync(AssetManager manager, String fileName, FileHandle file, DescriptorParameter parameter) {
ArrayList<AOImage> syncronizedDescriptors = this.descriptors;
ArrayList<AOImage> synchronizedDescriptors = this.descriptors;
this.descriptors = null;
return syncronizedDescriptors;
return synchronizedDescriptors;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions client/src/game/screens/AbstractScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import net.mostlyoriginal.api.system.core.PassiveSystem;

public abstract class AbstractScreen extends PassiveSystem implements Screen {
private static final Skin SKIN = Skins.COMODORE_SKIN;
private static final Skin SKIN = Skins.CURRENT.get();
private static final Texture BACKGROUND_TEXTURE = new Texture(Gdx.files.internal(Resources.GAME_IMAGES_PATH + "background.jpg"));
private static final SpriteDrawable BACKGROUND = new SpriteDrawable(new Sprite(BACKGROUND_TEXTURE));

Expand Down Expand Up @@ -72,7 +72,7 @@ public void render(float delta) {

@Override
public void resize(int width, int height) {
getStage().getViewport().update(width, height);
// getStage().getViewport().update(width, height);
}

@Override
Expand Down
Loading