• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Project Catraya: Future HTML5 OT like game

Under Influence

Advanced OT User
Joined
Jul 27, 2009
Messages
148
Reaction score
160
I've been working in a Tibia like game, which is rewritten from scratch from my old project Mil. The objective is not to copy original Tibia 100% but to make a game easy to modify (editing json files) and play (open browser and you are already playing).

I might release all the codebase when I see the project is good enough.

I parsed otbm Tibia 7.7 map format and reads item.otb/item.dat info as JSON => very easy to modify attributes and stats.
Technology: Backend is nodejs using nestjs/typescript and frontend is Phaser + Svelte. Dockerized.

So far, I'm working on movement, auto-pathing, z-index, item throwing, multi player interaction, etc. Ill have 2 weeks of vacations to progress this further, let's see how much I can accomplish :)

2020-01-18 19_06_47-.png2020-01-18 19_07_53-position.ts - catraya - Visual Studio Code.png2020-01-18 19_09_40-items.json - catraya - Visual Studio Code.png

The map I'm parsing: [7.6] All premium account dungeons in Tibia mainland (https://otland.net/threads/7-6-all-premium-account-dungeons-in-tibia-mainland.260314/)

Very old version of the project: My own html5 project: Mil Online (https://otland.net/threads/my-own-html5-project-mil-online.258399/)
 
Last edited:
Thanks, looks similar to how I created 'Mil' the first time, however I decided that using OT formats (otbm and otb) and 7.7 leak was better than starting from 0 and I improved the code a lot since then. I'm playing with parcels mechanics today :)
 
2020-01-20 14_00_02-Svelte app.png
2020-01-20 16_59_39-Catraya.png
Parsed spawns.xml into the game :)
Ill post another update next week. Going to work on monster movement and combat.

Spawn system is old school tibia, every Spawntime, it looks if the spawn square is not blocked and if there are no players on the screen. If you lure monsters outside of spawn, it can spawn again.

JSON Structure converted from xml
Code:
[{"name":"Orc","x":32011,"y":31561,"z":7,"spawntime":60}]

UPDATE Added monsters and window border to minimap, monster pathing and melee damage

Monster parsed to JSON:
 

Attachments

  • 2020-01-20 14_19_24-amazon.json - catraya - Visual Studio Code.png
    2020-01-20 14_19_24-amazon.json - catraya - Visual Studio Code.png
    25 KB · Views: 62 · VirusTotal
Last edited:
I like the client, not sure why it's being tied to a different server-base.
Server-side should be TFS, but I guess that can be done at a later date anyway.

gj đź‘Ť
 
I will release it when I have something demo'able, but my code is still lacking a lot of quality. Trying to get rid of new's inside of constructors atm, getting ride of dependencies like Pos shouldn't belong to player but to the tile where it is... at moment is still a big mess. I'm good with ideas, but bad to put them in practice. I already wrote everything from scratch like 3 times, since 3 years ago.

1586811301791.png
 
Last edited:
Impressive!

I'm glad to see that after all these years this community is still alive, and that potentially "game-changing" projects such as yours still appear from time to time.
 
I have gotten back to this project the last month, starting from scratch, the main goal is to run in the browser. It will look similiar to old school Tibia but will be a different game. I become better at programming from my job and other projects and with AI code help I feel that finally I will be able to finish it this time.

Language: typescript

  • I am using bun javascript runtime for the server and client which come out recently and it seems I can finally beat some performance bottlenecks
  • Client is using React-Konva to draw the canvas
  • Server/client communication with Websockets.
  • The game is being created using Entity-Component-System programming with a Shared folder between the server and the client.

Some example of the code
JavaScript:
import {
  EntityId,
  ComponentType,
  ComponentList,
  PosComponent,
} from 'ecs_bun_shared';
import { world } from 'world';

class PositionMap extends Map {
  set(entityId: EntityId, value: PosComponent) {
    const oldValue = systems.pos.get(entityId);
    if (oldValue) {
      world[oldValue.z][oldValue.y][oldValue.x].filter(
        (ids) => ids !== entityId,
      );
    }
    world[value.z][value.y][value.x].push(entityId);
    return super.set(entityId, value);
  }
  delete(entityId: EntityId) {
    const oldValue = systems.pos.get(entityId);
    if (oldValue) {
      world[oldValue.z][oldValue.y][oldValue.x].filter(
        (ids) => ids !== entityId,
      );
    }
    return super.delete(entityId);
  }
}

type SystemMap = {
  [key in ComponentType]: Map<EntityId, ComponentList[key]>;
};

export const systems: SystemMap = {
  attackTarget: new Map(),
  moveTarget: new Map(),
  destroy: new Map(),
  active: new Map(),
  spriteId: new Map(),
  socket: new Map(),
  dir: new Map(),
  pos: new PositionMap(),
  nameId: new Map(),
  speed: new Map(),
  health: new Map(),
  type: new Map(),
  packets: new Map(),
};

type InitialProps = {
  [key in keyof SystemMap]?: ComponentList[key];
};

export const createEntity = (initialProps: InitialProps, id: EntityId) => {
  for (const prop in initialProps) {
    if (systems[prop as keyof SystemMap]) {
      systems[prop as keyof SystemMap].set(
        id,
        initialProps[prop as keyof SystemMap],
      );
    }
  }
};

export const removeEntity = (id: EntityId) => {
  Object.values(systems).forEach((value) => {
    value.delete(id);
  });
};

The UI will be improved latter.

1694888862702.png
 
Last edited:
I dont want to make a tibia old school replica, there are too many games like that.

I want to base myself on old tibia mechanics like 7.1 and add some ideas of mine, I want skills to feel more like tibia, mining would work like fishing where you can try any of cave stone wall, instead of random pieces spread through the game likes other OTS.
 
Any chance this current version (or even the older ones, as you are starting again from scratch) will have a public repository?
 
I havent decided, the previous code doesnt look good enough, specially the client code. I did release the data files in json here (item characteristics for example), which is already a good starting point.


My server reads from otbm maps and spawn xml and crosses with json files information

and the previous incomplete server:

The code has performance issues and I reduced all the logic of creating entities/systems in one file now and got ride of classes, like the code in my post before, its all data. Classes use too much memory, now all the logic resides in the systems, entities are just a ID, components are just static typecheck. Now its a truly ECS.

Also changed the packet system to only send what is necessary, moved a lot of logic to the client for predition and with the shared folder I dont need to have duplicate client and server logic.
 
Last edited:
1696519506617.png
working in the fight system and containers (loot)

Im thinking of every action have 1 second cooldown, so that macroers wont get any advantage
 
Last edited:
Back
Top