Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

FaSTeam's DevLog

A topic by Fahien created Dec 24, 2015 Views: 795 Replies: 5
Viewing posts 1 to 6
Submitted(+1)

Hi! Here are Fahien and pasto, aka the FaSTeam!

The first devlog isn't strictly related to the game we are going to create, but it is about a tool which I think would be useful.

During the preparations for the jam, the team needed to test the effectiveness of its work by creating a prototype application which involves the use of libGDX and Blender.

ProtoFast is the codename of this project. The final product is a simple application which shows a three-dimensional model through a camera movable via mouse or touch screen.

Practically, ProtoFast creates a list of models contained in the local models/ folder. If there are no models in the local folder, it searches in the internal models/ folder. The showcase screen loads the first model from the list and renders it. You can load the next or previous model through the arrows.

Screenshots

The models shown in the screenshots are made by pasto.

Earth

Spaceship

Submitted (1 edit) (+1)

I'm glad to announce that the codename for the FastTeam's entry is SpaceFloat and it will be a game about a delivery service in the space!

I'm going to continue these devlogs writing about some practices I use with libGDX. So, here is a devlog about the SpaceFloat screen management.

SpaceFloat Screen Management

You could see a better formatted version of this devlog at this link.

SpaceFloat is divided in well-defined screens encapsulated in the ScreenEnumerator, so it's very simple to retrieve a singleton of a screen: ScreenEnumerator.INFO.getScreen();.

public enum ScreenEnumerator {
    INFO(new InfoScreen()),
    MAIN(new MainScreen()),
    LOADING(new LoadingScreen());

    private SpaceFloatScreen screen;

    ScreenEnumerator(SpaceFloatScreen screen) {
        this.screen = screen;
    }

    public SpaceFloatScreen getScreen() {
        return screen;
    }
}

The SpaceFloatGame class, subclass of Game, is responsible of the application life-cycle, including the current screen. A screen is initialized within the method setScreen(ScreenEnumerator) which, if the screen is not yet initialized, will invoke injectDependencies(SpaceFloatScreen) to inject all required dependencies.

public void setScreen(ScreenEnumerator screenEnumerator) {
    SpaceFloatScreen screen = screenEnumerator.getScreen();
    if (!screen.isInitialized()) injectDependencies(screen);
    setScreen(screen);
}

private void injectDependencies(SpaceFloatScreen screen) {
    screen.setAssetManager(assetManager);
    screen.setFont(font);
    screen.setEngine(engine);
    screen.setGame(this);
    screen.setInitialized(true);
}
Submitted (1 edit) (+1)

SpaceFloat Asset Management

SpaceFloat uses an instance of the AssetManager provided by libGDX to manage assets. This instance follow the lifecycle of the SpaceFloatGame instance and it is injected into the Screens as a dependence.

public class SpaceFloatGame extends Game {

    private AssetManager assetManager;

    public SpaceFloatGame() {
        assetManager = new AssetManager();
    }

    // ...

    @Override
    public void dispose() {
        assetManager.dispose();
    }
}

I will show you a fundamental use case in the next devlog presenting the LoadingScreen.

Submitted(+1)

The Loading Screen

You could find a better formatted version of this devlog at this link

A fundamental use case of the asset manager is in the LoadingScreen. With this tecnique you can load all assets within a directory while showing progress.

public class LoadingScreen extends SpaceFloatScreen {

    private static final String TEXTURE_DIRECTORY = "textures/";
    private AssetManager assetManager;
    private float progress;

    @Override
    public void show() {
        super.show();
        assetManager = getAssetManager();
        FileHandle[] files = Gdx.files.local(TEXTURE_DIRECTORY).list();
        for(FileHandle file : files) {
            assetManager.load(file.path(), Texture.class);
        }
    }

    @Override
    public void render(float delta) {
        assetManager.update();
        progress = assetManager.getProgress();
        logger.info("Loading assets: " + progress);
        if (progress < 1.0f) return;
        SpaceFloat.GAME.setScreen(ScreenEnumerator.MAIN);
    }
}

I'm also glad to show you the new cargoship which you drive in SpaceFloat!

SpaceFloat cargoship

Submitted (2 edits)

The Game Screen

You could find a better formatted version of this devlog at this link

The Game Screen is the most important of SpaceFloat because it shows the 3D world with which the player can interact. It makes use of the powerful Ashley Engine that helps significantly reduce the complexity of the system.

This Screen creates all the systems it needs within its constructor.

private ReactorController reactorController;
private BulletSystem bulletSystem;
private CameraSystem cameraSystem;
private RenderSystem renderSystem;

public GameScreen() {
    reactorController = new ReactorController();
    bulletSystem = new BulletSystem();
    cameraSystem = new CameraSystem();
    renderSystem = new RenderSystem();
}

Like all SpaceFloat Screens, when the show method is called, all the Game Screen dependencies have already been initialized, so it can inject the last dependencies into the systems, add these systems to the Engine and finally create the HUD.

@Override
public void show() {
    injectSystemsDependencies();
    addSystemsToEngine(getEngine());
    createHud(getStage());
}

private void injectSystemsDependencies() {
    Camera mainCamera = getCamera();
    cameraSystem.setCamera(mainCamera);
    renderSystem.setCamera(mainCamera);
    ParticleSystem particleSystem = getParticleSystem();
    reactorController.setParticleSystem(particleSystem);
    renderSystem.setParticleSystem(particleSystem);
}

private void addSystemsToEngine(Engine engine) {
    engine.addSystem(reactorController);
    engine.addSystem(bulletSystem);
    engine.addSystem(cameraSystem);
    engine.addSystem(renderSystem);
}

public void createHud(Stage stage) {
    HudFactory factory = new HudFactory();
    stage.addActor(factory.getFpsActor());
    stage.addActor(factory.getVelocityActor());
    stage.addActor(factory.getAccelerationActor());
    stage.addActor(factory.getEnergyActor());
}

Eventually, the update method becomes nothing more simple:

@Override
public void update(float delta) {
    super(delta);
    engine.update(delta);
}

To follow the pattern of previous posts, I conclude with an image of the HUD elements!

SpaceFloat HUD

Submitted (1 edit)

Space Float

Another month compressed in an archive.

Source code

If you want to look at the code, here is the repository on github.

Conclusion

Well, enjoy the game and tell us your opinions. If you like, you can vote for our entry at this link.

I would thank pasto for this outstanding month.
I leave with the last devlog.

Audio

The reproduction of sound effects in Space Float is performed via the singleton enum Audio. It has the attributes float volume and boolean mute, useful to manage audio centrally.

Through the methods play(Sound) and play(Sound, float) you can play sounds, respectively at default or specific volume.

private float volume = 1.0f;
private boolean mute = false;

public void play(Sound sound) {
    play(sound, volume);
}

public void play(Sound sound, float volume) {
    if (!mute) sound.play(volume);
}

If necessary, it is possible to loop a sound effect through the method loop(Sound) and stop playback through the method stop(Sound).

public void stop(Sound sound) {
    sound.stop();
}

public void loop(Sound sound) {
    if (!mute) sound.loop();
}