• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Source's custom OT game engine (TypeScriptFTW)

Boy67

Veteran OT User
Joined
Jul 4, 2007
Messages
468
Solutions
26
Reaction score
371
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 :)
 
OP
OP
Source

Source

Intermediate OT User
Joined
May 31, 2020
Messages
141
Reaction score
132
Location
OpenTibia .dev
GitHub
source61
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
 
OP
OP
Source

Source

Intermediate OT User
Joined
May 31, 2020
Messages
141
Reaction score
132
Location
OpenTibia .dev
GitHub
source61
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:
OP
OP
Source

Source

Intermediate OT User
Joined
May 31, 2020
Messages
141
Reaction score
132
Location
OpenTibia .dev
GitHub
source61
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.
 

Evalor

The Ancient One(Cahir)
Joined
Nov 19, 2009
Messages
133
Reaction score
48
Location
reversed universe
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
 
OP
OP
Source

Source

Intermediate OT User
Joined
May 31, 2020
Messages
141
Reaction score
132
Location
OpenTibia .dev
GitHub
source61
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.
 
OP
OP
Source

Source

Intermediate OT User
Joined
May 31, 2020
Messages
141
Reaction score
132
Location
OpenTibia .dev
GitHub
source61
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.
 
Top