Provided more clarity to motivation section.

- Added init method to RotationManager
- Tweaked UTK readme
This commit is contained in:
Tony Bark 2024-05-07 15:21:15 -04:00
parent 97d94fb380
commit 65f4d35bf1
4 changed files with 37 additions and 25 deletions

BIN
docs/imgs/mysim-thumb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

View file

@ -1,8 +1,13 @@
# Motivation
<p align="center">
<img title="" src="imgs/mysim-thumb.png" alt=""">
</p>
Although an established reimplementation project already exists, it has excess legacy baggage due to it originally being based on .NET Framework 3.5 and XNA, causing plenty of performance issues and accessibility remains limited in its current form even after they've moved to MonoGame and .NET Framework 4.0. Meanwhile, NioTSO's foundation remains solid, even though it was never finished. The client perfectly simulates a loading screen, plus it can render Sims and objects flawlessly.
My Simulation began as a short-lived Sims 2 RPG forum created by Gaby, a friend I used to know. Previously, she created an earlier fan site called Sims2Fit. Following financial difficulties, the site was passed down to me. While I was too young to keep it running, at the time, I never let go of the name and what it stood for. It was fun.
The problem is C is, well, C. ¯\\\_(ツ)\_/¯ Accessing NioTSO's code in safer languages like Go or Rust has been historically difficult. Both comprise the language's promised safety in order to access vital APIs that make up the foundation of modern computing. While Zig is still in its infancy, the language's FFI is solid as well, and fully capable of directly accessing C APIs. Even when wrappers are used, it's a pretty thin layer that allow for idiomatic usage. So even though the language hasn't hit 1.0, as of this writing, you can still access plenty of mature APIs and make use of existing documentation without fear of breakage.
Although an established reimplementation of The Sims Online already exists, it has excess legacy baggage due to it originally being based on .NET Framework 3.5 and XNA, causing plenty of performance issues and accessibility remains limited in its current form even after they've moved to MonoGame and .NET Framework 4.x. Trust me, it's a pain to compile. Meanwhile, nioTSO's foundation remains solid, even though it was never finished. It renders Sims and objects flawlessly.
Will this succeed? *I have no idea*. I'm not much of a game developer, but that hasn't stopped me from dreaming. Your help is most welcome. My goal is to at least create a successful lot server for endless P2P fun.
The problem is C is, well, C. ¯\\\_(ツ)\_/¯ It is a powerful language, don't get me wrong, but I don't trust myself enough to use it. Accessing nioTSO's code in safer languages like Go or Rust has been historically difficult. Both comprise the language's promised safety in order to access vital APIs that make up the foundation of modern computing. While Zig is still in its infancy, the language's FFI is solid as well, and fully capable of directly accessing C code directly. No compiling required. Even when wrappers are used, it's a pretty thin layer that allows for idiomatic usage. Zig hasn't even hit 1.0 yet, and already you have an entire stable and mature ecosystem that you can use at the source level. That is unheard of.
This remake of The Sims Online aims to pays homage to My Simulation. Will this succeed in finishing this? _I have no idea_. I'm not much of a game developer, but that hasn't stopped me from dreaming. This is going to be a fun learning experience. That being said, your help is most welcome. I can't do this without you.

View file

@ -1,4 +1,4 @@
## EA MicroTalk
# EA MicroTalk
EA MicroTalk (also UTalk or UTK) is a linear-predictive speech codec used in
various games by Electronic Arts. The earliest known game to use it is
@ -11,22 +11,22 @@ Docs: http://wiki.niotso.org/UTK
In this repository, I have created a set of open source (public domain
via the UNLICENSE) MicroTalk decoders/encoders.
* Use utkdecode to decode Maxis UTK (The Sims Online, SimCity 4).
* Use utkdecode-bnb to decode PT/M10 (Beasts & Bumpkins).
* Use utkdecode-fifa to decode FIFA 2001/2002 (PS2) speech samples. This tool
- Use utkdecode to decode Maxis UTK (The Sims Online, SimCity 4).
- Use utkdecode-bnb to decode PT/M10 (Beasts & Bumpkins).
- Use utkdecode-fifa to decode FIFA 2001/2002 (PS2) speech samples. This tool
supports regular MicroTalk and MicroTalk Revision 3
[SCxl files](https://wiki.multimedia.cx/index.php/Electronic_Arts_SCxl).(*)
* Use utkencode to encode Maxis UTK. (This is the simplest container format and
[SCxl files](https://wiki.multimedia.cx/index.php/Electronic_Arts_SCxl).(\*)
- Use utkencode to encode Maxis UTK. (This is the simplest container format and
is currently the only one supported for encoding.)
(*) I wasn't able to find any real-world MicroTalk Rev. 3 samples in any games.
(\*) I wasn't able to find any real-world MicroTalk Rev. 3 samples in any games.
However, you can transcode a FIFA MicroTalk Rev. 2 file to Rev. 3 using
[EA's Sound eXchange tool](https://wiki.multimedia.cx/index.php/Electronic_Arts_Sound_eXchange)
(`sx -mt_blk input.dat -=output.dat`).
## Compiling
```
```bash
gcc -Wall -Wextra -Wno-unused-function -ansi -pedantic -O2 -ffast-math -fwhole-program -g0 -s -static-libgcc -o utkdecode utkdecode.c
gcc -Wall -Wextra -Wno-unused-function -ansi -pedantic -O2 -ffast-math -fwhole-program -g0 -s -static-libgcc -o utkdecode-fifa utkdecode-fifa.c
gcc -Wall -Wextra -Wno-unused-function -ansi -pedantic -O2 -ffast-math -fwhole-program -g0 -s -static-libgcc -o utkdecode-bnb utkdecode-bnb.c

View file

@ -7,9 +7,9 @@ const dbg = std.debug;
const GameScreen = enum {
login,
cas,
map,
lot,
cas, // Create-A-Sim
map, // city screen
lot, // world view
};
//We start that NorthWest so it is easy to determine the flip
@ -27,7 +27,12 @@ const Rotations = enum {
const RotationManager = struct {
Direction: CardinalDirection,
pub fn Rotate(self: *RotationManager, rotation: Rotations) void {
pub fn init(self: RotationManager) RotationManager {
return self;
}
pub fn rotate(self: *RotationManager, rotation: Rotations) void {
//rotate the direction by 90 degrees
var direction_index = @as(i8, @intFromEnum(self.Direction));
switch (rotation) {
@ -51,7 +56,7 @@ const RotationManager = struct {
}
};
// Still in the proof of concept phase, don't mind the mess
/// Still in the proof of concept phase, don't mind the mess
pub fn main() anyerror!void {
const screen_width = 800;
const screen_height = 600;
@ -85,7 +90,10 @@ pub fn main() anyerror!void {
const itemStatic = rl.Vector3.init(0.0, 1.0, 0.0);
const itemStaticSize = rl.Vector2.init(2.0, 2.0);
var rotation_manager = RotationManager{ .Direction = CardinalDirection.SouthEast };
var rotation_manager = RotationManager.init(.{
.Direction = CardinalDirection.SouthEast,
});
rl.setTargetFPS(60);
const logo = rl.Texture.init("resources/logo.png");
@ -112,14 +120,13 @@ pub fn main() anyerror!void {
// Update
// ------------------
switch (current_screen) {
// Skip straight to CAS (Create-A-Sim) until city server is complete
// TODO: Create login window with username, password, and server option
// Skip straight to lot view until city server is complete
.login => {
frame_counter += 1;
if (frame_counter > 120) current_screen = .lot;
},
//
// TODO: Write CAS (Create-A-Sim) screen
.cas => {},
.map => {},
.lot => {
@ -154,12 +161,12 @@ pub fn main() anyerror!void {
}
if (rl.isKeyPressed(rl.KeyboardKey.key_a)) {
lot_camera.position = rl.Vector3.init(-90.0, 20.0, 90.0);
rotation_manager.Rotate(Rotations.left);
dbg.print("Rotate left\n", .{});
rotation_manager.rotate(Rotations.left);
dbg.print("rotate left\n", .{});
} else if (rl.isKeyPressed(rl.KeyboardKey.key_d)) {
lot_camera.position = rl.Vector3.init(90.0, 20.0, 90.0);
rotation_manager.Rotate(Rotations.right);
dbg.print("Rotate right\n", .{});
rotation_manager.rotate(Rotations.right);
dbg.print("rotate right\n", .{});
}
// camera.update(rl.CameraMode.camera_custom);