Recent Posts

Pages: 1 ... 8 9 [10]
91
Project announcement / Re: Sonic Z-Treme
« Last post by XL2 on October 20, 2018, 02:29:35 am »
So I got the BSP tree, portal generation and PVS all working.
Using a BSP is really a game changer, it's 10000% better than any previous solutions I used.
The only cost is extra geometry after splitting and a requirement that the levels need to be "closed off".

I would be possibly to use an octree for rendering and a BSP for collision/line of sight/raytracing, but so far I really like the BSP tree and it's perfect for corridor shooters.

Here are screenshots (in OpenGL, but I try to micmic the way the Saturn renders everything, with no texture coordinates and per vertex lighting).

Thanks to the BSP tree, adding lighting took only 1 hour or so.
It's just that great.
Since I am now using a PVS, I won't need the smooth fade-in/out anymore as I won't have a draw distance limit, so I can use RGB 4 bpp and gouraud shading on everything with no issues...so colored lighting works perfectly.

92
Jo Engine Wish List / Re: Object library
« Last post by juangenial452 on October 19, 2018, 11:31:07 pm »
I don't understand that. It looks very confusing.
93
Jo Engine Wish List / Re: Object library
« Last post by ponut64 on October 19, 2018, 09:32:28 pm »
Those are abstractions of creating sprites, defining a location, and so forth yes?

If so, you can create those yourself.

Here's an example of how that looks in 3D:

Code: [Select]
void	stuff2(Uint8 entity_number, Sint16 loc[XYZ]){
slPushMatrix();
jo_3d_translate_matrix(loc[X], loc[Y], loc[Z]);
display_ztp(&entities[entityNumber], false);
slPopMatrix();
}
To remove that, you set up a condition wherein it is included or not included in the runtime.

Of course you want things structured a little differently, but know this:
Much of your object data is the textures and model data itself, which is already contained and can be referenced and edited.
There are also jo_sprite and jo_vector data handlers that you can integrate into your ideal concept of "jo_object".

What I read below like "jo_create_object" and "jo_delete_object" are structured as if console commands to be used in runtime and run only once.
The "run only once part" complicates the structure of your code as what you are presently working with in jo engine is a giant loop.

You might also be confused by how to organize your matrix, but I'm sure you can figure that one out with trial and error.
94
Jo Engine Wish List / Object library
« Last post by juangenial452 on October 19, 2018, 05:03:33 pm »
Something like:
Code: [Select]
jo_object Obj01;
jo_create_object(ring.h, Obj01);
jo_add_object(Obj01, x, y);
jo_delete_object();
jo_delete_all_objects();
Is possible?
96
Nova and Mednafen cannot be trusted. (Especially Nova!)
If it works correctly in Bizhawk, SSF, and Yabause, it probably also works correctly on real hardware.
I do not know what else to tell you.
97
It does that in Nova and Mednafen, but in SSF and Yabause it loads correctly.
98
How do other emulators behave? (Bizhawk and SSF)

And if it ever appears, it is clearly getting into memory.
99
When I run my game emulating Saturn BIOS the map doesn't load. It appears and disappears. Anyone can help me?
Here's the code:
Code: [Select]
/*
** Jo Sega Saturn Engine
** Copyright (c) 2012-2017, Johannes Fetz (johannesfetz@gmail.com)
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
**     * Redistributions of source code must retain the above copyright
**       notice, this list of conditions and the following disclaimer.
**     * Redistributions in binary form must reproduce the above copyright
**       notice, this list of conditions and the following disclaimer in the
**       documentation and/or other materials provided with the distribution.
**     * Neither the name of the Johannes Fetz nor the
**       names of its contributors may be used to endorse or promote products
**       derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <jo/jo.h>
#include "sonic.h"
/*
** SPECIAL NOTE: It's not the Sonic that I'm working on, but you can now write your own :)
*/

jo_sidescroller_physics_params  physics;
static int map_pos_x = WORLD_DEFAULT_X;
static int map_pos_y = WORLD_DEFAULT_Y;
static jo_sound     jump;
static jo_sound     roll;
void            reset_demo(void)
{
    map_pos_x = WORLD_DEFAULT_X;
    map_pos_y = WORLD_DEFAULT_Y;
    player.x = 160;
    player.y = 70;
    player.angle = 0;
    player.flip_sonic = false;
    player.spin = false;
    player.can_jump = true;
}

bool          has_vertical_collision(void)
{
    player.can_jump = false;
    if (physics.speed_y < 0.0f)
    {
        physics.is_in_air = true;
        return false;
    }
    int dist = jo_map_per_pixel_vertical_collision(WORLD_MAP_ID, map_pos_x + player.x + SONIC_WIDTH_2, map_pos_y + player.y + SONIC_HEIGHT, JO_NULL);
    if (dist == JO_MAP_NO_COLLISION || dist > 0)
    {
        if (dist != JO_MAP_NO_COLLISION && dist < SONIC_JUMP_PER_PIXEL_TOLERANCE)
            player.can_jump = true;
        physics.is_in_air = true;
        return false;
    }
    if (dist < 0 && jo_is_float_equals_zero(physics.speed_y))
        player.y += dist;
    player.can_jump = true;
    physics.is_in_air = false;
return true;
}

inline bool      has_horizontal_collision(void)
{
    int         next_pixel;

    next_pixel = jo_physics_is_going_on_the_right(&physics) ? player.x + 4 :
                 jo_physics_is_going_on_the_left(&physics) ? player.x - 4 :
                 player.x;
    int attr = jo_map_hitbox_detection_custom_boundaries(WORLD_MAP_ID, map_pos_x + next_pixel + SONIC_WIDTH_2, map_pos_y + player.y, 4, 20);
    if (attr == JO_MAP_NO_COLLISION)
        return false;
    if (attr != MAP_TILE_BLOCK_ATTR)
        return false;
    return true;
}

void     sonic_collision_handling(void)
{
    if (has_vertical_collision())
        physics.speed_y = 0.0f;
    else
    {
        jo_physics_apply_gravity(&physics);
        player.y += physics.speed_y;
    }
    if (has_horizontal_collision())
        physics.speed = 0.0f;
    else if (physics.speed > 0.0f)
        map_pos_x += physics.speed < 1.0f ? 1.0f : physics.speed;
    else if (physics.speed < 0.0f)
        map_pos_x += physics.speed > -1.0f ? -1.0f : physics.speed;
}

inline void     camera_handling(int prev_y)
{
    int         delta;

    delta = JO_ABS(player.y - prev_y);
    if (player.y > 100)
    {
        map_pos_y += delta;
        player.y -= delta;
    }
    else if (player.y < 50)
    {
        map_pos_y -= delta;
        player.y += delta;
    }
}

inline void     my_draw(void)
{
    int         prev_y;

    jo_map_draw(WORLD_MAP_ID, map_pos_x, map_pos_y);
    prev_y = player.y;
    sonic_collision_handling();
    camera_handling(prev_y);
    if (!physics.is_in_air)
        sonic_running_animation_handling();
    display_sonic();
}

inline void     make_sonic_jump(void)
{
    player.roll = false;
    player.can_jump = false;
    player.spin = true;
    jo_physics_jump(&physics);
    jo_audio_play_sound_on_channel(&jump, 0);
}

inline void     my_input(void)
{
printf(0, 0, "caca %d", player.sdvel);
    if (physics.is_in_air)
    {
        if (jo_is_pad1_key_pressed(JO_KEY_LEFT))
        {
            player.flip_sonic = true;
            jo_physics_accelerate_left(&physics);
        }
        else if (jo_is_pad1_key_pressed(JO_KEY_RIGHT))
        {
            player.flip_sonic = false;
            jo_physics_accelerate_right(&physics);
        }
    }
    else
    {
if (!player.roll){
        if (jo_is_pad1_key_pressed(JO_KEY_LEFT))
        {
            player.flip_sonic = true;
            if (jo_physics_is_going_on_the_right(&physics) || jo_physics_should_brake(&physics))
                jo_physics_decelerate_left(&physics);
            else
                jo_physics_accelerate_left(&physics);
        }
        else if (jo_is_pad1_key_pressed(JO_KEY_RIGHT))
        {
            player.flip_sonic = false;
            if (jo_physics_is_going_on_the_left(&physics) || jo_physics_should_brake(&physics))
                jo_physics_decelerate_right(&physics);
            else
                jo_physics_accelerate_right(&physics);
        }
        else
            jo_physics_apply_friction(&physics);
}else{
            jo_physics_apply_friction(&physics);
}
    if (jo_is_pad1_key_pressed(JO_KEY_DOWN) && (int)JO_ABS(physics.speed) >= 4){
    jo_audio_play_sound_on_channel(&roll, 0);
            player.roll = true;
            player.spin = true;
}
    if (jo_is_pad1_key_down(JO_KEY_START))
        reset_demo();
if (!player.duck){
    if (player.can_jump && jo_is_pad1_key_down(JO_KEY_A))
        make_sonic_jump();
    if (player.can_jump && jo_is_pad1_key_down(JO_KEY_B))
        make_sonic_jump();
    if (player.can_jump && jo_is_pad1_key_down(JO_KEY_C))
        make_sonic_jump();
}else{
    if (player.can_jump && jo_is_pad1_key_down(JO_KEY_C)){
player.sdvel += 2;
    jo_audio_stop_sound(&roll);
        jo_audio_play_sound_on_channel(&roll, 0);
        player.spindashing = true;
}
}
if (jo_physics_is_standing(&physics)){
player.roll = false;
}
}
}

void load_map(void)
{
    jo_sprite_add_image_pack("BLK", "BLK.TEX", JO_COLOR_Red);
jo_map_load_from_file(WORLD_MAP_ID, 500, "MAP", "DEMO2.MAP");
}

void load_background(void)
{
    jo_img      bg;

    bg.data = JO_NULL;
    jo_tga_loader(&bg, "BG", "BG.TGA", JO_COLOR_Transparent);
    jo_set_background_sprite(&bg, 0, 0);
    jo_free_img(&bg);
}
void            load_sounds(void)
{
jo_audio_load_pcm("JUMP.PCM", JoSoundMono16Bit, &jump);
jo_audio_load_pcm("ROLL.PCM", JoSoundMono16Bit, &roll);
}
void jo_main(void)
{
jo_core_init(JO_COLOR_Black);
    jo_printf(0, 29, "Cargando...");
    load_sonic();
    load_background();
load_map();
load_sounds();
    jo_physics_init_for_sonic(&physics);
    reset_demo();
    jo_printf(0, 29, "Sonic Saturno 0.5");
jo_core_add_callback(my_draw);
jo_core_add_callback(my_input);
jo_core_run();
}

/*
** END OF FILE
*/
100
Feature Request - Animated Color Palette - Color Cycling/Palette Shifting

Currently when creating effect of animated texture it is usually necessary to store multiple frames of animation,
causing increased memory usage and resulting in animation that is not smooth if there are not enough frames.

I would like to request following feature: Animated Color Palette - Color Cycling/Palette Shifting.

This technique allows you to create complex and smooth animations of things like for example fire or flowing water,
but it only swaps/animates color palette, and pixels of picture/texture remain unchanged(in other words, there is
only one picture), and seems to be intended for very limited hardware.

Following links give example demos of such technique, including animation of full day and night cycle
(click "Show Options >>" to see color palette cycling):

http://www.effectgames.com/demos/canvascycle/
http://www.effectgames.com/demos/worlds/

FAQ > Color Cycling 8bit Art:
http://markferrari.com/faq/color-cycling-8bit-art/

GDC Presentation by author discussing use of this technique:
https://www.youtube.com/watch?time_continue=2&v=aMcJ1Jvtef0

Please let me know about feasibility of adding this feature.


Pages: 1 ... 8 9 [10]
SMF spam blocked by CleanTalk