Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RavenNine

Pages: 1 2 [3] 4
31
L2Player / Re: Lemmings 2 Data Formats
« on: December 23, 2021, 09:02:21 PM »
I agree and I am open to suggestions. The reason it isn't a one step deal as I would have to bundle a copy of Lemmings 2 with it. An alternative would be if I make it so you drop a copy of the Player into your DOS Lemmings folder and it does the rest. Same as say Doom/Quake .exe replacements.

I'll update it for the next test build.

32
L2Player / Re: Lemmings 2 Data Formats
« on: December 23, 2021, 12:51:31 PM »
I had a go at playing with the DOSBox Debugger MEMDUMP and Reko Decompiler. Thanks to your notes I was able to find the functions to compare with. The only difference was I needed to add 0x510 to all of the addresses. So I guess we are using different versions of Lemmings 2. From the looks of it, the negated variable used for the acceleration lookup is a temp var as I thought. So that fixes the oscillation issue. And the only other things are the order of operations for when it samples the y velocity before modifying it and it checks if > 7 rather than 8 for y velocity. I think it's all working now, but I will do some testing with the other objects that trigger the Flinger state.

This is the sanitised version of the disassembly for reference;

Code: [Select]

short accelArray[] = { 0, 0, 0, 1, 1, 2, 2, 3, 3, 8 };

typedef struct Lemming {
int16 posX; // 0x00 pos x
int16 posY; // 0x02 pos y
int16 fallDist; // 0x1E fallDist
int16 velX; // 0x22 vel x
int16 velY; // 0x24 vel y
int8 accX; // 0x26 acc x
int8 accY; // 0x27 acc y
} Lemming;

void fn0C00_C1B3(struct Lemming* lemming)
{
int16 xPos = lemming->posX;
int16 yPos = lemming->posY;
int16 xVel = lemming->velX;

if (xVel != 0)
{
if (xVel >= 0)
{
xPos += xVel;

if (xVel != 1)
{
lemming->accX--;

if (lemming->accX < 0)
{
--lemming->velX;
lemming->accX = 7;
}
}
}
else
{
xPos += xVel;

if (xVel != -1)
{
lemming->accX--;

if (lemming->accX < 0)
{
++lemming->velX;
lemming->accX = 7;
}
}
}
}

int16 yVel = lemming->velY;

if (yVel >= 0)
{
lemming->fallDist += yVel;
}
else
{
lemming->fallDist = 0;
}

lemming->accY--;

int16 newYPos = yPos + yVel;

if (lemming->accY < 0)
{
int16 yVel = yVel + 1;

if (yVel > 7)
{
yVel = 8;
}

lemming->velY = yVel;

int16 yVel2 = yVel;

if (yVel < 0)
{
yVel2 = -yVel;
}

lemming->accY = accelArray[yVel2];
}

lemming->posX = xPos;
lemming->posY = newYPos;
}

I will come back to you with my findings to make sure it all works.

If all is well, that just leaves figuring out the initial velocity and acceleration values for each Flinger object etc. which you have already given me a good head start on.

Again, thanks for all your help and notes :)

33
L2Player / Re: Lemmings 2 Data Formats
« on: December 21, 2021, 07:09:35 PM »
Have you put a copy of Lemmings 2 for MS-DOS in the data/dos sub directory?

If you see my post for Test 1 it has further instructions. If that doesn’t work, please let me know.

34
L2Player / Re: Lemmings 2 Data Formats
« on: December 20, 2021, 01:15:48 AM »
I thought it matched at first, but then it only worked for the first of the three launchers. I've been trying varying permutations, but I either over or undershoot the target. Not sure I can see the wood for the trees anymore lol.

I attached the code I am using. I could be wrong or missing something.

The only real change I made was this line;
(Otherwise it causes lemming to oscillate on Y after its negated for array lookup when < 0)

lemming->y_pos = y_position + dY;

to...

lemming->y_pos = y_position + lemming->dY;

I already ruled out my sub-step logic as the results are the same when I simply add the differences directly to the position.

No worries if you don't get change to take a look. If I don't hear from you, hope you enjoy the holidays.

35
L2Player / Re: Lemmings 2 Data Formats
« on: December 19, 2021, 10:49:40 AM »
Apologies. My mistake. I misread your initial values. If I initialise Lizard Launcher with ddx: 2 and ddy: 7 it works. If I initialise the other way around as written, the lemming falls way short. For initialisation is the lookup done on ddy or ddx?

Thanks.

36
L2Player / Re: Lemmings 2 Data Formats
« on: December 19, 2021, 10:13:47 AM »
The Lizard launchers now match perfectly :)

Thanks again.

Out of curiosity, is this code from part of a bigger project you're working on? Or is it purely curiosity into the inner workings of Lemmings 2 physics?

Don't by any chance have any insight into the .gal file format found in the script sub directories do you? (On the off chance)

37
L2Player / Re: Lemmings 2 Data Formats
« on: December 19, 2021, 08:32:47 AM »
Thank you for confirming and your help. I will take another look :)


38
L2Player / Re: Lemmings 2 Data Formats
« on: December 18, 2021, 04:17:49 PM »
Test Build 2

The first 10 levels of Classic can now be played with all 8 skills available to Classic. The level select screen will let you continue past Classic 10 into the other Tribes. This is more for curiosity if you are interested in seeing the progress made to level and object rendering for the later tribes. You can choose the skills on the skill bar. They just won't do anything.

Windows: https://drive.google.com/file/d/11rOFAlbql-uzNOncFyQ6LBhw_iovVRxI/view?usp=sharing
Linux: https://drive.google.com/file/d/1Nt5dzERC6JPIS_JFu0e-GN8H76j49dRZ/view?usp=sharing

Note: If you have already tried the first Test Build, you would need to start clean with the cache directory and the root level directory with the binaries.

Changes

- Skill counts now updated when used.
- Digger/Basher/Miner can now change skills
- Press B to toggle Debug brush mode. (LMB paint terrain, RMB clear terrain)
- When building cache now reports which source DOS files are missing if any.
- Keyboard mappings added. (F1-F8, Space, P, Return, Z, X, Escape)
- Switched to OpenGL 3.3 Core (Removes COMPAT flag requirement on Linux)
- Builder collision checks fixed
- Builder brick offset bug fixed (2 pixels where lemming stood missing)
- Builder brick now overhangs 5 pixels facing right and 4 pixels facing left when stood on last pixel of a ledge
- Windows builds now include OpenAL
- Added level selection (Only Classic levels currently)
- Centered level title/time layout on level select screen
- Cleaned up cache format.
- Image data is now compressed.
- .NET runtimes are now compiled into the executable and extracted directly to RAM. (Much less clutter)
- Exploder skill now behaves accordingly when in Classic vs other tribes.
- Each tribe uses its own Exit animation.
- Floater animation fixed.
- Fast-Forward not resetting when changing level fixed.

39
L2Player / Re: Lemmings 2 Data Formats
« on: December 18, 2021, 03:20:13 PM »
A quick preview from the filler class which will handle Fill, Glue and Sand...

40
L2Player / Re: Lemmings 2 Data Formats
« on: December 18, 2021, 01:21:41 PM »
Thanks. Interesting read so far. I created a fork to test your physics code. The attachment shows a comparison of the Lizard launchers. The objects stored in the style set the initial launcher velocity to x: -10, y: -5. I'm not sure if the initial acceleration values are the same across the board or if there is an acceleration table per skill, but I get somewhere close with initial acceleration of x: 3, y: 7. The screenshot shows the landing zone off by 2 pixels.

My hunch is that there are multiple acceleration tables as the arc at it's peak feels too sharp for launchers vs DOSBox. From testing I found that when hitting a wall, the remainder of the amount to add to the x position is reflected which causes the lemmings to splat at the same point after the third Lizard.

The main modification I made to your code was add collision detection and have it sub-step the x/y differences rather than just add it to the position for collision accuracy.

Looks like you might be onto a winner :)

41
L2Player / Re: Lemmings 2 Data Formats
« on: December 17, 2021, 09:01:00 PM »
Anything that helps. Thanks. I've made some progress already on the physics using frame analysis. So far I get identical frame-for-frame trajectories on trampolines, launchers, cannons etc. But any insight to how it was actually done would help for sure.

Currently the lemmings have two movement modes. Animation driven and physics sim depending on the skill/state. The physics sim uses fixed-point math for deterministic results. Each delta is sub-stepped at the pixel level to prevent some of the glitches found in the original. e.g. The Nuke fling pushing lemmings inside terrain at certain angles/velocities or some of the amusing Super Lemming glitches.

42
L2Player / Re: Lemmings 2 Data Formats
« on: December 15, 2021, 07:23:36 PM »
Thanks for the feedback :)

I have now switched to OpenGL 3.3 Core profile and removed the requirement for the COMPAT flag. (I was using Quad primitives instead of Triangle for drawing the Blitter Buffer texture to screen. Quad not supported in Core)

Good catch, my MakeBrick routine was placing the first 2 pixels on top of the first 2 which represent the brick in the animation. I'll take a look at the left/right differences too.

Currently the skill assign logic works as follows;

- Check if Walking state
- Check if already running a skill
- Check if already has a permanent skill
- Special case for Blocker

This is rudimentary and doesn't reflect the game as you know :)
At some point I will need to look into and compile a list of which skills can be interrupted. And which states allow for assignment of permanent skills. e.g. Kayaker - Must be in drown state

<Edit>: The pdf manual contains all of this info in a handy list ;)

The floater seems to be skipping the first few frames of the looping part. Should be a quick fix.

:D even when I played it on my Amiga 500 back in the day I never learned the keyboard shortcuts. Even on the DOS version. But I do appreciate its more efficient for Fast-Forward and Pause/Resume etc. I'll get those worked in for the next test release as I now have a PDF of the original game manual.

Yea, the idea is that the only asset dependencies are the original game files. Eventually the player will have a level and style editor so you can easily make new levels/objects/brushes and create new styles if you want to. However, any levels/styles created will be in the new player format. So will only work with the player. However, you can still import L2 levels made by other tools as long as they adhere to original game format/rules.

The next test release will let you test all 10 Classic levels and switch between them on the level select screen.

As always, I appreciate the time and effort people have put in to provide feedback and answer my endless and hopefully not too annoying queries :)


43
L2Player / Re: Lemmings 2 Data Formats
« on: December 15, 2021, 11:38:57 AM »
For anyone interested, here are the test builds to go with the above preview;

They are built bundled with .NET runtimes. OpenAL is required to run.
To get started, copy your version of Lemmings 2 for MS-DOS into the data\dos subfolder that was extracted with the .zip. On first run you will be prompted to unpack and create a cache.

If you want music, you will need to copy .mod versions of the Lemmings 2 music into the data\music subfolder. (See Readme.txt within data\music)

To force a cache rebuild at any point. Start L2Player with the unpack argument.
Code: [Select]
L2Player unpack
Any feedback would be greatly appreciated :)

Windows Binaries: https://drive.google.com/file/d/1XX8m3ab7RY-jrHzdbx2ZZD4pqYs4EJAI/view?usp=sharing
Linux Binaries: https://drive.google.com/file/d/1FwohvDnKrJJGcR9aaUQ1pSHDngpStBMh/view?usp=sharing

OpenAL Installer for Windows: https://www.openal.org/downloads/
OpenAL for Linux (Ubuntu/Debian):
Code: [Select]
sudo apt-get install libopenal-dev

44
L2Player / Re: Lemmings 2 Data Formats
« on: December 15, 2021, 01:53:13 AM »
Just a little progress update. Main game loop is now in place and have begun implementing the first 8 skills required to complete Level000 (Classic 1).
Still a few quirks to iron out with the Miner (Clipped animation) and Builder (First brick offset) skills. The Lemmings can exit the level as triggers are fully working.

Here is a short video showing off skill usage and my progress so far;

https://youtu.be/4THvCC1z60Y

45
L2Player / Re: Lemmings 2 Data Formats
« on: December 09, 2021, 01:53:28 PM »
Makes sense now that you have said it :) ArmWaving was the best description I could think of at the time lol.

Thanks for the help.

Pages: 1 2 [3] 4