• 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!

Source's custom OT game engine (TypeScriptFTW)

So yes, monsters on the whole map move around without players (as I understand).
So, with 10,000 monsters all executing random movements, including executing to check if a tile is walkable. That is very bad logic and a huge cost.

And if you're looking for a shortest path algorithm to find the nearest target, I made my own version based on Dijkstra's shortest path algorithm. His method is probably one of the best.

Anyway, I wish you the best of luck with your development. I was also at your stage testing out stuff and trying to reinvent the wheel, but sometimes the most efficient ways already exist and I'm sure you will figure that out, but keep it up :)
 
Implemented gameGetCreatures(...) today, took it for a spin and compared it with TFS.

TFS
cHk4HtK.png


TSS
pi8Lq1l.png


Quick reference for all your questions:
  1. Yes, it's multifloor.
  2. Yes, I made sure to test that it actually get surrounding creatures, on all floors, in 18x14 squares.
  3. Yes, the code on both sides is basic.
  4. Yes, both sides had an equal amount of creatures on screen.
  5. And sure, higher numbers are better, whatever you say hehe.

Here's the full code of the script I used on TFS side (same code I used for event benchmark with that part commented out):
Code:
local counter = 0
local start
local range
local mode = 'seq'
--local mode = 'par'

function onSay(player, words, param)
	print("/bench was called")
	start = getMicrotime()
	getSpec(player)
--	range = 10000
--	if mode == 'seq' then
--		addEvent(callback, 0)
--	else
--		for i=1,range do
--			addEvent(callback, 0)
--			--callback()
--		end
--	end
end

function getSpec(player)
	-- centerPos, rangex, rangey, multifloor, onlyPlayers
	spectators = getSpectators(player:getPosition(), 18, 14, true, false)
	print(string.format("Time elapsed: %fµs", (getMicrotime()-start)*1000000))
end

function callback()
	counter = counter + 1
	--print(counter)
	--print(time, count)
	if counter >= range then
	--	addEvent(callback, 0.1, start, count+1)
	--else
		print(string.format("Counter: %d. Time elapsed: %fms", counter, (getMicrotime()-start)*1000))
		counter = 0
	elseif mode == 'seq' then
		addEvent(callback, 0)
	end
end
 
Alright, so a "short" update since last time:

Between January 14th into February the 7th I added all the basic multiplayer functionality so players can see each other logging in, logging out, walking around, teleporting, pushing each other, setting player color/intensity (shared), made cipclient work fully, added version 7.70 alongside version 7.72, so you can login with either client at any or the same time. I also tried to add 7.6 version by disabling encryption with version 7.6, other than soul I think there are more protocol differences that made it not work (yet), probably not really worth adding anyhow.
Fixed a bunch of bugs, core optimizations, added some testing functionality/easter eggs, added functions, simplified functions, improved RSA setup/class (now only needs P and Q and the rest is calculated).

By February 18th I fixed everything related to map clicking. I added a unique optimization that I've never seen before in any OT. I won't spoil what it is, but once I launch a testserver someone with a very keen eye might notice it, the performance improvement can range from anything between 10% to a 500% performance improvement when using this specific function depending on the circumstances (I engineered it so it will always be more performant than the original function, if it's less performant then the conventional standard is used instead), so it's a major improvement if relied on heavily for certain custom OTs.
I started rewriting one of the largest classes in pure C++ which is compiled into so/dll's and imported at runtime with the long-term goal of having most if not the entire server written in C++, this way I can reuse all the components either in other C++ projects as code or as libraries that I can simply import and use directly.
I also started trying to learn about and implement A*, something I've been dreading since last year (last year I was trying to just think about it conceptually and my mind was kinda blown), but finally "felt ready" to try it out. I first wrote my own sketch with basically no prior knowledge, then had to read a little bit about the basic concept, 1-2 days later I made a basic (buggy) version and later implemented the entire thing.

By March 4th I fully finished implementing A* including checking for items and creatures, calculating tile speeds, prioritizing non-diagonal movement at all cost (I found a funny "bug" where actually it's the fastest to randomly make a diagonal step where new tile speed > 3x old tile speed, but this isn't how Tibia works, so had to add a caveat for that, etc). I also spent the longest time (almost a week) just figuring out how to properly use a priority queue in C++ for A* as I had no previous experience with this, only after implementing my own priority queue I realized what the issue was (a seemingly "minor" thing with huge effect). And also some other major design optimizations.

By March 13th I fixed more bugs, 1 minor bug in A*, 1 trivial segfault (poor coding, I sometimes write in a hurry and don't read what I'm even typing), added "turnTo" functionality for monsters (and players) i.e. turning in the direction of another creature (not implemented in monsters behavior yet, just as a command for players), improved/simplified the design of a couple of functions, added /n and alito tera, and "many more" (definitely a few more) according to my git commit.

By April 4th I added automatic map refresh every x seconds (currently 5 minutes) with 60sec pre warning which can be turned off by a God in-game, rewrote my command system (much cleaner, simpler, and also faster, where each command is added with a single function call that sets the command keyword(s), function, command syntax, command description, and permission required to call the command).
Rewrote more classes in pure C++. Improved Windows compilation (no need to double click a batch shortcut anymore, the new Linux compilation shell script can be called directly in WSL (or in batch, but I prefer running it in WSL) which also sends the files over to my Windows desktop computer where I can run the server and goof around).
A few more minor things: more talkactions (alevo, alani and others), new files, etc. Alani and alevo has all the original cip mechanics.


I think one of the fun things about exploring this server is that everyone are GMs, there's a bunch of commands (about 25 enabled ones) and unique features you've probably never experienced on any other OT, not saying they're all amazing, but they're definitely pretty unique. It's also a good "debug server" if you run your own server, e.g. to test missile effect ids, color values, light values, test different player speed values, or as a player want to practice aiming with objective performance stats, etc, functionality you won't find builtin into any other OTs afaik.
I'm also planning on maybe implementing more easter egg functionality, or like doing certain quests that grants you "passwords" like in oldschool games that gives you access to more commands and features.
But before that I have to clean up/finish some stuff, and atm I'm prioritizing rewriting classes in pure C++ and others.

Here's a silly video of a bug I encountered and recorded at the 25th of Jan when I was fixing all basic multiplayer functionality like walking and pushing etc:

I've also pretty much finished my OTClient project that I've also been working on for years now. I haven't added anti-cheating/anti-re yet, and there's still a few more bugs, but all the most important (to me) bugs and oldschool cip mechanics has been implemented seemingly flawlessly, like the exact same cip tooltip functionality, minimap, compass, hotkeys (there's like 10 different minor fixes just for hotkeys) and all other windows down to the tee. I.e. when you push a stack of item the "type a number" functionality works flawlessly, not only up to but beyond a count of 100, and pretty much all the UI has been designed down to the finest detail, like how large the "stack bar" should be (cip client bar is at like 99% with 2 items, 97% at 3 items, etc, I couldn't determine an actual algorithm to calculate the number of total items to pixel size, so I hardcoded every single pixel size from 2 to 100 items in C++ for the horizontal scrollbar), just as an example of my dedication. I've compared the "skills" window (like every other window) between cip client and my OTClient with a magnifying glass at 4000% zoom to determine the exact spacing between each line, the exact color, exactly where the "tooltips" should show up, etc, same with things like lighting, translucent light (light coming from "cracks" in the roof in the underground floor), popup window behavior, VIP sorting algorithms, right click options orders, options ending up "outside of client", min and max sizes, being able to reduce the "chat window" to the same extent as cip client, "Edit Mark" option, and many many more bug fixes and mechanics, I have like a list of 100+ points and I probably don't mention about 100-200 others that I don't want to share because they're too valuable compared to the amount of work needed to fix them to be shared publicly. The only thing I haven't accomplished yet is the original Tibia fonts (hired multiple high end developers to try to work it out, but none of them could figure it out, they all added some font, but none of them were the right font, I haven't been bothered to try myself yet), the inventory UI isn't flawless yet (probably last thing I'm gonna add before releasing/launching), and there's some minor bugs that hasn't been fixed yet, like long lines in books are hidden behind the "scrollbar", this is one of many hundreds generic unsolved OTClient bugs.

In addition I've also got a decent basic audio system working with a couple of test sounds (no sound interruption), very heavy OTClient (WBC) encryption and builtin cam system (recorder/playback) working for most Tibia versions.
I'm also considering adding things like 4K support, I use 4K personally, though I doubt most players will actually run Tibia in 4K.

But yeah, hopefully I might launch a server this year, and not just a test/GM server which is almost certainly gonna happen this year.
 
Last edited:
I think you got a bug in your cast system here tho:

There were a lot of bugs, I had the cast system of monsters-idea the night before streaming, did a 5min dirty hack to try it out/see if it a really simple solution could work, it worked as a temporary hack, went to bed, and spent a couple of hours the next day implementing the basics of the system in a more proper way right before I started streaming.

For anyone curious about how it basically looked like the first time I added the 5min dirty hack for casting the night before:


Time for another update:

I'll start with a summary / couple of general realizations since the last update.
  • Since the stream I've mainly been working on the castsystem for at least the first week, but I also found a lot of other bugs thanks to adding/trying this system out, helping me to explore the entire map and every single monster without having to lift a finger.
  • I realized that the multi-protocol system I mentioned in the beginning of my last update post is going to be more complicated than I thought (after making logging in with 7.6 actually work), in fact I was about to give up and thought it wasn't possible at some point until I realized there's technically still one more option left using ML. So I've spent a lot of time on that, then needed a break, and is something I will get back to again later. I even wrote my own client sided sprite analyzer in JS to manually compare sprites between different protocol versions to evaluate the ML results, parsing the ML results if available.
    I'd post a screenshot if I still had access to my desktop computer's files, but since yesterday I decided to try to lets just say move to a more sophisticated setup where I can start streaming however much I want without it interfering with me watching youtube etc, and I messed up, so the desktop is currently running e2fsck in a for loop in sh looking for my ext4 partition :)

Bugs fixed:
  • Magicthrowers etc outfits
  • Tons of minor and major casting bugs (most things works now, casting monsters, casting players, caster being teleported, caster receiving messages, items moving, caster moving, effects, pretty much everything except for a few things that needs some more fine tuning)
  • Alito tera (destroy field) removed monsters as well on client side

Other features:
  • Added full loot generation to monsters on spawn with Real Tibia system and correct ordering both on generation and drop
  • Added in-game Tibia time with the exact same pace and sync as Real Tibia + all the original Real Tibia worldlights changing at the exact same times as Real Tibia did in 7.7
  • Monsters immune to certain elements are now able to move onto fields of corresponding elements w/ effect
  • Monsters load much more data now; capacity, flags, exp, skills, ++
  • Opening containers, containers within containers, containers in new windows, and move to parent container now works (containers are also closed if already open, however this is partially bugged atm, when old container is closed the new one becomes unresponsive for some reason; dw not looking for advice, there's always tons of bugs and I always figure them out)
  • Added /rotation feature, allowing GMs to either get randomly teleported to any walkable tile on the map or to a random monster every x seconds (for fun/custom feature)
  • Bunch of other internal improvements

There are still plenty of more basic bugs left and things to do, and as usual I'll be continuing on working on whatever I feel like at the time.

Here's an interesting bug I found at Orc Fortress recently that I really don't understand:

I've also been trying to come up with a better name for the project. Let me know if you have any suggestions or ideas for a better name.
 
There were a lot of bugs, I had the cast system of monsters-idea the night before streaming, did a 5min dirty hack to try it out/see if it a really simple solution could work, it worked as a temporary hack, went to bed, and spent a couple of hours the next day implementing the basics of the system in a more proper way right before I started streaming.

For anyone curious about how it basically looked like the first time I added the 5min dirty hack for casting the night before:


Time for another update:

I'll start with a summary / couple of general realizations since the last update.
  • Since the stream I've mainly been working on the castsystem for at least the first week, but I also found a lot of other bugs thanks to adding/trying this system out, helping me to explore the entire map and every single monster without having to lift a finger.
  • I realized that the multi-protocol system I mentioned in the beginning of my last update post is going to be more complicated than I thought (after making logging in with 7.6 actually work), in fact I was about to give up and thought it wasn't possible at some point until I realized there's technically still one more option left using ML. So I've spent a lot of time on that, then needed a break, and is something I will get back to again later. I even wrote my own client sided sprite analyzer in JS to manually compare sprites between different protocol versions to evaluate the ML results, parsing the ML results if available.
    I'd post a screenshot if I still had access to my desktop computer's files, but since yesterday I decided to try to lets just say move to a more sophisticated setup where I can start streaming however much I want without it interfering with me watching youtube etc, and I messed up, so the desktop is currently running e2fsck in a for loop in sh looking for my ext4 partition :)

Bugs fixed:
  • Magicthrowers etc outfits
  • Tons of minor and major casting bugs (most things works now, casting monsters, casting players, caster being teleported, caster receiving messages, items moving, caster moving, effects, pretty much everything except for a few things that needs some more fine tuning)
  • Alito tera (destroy field) removed monsters as well on client side

Other features:
  • Added full loot generation to monsters on spawn with Real Tibia system and correct ordering both on generation and drop
  • Added in-game Tibia time with the exact same pace and sync as Real Tibia + all the original Real Tibia worldlights changing at the exact same times as Real Tibia did in 7.7
  • Monsters immune to certain elements are now able to move onto fields of corresponding elements w/ effect
  • Monsters load much more data now; capacity, flags, exp, skills, ++
  • Opening containers, containers within containers, containers in new windows, and move to parent container now works (containers are also closed if already open, however this is partially bugged atm, when old container is closed the new one becomes unresponsive for some reason; dw not looking for advice, there's always tons of bugs and I always figure them out)
  • Added /rotation feature, allowing GMs to either get randomly teleported to any walkable tile on the map or to a random monster every x seconds (for fun/custom feature)
  • Bunch of other internal improvements

There are still plenty of more basic bugs left and things to do, and as usual I'll be continuing on working on whatever I feel like at the time.

Here's an interesting bug I found at Orc Fortress recently that I really don't understand:

I've also been trying to come up with a better name for the project. Let me know if you have any suggestions or ideas for a better name.
name it Very Interesting Project xd


btw. great work. with the of bug i'd try to look on something with isWalkable object flag
 
name it Very Interesting Project xd


btw. great work. with the of bug i'd try to look on something with isWalkable object flag
Appreciate it. The walkable (Unpass) flag is intended for now since there's only GMs atm, once the server is ready for regular players those things will be corrected, or at least that's the plan.
 
Launched a new blog for all matter of personal updates related to all matters of technology today.
Wrote a quick update about what's been going on in my life in the past few months.
I've also registered a twitter account for things like stream updates and set it up with twitch.
Will be adding main links to the blog either tomorrow or after the weekend.
 
Implemented this today in about a couple of hours, 1 min to actually send the messages in-game once messages were received - IRC client added to the server.
HJElq5K.png

Just a glimpse into what's to come in the near future.
 
Streaming now at

For anyone interested in the quiz, here's a list of all the modified town/mark names to make it easier to remember ("poh" instead of "havoc", "GMIsland" instead of "Home" for example):
"Thais", "Carlin", "Ab'Dendriel", "Rookgaard", "Fibula", "Kazordoon", "Senja", "Folda", "Vega", "Poh", "Orc", "Mintwallin", "Desert", "Swamp", "GMIsland", "Mists", "Draconia", "HellsGate", "Necropolis", "Elvenbane", "Fieldofglory", "FemorHills", "MtSternum", "Northport", "Greenshore", "Edron", "Stonehome", "BanditCamp", "Cormaya", "Darashia", "Drefia", "Venore", "Ghostship", "VenoreDragons", "Shadowthorn", "Amazons", "KingsIsle", "Ghostlands", "Ankrahmun", "OasisTomb", "GreenDjinns", "BlueDjinns", "PortHope", "Banuta", "Chor", "Trapwood", "Eremo".

Capitalization does not matter. Warning: A lot of the quiz questions are really hard.

Few more details:
  • The quiz command is !quiz youranswer. Item questions must be answered with a proper prefix if found, for example "a mace" or "an ancient shield".
  • There's the commands !points and !walk direction as well, but as long as monsters are already moving the walk command will only work in between automated moves.

Update since last stream:
  • The item "gold coin" was removed from the "name a monster item" quiz
  • The answer to a quiz question, if not answered by a viewer, will be spoiled at the start of the next round.
  • The markname "Orc" should now be "OrcFort".
 
Last edited:
Quick reminder of where we're at.

Since last time there's been a lot of changes:
  • Monsters can now be spawned in with /m using the original real tibia algorithm for alevo res (spawns randomly in a 2x2 square around you). Like other monsters they are spawned in with randomized items and will walk around when movement is enabled.
  • Spoiler: All bugs related to the command /activate, which makes a targeted monster follow you around, has been fixed - in addition chasing monsters only take a single step at a time before looking for path again.
  • Bunch of autowalk bug fixes including making it compatible with cipclient.
  • Thanks to stream: monsters no longer spawns on tiles with fire/poison/energy elements.
  • LiquidPool's decaying stackpos has been fixed.
  • Fixed a few more segfaults and one infinite loop caused by incrementing the wrong variable (players can now cast the same creature or player without issues even if the player logs out).
  • All protocolparse functions now has its "own" (often merged based on context/funcname) file under "events", similar to TFS' event system, making it much easier to find the functions in an IDE/text editor by just clicking the right file in the explorer instead of having to memorize the function names to look them up.
  • Server config now has an IP and ServerName setting.
  • Bunch of other internal changes and improvements.
  • We now keep track of players' IPs and also keep track of command exhaust (a system used to try to prevent abuse of commands on an up-coming testserver launch).
  • Disabled Nagle's algorithm for the gameserver. This improved walk smoothness tremendously on a VPS. We now get a walking speed of up to ~1000-1200 on a VPS with 70+ ping and ~2500 on localhost with regular walks (speeds of autowalks are immeasurable, somewhere in the 10's to 100's of thousands).
  • We also easily got rid of a bug that looked very scary related to internal handling of buffer over- and underflows, but was actually very easy to fix and I feel pretty confident that buffer over- and underflows are not a thing on this server and won't be causing issues in the future as they seem now to be handled very gracefully (bounds are obviously checked and maintained and handled with an exception).

Currently existing and missing major features:
  • Multithreaded SEC map loading exists.
  • Monster spawning and a few primitive behaviors exists.
  • Command system with a host of features exists.
  • Event system exists.
  • Decay system and the ability to push items and monsters around everywhere exists.
  • NPCs are completely missing/unimplemented.
  • Monster spells are completely missing, monster attack and fleeing behaviors are partially implemented.
  • moveuse.dat (script system) is completely missing.
  • Map saving is not implemented.
  • Multithreading in the gameserver will NEVER exist due to limitations of the language and architecture. This means more than likely that the server will never be able to host more than a thousand players at the same time and will likely start lagging before that. On the other hand it shouldn't segfault or crash when overloaded which seems like an issue with many TFS servers which is the good news.
  • A true scripting API will likely never exist, instead the programmer has access to both scripting and C++ within the same interface.
 
That's cool as fuck! Are you running this on nodejs? Have you experienced any performance problems yet?
 
I forgot to mention cast system is also implemented in the previous post.
I'm planning on launching a testserver quite soon for everyone interested in trying out the server, expect a launch within the end of the week (but expect also potential segfaults and bugs, I will run it with autorestarter).

I also have an update with my OTClient project. Here's a few changes:
  • The sound system has just been completed.
    . This system took a lot of effort (and quite a bit of money as well) to implement and perfect, it was quite CPU expensive to begin with and I had 50% FPS loss on around 70 sound files playing, it had a lot of bugs etc, but has now been seemingly completed. Monsters roar, water splash, fire burns, SD's explodes, etc, at 0 FPS loss, even on my laptop with no GPU in CPU power save mode.
  • Added "You can't see anything" feature that I found out through playing Tibiantis (cip client)
  • Lots of minor fixes. Only things missing now of cip mechanics I believe is the menu (won't ever complete fully), help feature which I probably won't ever implement, and the original way translucent lights work which I think will never happen, I have a more basic translucent system that just lights up tiles in the first underground floor which I feel is good enough - I'm pretty sure I'm yet the only server that has any translucent lights at all without using cip client.

Note however that I won't release my client anytime very soon, it might be pretty much done, but I want to add more security features to make hacking and cheating even harder before I release the client.

That's cool as fuck! Are you running this on nodejs? Have you experienced any performance problems yet?
Honestly the name is just a meme. It's written in an arcane language that supports interfacing with C.
No performance problems yet except that I currently move all monsters on the map around even if no players are there, this costs about 20-30% of the CPU (20k monsters moving randomly around).
I plan to replace this with calling gameGetCreatures(...) around players and activate/deactivate them 1 by 1 in the near future.
Pathfinding is also quite expensive, about 1ms per 2 steps or 0.1% of the CPU per monster, as I discovered all 8 tiles around a player must be checked for optimized (or in many cases even remotely sensible) paths, so it costs up to 8x as much as I once thought at about 0.1ms for d ~= 10 to 14.
Beyond that no real performance issues.
 
Testserver available now at TSFTW Testserver (https://tsftw.hopto.org). The domain should be TSSFTW but suffered from a typo.

Some things to watch out for:
  • You must input any account number > 0 to login.
  • Marknames are still changed from an earlier update (ctrl+f GMIsland for the full list).
  • You can chat with other online people only while on the same screen, other forms of communication aren't implemented yet (working on it).
  • Watch out for entering empty tiles, cipclient crashes easily, but you can use OTClient instead with protocol 772 with CIP's RSA keys if you wish.
  • Some other hints: !commands for a list of commands, you'll have to experiment to figure out what the commands does (that's kinda the fun), but here's 1 more hint: there's some commands involving targeting creatures, there are also a few secret passwords including an admin password for access to extra commands and 0 command exhaust.
  • Bug reports with Ctrl+Z kinda works, so feel free to report bugs that way if you encounter any, the command is filtered so only ASCII letters comes through, but it might still be abused so preferred method is probably to report in DM or in this thread, but feel free to use Ctrl+Z as well.

That's pretty much it, good luck and have fun.

@Olddies
It's up if you'd still like to try this testserver out.
 
Last edited:
Testserver available now at TSFTW Testserver (https://tsftw.hopto.org). The domain should be TSSFTW but suffered from a typo.

Some things to watch out for:
  • Marknames are still changed from an earlier update (ctrl+f GMIsland for the full list).
  • You can chat with other online people only while on the same screen, other forms of communication aren't implemented yet (working on it).
  • Watch out for entering empty tiles, cipclient crashes easily, but you can use OTClient instead with protocol 772 with CIP's RSA keys if you wish.
  • Some other hints: !commands for a list of commands, you'll have to experiment to figure out what the commands does (that's kinda the fun), but here's 1 more hint: there's some commands involving targeting creatures, there are also a few secret passwords including an admin password for access to extra commands and 0 command exhaust.
  • Bug reports with Ctrl+Z kinda works, so feel free to report bugs that way if you encounter any, the command is filtered so only ASCII letters comes through, but it might still be abused so preferred method is probably to report in DM or in this thread, but feel free to use Ctrl+Z as well.

That's pretty much it, good luck and have fun.

@Olddies
It's up if you'd still like to try this testserver out.
Love to see it but got connection failed
 
Love to see it but got connection failed
Oh yeah, one more thing I forgot to say: you must enter an account number to login. Any number except for 0 is valid.
It's an old mechanic when I was thinking of implementing tibiacams on the server side, I should probably remove it now.
 
Back
Top