Comment Dofus Unity POURRAIT être fluide
Summary
TLDRIn this video, the creator addresses criticism about their approach to game development, particularly concerning inventory optimization in 'Dofus.' They demonstrate a realistic inventory system with 10,000 unique items, explaining technical solutions like 'lazy scrolling' to manage large datasets efficiently. The video also showcases server-client interactions, emphasizing the importance of modern development practices for better performance, even under real-world internet conditions.
Takeaways
- 📹 The creator felt compelled to make a second video to address criticism and misunderstandings about their work.
- 🎨 They clarified that they are critiquing optimization issues in a game development context, not the overall game design.
- 🛠️ The video includes a demonstration of a more realistic scenario to showcase the efficiency of their approach to object handling in game development.
- 🌟 The creator has generated low-definition sprites for thousands of different objects to avoid manual downloading and to illustrate the point about optimization.
- 📈 They explained the concept of 'less scrolling', a technique to create the illusion of a large number of items being scrolled through while only instantiating a manageable amount.
- 💡 The video demonstrates how to efficiently handle a large inventory of items in a game, such as in an auction house scenario.
- 🔍 The creator implemented a system to filter and display the cheapest items in each category, simulating a real-time auction house experience.
- 📊 They showed how to handle a large number of simultaneous sales and maintain performance by keeping the data in RAM.
- 🌐 The video includes a live demonstration of making HTTP requests to a server, filtering items, and updating the inventory in real-time.
- 🛑 The creator emphasized the importance of server optimization, suggesting that Dofus's servers could benefit from modern development practices.
- 🔧 The script concludes with a call for server-side improvements rather than just client-side updates, to ensure a smooth and efficient gaming experience.
Q & A
What was the main reason for creating a second video?
-The main reason for creating a second video was to clarify and demonstrate more realistically the points made in response to debates and criticisms in the comments and on the Kama post, where people claimed that the creator's actions were nonsensical and that they didn't understand the subject matter.
What is the purpose of creating numerous sprites for objects?
-The purpose of creating numerous sprites for objects is to have a variety of images for an inventory system without having to manually download each object, allowing for the display of 10,000 different objects with varying quantities.
What technique is used to make the inventory scrollable with a large number of items?
-The technique used to make the inventory scrollable with a large number of items is called 'less scrolling', where only the number of items needed to fill the screen are instantiated, and as the user scrolls, the first items are removed and new ones are added, creating the illusion of a large, scrollable list.
How does the 'less scrolling' technique work when scrolling through items?
-The 'less scrolling' technique works by updating the displayed items as the user scrolls, without actually instantiating new objects. It renames the existing objects to give the impression of scrolling through a large number of items, while in reality, a limited number of objects are being reused.
What is the significance of filtering the cheapest items for each category in the inventory system?
-Filtering the cheapest items for each category is significant because it allows the system to quickly select and display the most affordable options to the user, enhancing the user experience by providing relevant and cost-effective choices.
How does the system handle a large number of sales transactions simultaneously?
-The system handles a large number of sales transactions simultaneously by keeping the objects in RAM and filtering them as needed. This approach allows for quick access and manipulation of the data, even with a large volume of transactions.
What is the purpose of making a HTTP request to filter items based on user input?
-The purpose of making an HTTP request to filter items based on user input is to dynamically retrieve and display items that match the user's criteria from the server, providing a personalized and responsive user experience.
What is the latency experienced when making a request to a real server and how does it affect the system?
-The latency experienced when making a request to a real server is 22 milliseconds, which is considered good, especially considering the public Wi-Fi connection. This latency affects the system by adding a delay to the response time, but it remains acceptable for the operation of the inventory system.
How does the system ensure a smooth scrolling experience for the user?
-The system ensures a smooth scrolling experience by instantiating only a small number of objects and updating their properties as the user scrolls, rather than creating and destroying objects, which makes the scrolling appear fluid and responsive.
What is the main criticism of the Dofus server code in the context of the video?
-The main criticism of the Dofus server code is that it has not been updated with modern development methods and remains outdated, similar to a server from the Flash era, which could be improved by adopting more current practices.
What is the goal of the video in terms of technical demonstration?
-The goal of the video is to demonstrate the technical aspects of creating a responsive and efficient inventory system, showcasing the capabilities of handling a large number of objects and transactions with minimal latency and resource usage.
Outlines
😀 Addressing Criticisms and Demonstrating Efficient Optimizations
The speaker begins by addressing criticisms that their previous video was nonsensical and lacking understanding. To counter this, they aim to provide a more realistic demonstration of the optimizations they critiqued, which are supposed to be efficient. They explain that they have created numerous sprites for various objects, such as 1000 different grains, cereals, wings, and legs, totaling around 10,000 unique objects. The purpose of generating these low-definition sprites was to avoid manually downloading objects and to showcase a diverse inventory. The speaker also discusses the limitations of displaying a large number of objects in a scrollable list and introduces the concept of 'less scrolling' to maintain performance while giving the illusion of a large inventory. They conclude this section by demonstrating a table setup for an item sale, including quantity, price, label, and expiration date, and explain how they filter and display items for sale in a server-like environment, highlighting the efficiency of their approach even with a large number of objects.
😲 Implementing Smooth Scrolling and Efficient Data Handling
In this paragraph, the speaker focuses on the technical implementation of a smooth scrolling interface for a large inventory, despite having a limited number of instantiated objects. They describe a technique where only a subset of objects is displayed at any given time, and as the user scrolls, the objects are dynamically renamed to give the impression of a continuous scroll. This method, known as 'less scrolling,' is shown to be highly efficient and fluid for the user experience. The speaker also discusses the server-side operations of a game like Dofus, explaining how different workers handle various tasks and how their implementation mimics these server behaviors. They demonstrate the speed and efficiency of their system, even when using a real internet connection and a remote server, by showing how quickly objects are filtered and displayed in real-time. The speaker also touches on the potential for optimizing server queries to reduce load and improve performance.
🛠️ Technical Reflections and Suggestions for Dofus Server Improvements
The speaker wraps up the video by reflecting on the technical aspects they've discussed and expressing their awareness of other issues that Dofus might be facing. They mention that the server code has not been updated with the Unity port, which they find regrettable. The speaker's main suggestion is for the developers to adapt their server methods to more modern development practices, rather than maintaining outdated server structures from the Flash era. They hope that their demonstration and suggestions will be well-received and conclude the video with a note of optimism for future improvements.
Mindmap
Keywords
💡Optimizations
💡Sprites
💡Inventory Management
💡Scrolling
💡HTTP Request
💡JSON
💡Dofus
💡Server Workers
💡Database
💡Coroutine
💡Unity
Highlights
The creator addresses criticism and misunderstandings about their work, aiming to clarify their stance on certain optimizations.
A demonstration of a more realistic approach to show that the critique is focused on supposed optimizations.
Creation of numerous low-definition sprites for objects to avoid manual downloading, showcasing a large inventory system.
Explanation of the inventory system containing 10,000 different objects with varying quantities.
Introduction of 'less scrolling' technique to manage a large number of objects efficiently on the screen.
Modification of a sales table to include quantity, price, label, and expiration date for a more realistic sales environment.
Discussion on the technical feasibility of handling 1 million objects in an inventory and the limitations of scrollable lists.
Implementation of a server-side operation to filter and display the cheapest items in each category for sale.
Use of HTTP requests to filter objects in real-time based on user input, demonstrating server-client communication.
Demonstration of the speed and efficiency of server communication even with a large number of objects and high latency.
Explanation of the 'less scrolling' technique in action, showing how it provides a fluid scrolling experience with a limited number of instantiated objects.
Technical discussion on how the server for Dofus Unity might be structured with separate workers for different tasks.
Critique of Dofus Unity's server-side code, suggesting it has not been updated with modern development methods.
Presentation of a method to dynamically load object images based on their names for a seamless user experience.
Analysis of the performance of the system when scrolling through a large dataset, highlighting the realism of the scroll.
Discussion on the potential benefits of adapting server operations to modern development practices for better efficiency.
Final thoughts on the importance of technical clarity and the desire for improved server adaptation in game development.
Transcripts
alors rebonjour je pensais pas faire une
deuxième vidéo aujourd'hui mais en fait
vous avez vu il y a eu pas mal de débats
dans les commentaires et puis sur le
post en Kama que j'ai fait il y a
beaucoup de gens qui disent que ce que
je fais c'est débile et que je comprends
rien du tout donc je voulais clarifier
un petit peu faire une démo un peu plus
réaliste pour montrer que ce que je
critique c'est vraiment des des
optimisations qui sont censées donc là
ce que j'ai fait c'est que déjà j'ai
créé des des sprites beaucoup de sprite
pour mes objets donc voyez j'ai des
ailes euh j'ai pris quoi euh il y en a
beaucoup beaucoup il y en a normalement
il y en a à peu près il y en a 1000 de
chaque donc il y a 1000 grosin
différents 1000 céréales 1000 ailes 1000
pattes en tout ça fait je sais pas si je
peux le voir là je crois que j'ai 10000
objets différents et donc comme j'avais
pas de de j'avais pas envie de
télécharger des objets à la main ce que
j'ai fait c'est que j'ai généré des
sprit en basse
définition ça ça me permet si je crée
mon inventaire comme hier euh d'avoir
des images toutes différentes pour
montrer que voilà je suis pas avec CIN
images et cinq objets différents là j'ai
vraiment 10000 objets dans ma base avec
à chaque fois des quantités donc là j'ai
fait un gros
inventaire j'ai mis 2000 objets dans
l'inventaire donc il y en a vraiment
beaucoup et vous voyez que bon ça ça ça
pulse euh deuxième point si vraiment je
voulais mettre 1 million d'objets dans
l'inventaire je pourrais mais je
pourrais pas faire une liste scrollable
comme
ça si on
regarde si on regarde regarde mes
cellules là j'en ai vraiment beaucoup
beaucoup beaucoup et euh si je en en
instancier 10000 ou 100000 ou un million
ça va pas marcher donc ce qu'on peut
faire c'est en instancier juste le
nombre qu'il faut pour remplir l'écran
et quand on scroll ça va supprimer la
première et ajou en fait ça va ça va
décaler le texte pour qu'on ait
l'impression de scroller mais en fait on
garde toujours les mêmes objets ça
s'appelle le
less scrolling et je l'ai fait dans la
démo pour l'hôtel des ventes là euh ce
que j'ai fait c'est que j'ai ajouté des
objet à Vantre donc j'ai un petit peu
modifié la table
elle ressemble à ça maintenant donc il y
a juste une quantité un prix et un label
et une date d'expiration donc c'est les
c'est vraiment une table comme on
pourrait mettre en vente un objet voilà
donc ça c'est la table avec les objets
donc il y en a plein différents il y a
toutes mes catégories et ça va de 1 à
999 donc il y a 1000 x 10 donc 10000
objets différent c'était à peu près ce
qu'il y avait de dans Dofus je pense
c'est pour ça que je suis parti
là-dessus et avec à chaque fois donc une
quant aléatoire et un prix aléatoire euh
ce que je fais c'est que je crée une
requête ici qui va me sélectionner les
objets les moins chers pour chaque
catégorie par exemple ça va me prendre
tête 51 là par 100 bah laquelle est la
moins chère de toute ma liste donc il y
a 600000 ventes en même temps et on peut
voir que ça me prend donc il y a voilà
600000 objets en vente les objets en
vente ont été filtrés par un par 10 et
par 100 en prendant le moins cher à
chaque fois là je les garde dans la RAM
et le premier exemple là c'est prix 15
quantité 10 labelle arbre 22 donc
l'arbre 22 par 10 le moins cher il est à
15 la requête initiale elle prend 281
misees donc ça c'est ce qu'on ferait
normalement au lancement du serveur
parce que le faire à chaque fois c'est
un petit peu un petit peu lourd je pense
et comme je disais modifier à chaque
fois qu'un joueur fait un achat ou une
vente c'est une possibilité ou alors
faire cette requête là juste pour le
filtre donné par
l'utilisateur ensuite là on va voir que
l'utilisateur va pouvoir faire une une
requête donc une requête HTTP
qui est ici où je juste prendre mes
objets dans la RAM et les filtrer donc
sil met un un filtre l et ben je vais
dire tous mes objet où le label contient
l et ensuite je vais lui renvoyer ça en
jison pour ne pas être en local j'ai mis
ngeroc ça me donne une vraie URL et je
vais pouvoir me aller taper sur cette
URL qui va rediriger vers mon propre
ordinateur sur du coup mon serveur c'est
comme en gros si je vous donne cette
adresse là tout le monde peut se
connecter chez moi et donc la là j'ai
une latence de 22 millisees ce qui est
une bonne latence sachant que je suis
sur un wifi public pas en pas en
etthernet malheureusement j'ai pas j'ai
pas cette
chance donc j'ai les 22 misees de
latence donc l'allretour fera déjà 40
misees et on va voir le temps que ça met
à trier là on va dire que c'est ça c'est
le vrai serveur d'ofus que je vais
mettre sur le côté c'est le client donc
ce qu'on va faire c'est que quand je
vais cliquer sur http ça va faire une
requête au serveur qui va qui va filtrer
toutes les ailes qu'il a dans la RAM et
tout me renvoyer je clique donc voilà ça
a été assez rapide ça a mis euh 173
milliseondes pour faire la requettete
HTTP qui contenait 15 m donc 15 m c'est
beaucoup parce que là en fait j'ai 1000
objets ce qui est un peu un peu
illogique mais pourquoi pas et donc ces
objets ont été convertis en gison ils
ont mis 250 misees à à parcer la classe
et là on peut voir que du coup dans mon
scroll j'ai pas comme ici des dizaines
et des dizaines de grid r dans mon
inventaire j'ai que c'est cette petite
vingtaine de lignes qui sont ces lignes
que vous voyez ici et ce qui se passe
quand je vais scroller alors ça je vais
essayer de vous montrer ça je vais
prendre le premier le premier il a un
label ici c'est l450 c'est celui qui est
caché ici je vais prendre celui du
dessous pour que vous voyez mieux le
l54 quand je scroll en fait il va
changer vous avez vu il a changé ici
l513 972 et ici c'est complètement
transparent quand on scrollle on n pas
l'impression que il change mais en fait
ce qui se passe c'est que dès que je
monte pile d'un cran tous sont renommés
et donc c'est fluide pour l'utilisateur
et il a l'impression qu'il peut scroller
énormément alors que dans les faits il y
a très peu d'objets d'instancier donc
c'est méga fluide et je peux scroller
des milliers d'objets en fait là je
pourrais scroller une quantité quasiment
infinie d'objets puisque dans la scène
Unity il n'existe tout simplement pas et
donc vous avez vu que cette opération
malgré le fait que je sois sur un vrai
une vraie connexion sur internet avec
une vraie requête à un vrai serveur
distant qui revient ensuite chez moi qui
est traité par mon PC qui a 32 Go de RAM
euh normalement les serveurs de dovus
Unity sont séparés en plusieurs workers
chaque worker va faire une tâche par
exemple celui qui va gérer les combats
il va avoir beaucoup de données parce
qu'il y a beaucoup de choses à gérer
celui qui gère les transitions entre les
maps il va gérer ses trucs aussi et puis
celui qui gère l'hôtel des ventes il est
dédié que aux mises en vente et puis à
garder les prix les plus bas pour
pouvoir les afficher tout ça donc
normalement mon indice se comporte
exactement comme le worker que devraient
avoir les serveurs de Dofus Unity et
vous voyez que c'est vraiment hyper
rapide que là j'ai bien des images qui
sont toutes différentes qui sont bien
cherchées là-dedans elles sont loadées
euh elles sont chargées dynamiquement
avec le nom de l'objet le l612 il va
chercher l'objet l612 dans mes
ressources et puis ensuite vous voyez il
s'en sort très bien il arrive très bien
à à afficher ça en temps réel et on a
l'impression d'un scroll complètement
réaliste alors qu'on voit il y a rien et
euh on voit bien sur dofice Unity que ça
a pas l'air d'être trop le cas parce que
quand on scroll ça fliqueer un petit peu
ça saute et cette barre là bah elle se
bouge pas de manière fluide donc ce code
là je peux vous le montrer il est super
intéressant euh d'abord donc quand on
crée les objets en base de données
ensuite je récupère le nombre total
d'objets que j'ai eu euh et je vais
commencer une cor routine donc ça c'est
de l' synchrone dans Unity pour
initialiser après le
layout tac voilà donc ce que je fais
c'est que j'attends la fin d'une frame
pour que tout se mette correctement ça
c'est si on lance le script dès le début
d'un il faut que les objets a le temps
de se la scène a le temps de se charger
on va dire et je vais initialiser la
poule quand j'initialise la poule ce que
je fais c'est que je vais d'abord
chercher la hauteur d'une de mes
préfabes donc font 50 pixels de haut
c'est chaque ligne que vous voyez ici et
la hauteur de ma boîte de scroll donc
c'est tout le carré qu'il y a ici comme
ça je peux faire une division et savoir
combien de boîtes il doit y avoir pour
remplir toute la toute la la boîte de
scroll euh et ensuite je les ajoute donc
j'ajoute mes objets là je ajouter du
coup qu'une petite vingtaine et ensuite
je vérifie que à chaque fois que je
scrolle mon truc je je vais mettre à
jour mes objets pour que pour pouvoir
simuler un scroll réaliste donc je vous
laisse regarder le code on va pas le
détailler parce que comme j'ai dit dans
la dernière vidéo le but c'est pas de
faire un tuto de de développement mais
là vous pouvez voir là je regarde où
j'en suis dans ma liste par rapport à ça
donc ça c'est juste la position du
contenu ici là je suis à 2913 sur 16000
et si je descends vous voyez que ça
monte et que là je suis à 6000 sur 16000
et donc quand je suis tout en bas je
suis à peu près à 16000 sur 16000 et
donc l'objet qui est là ça doit être le
dernier à être instancier et on voit
c'est ce que je fais ici first visible
index on voit que le First visible index
va calculer le premier index qui serait
visible tout en haut et ensuite il va
juste mettre à jour pour afficher le
texte pour modifier le texte de de ces
boîtes là sans supprimer ou recréer de
nouvelles boîtes ce qui fait que pour
Unity c'est quand même beaucoup plus
léger à gérer un truc comme ça donc
maintenant on pourrait imaginer que
quand on tape du texte ici euh j'insiste
he sur Dofus quand on tape une seule
lettre il a besoin de faire une requête
au serveur mais c'est pas très utile
parce qu'il nous renvoie 1000 objets et
c'est un petit peu lourd pour rien si on
attendait deux trois caractères déjà les
serveurs seraient vachement allégés sur
le point de vue hôtel des ventes et
ensuite ben vous voyez une fois qu'il
m'a renvoyé les données ça c'est
vraiment super rapide même si ça revient
d'un serveur distant he là c'est bien
ngroc qui va me renvoyer ça et quand
même en 250 misees bah tout est prêt et
après j'ai mes objets là j'en ai à peu
près un millier euh vous voyez là le le
payload ressemble à ça donc on pourra en
avoir beaucoup plus en vrai un 15 kg là
je vous l'avais dit hier c'est
excessivement peu pour des bonnes
connexions ça pourrait arriver en une
fraction de seconde et même si on avait
10000 objets ce serait
ok donc là j'ai fait l'exemple avec
aucun filtre et vous voyez que là donc
là j'ai une scroll là j'ai un scroll qui
est énorme du coup puisque j'ai tout les
objets de la base de données donc là il
y en a euh en tout il y a 143 kg de de
texte et donc ça fait 3000 objets donc
3000 objets d'un coup et vous avez vu
qu'il sont arrivés en 300 misees donc
c'est plutôt ok
euh voilà donc je voulais pas faire plus
long c'était juste pour bien clarifier
ce que je voulais ce dont je voulais
parler dans les paramètres techniques et
que j'étais bien conscient qu'il y avait
plein d'autres problèmes pour Dofus
sachant que apparemment les le code
serveur a pas été refait du tout avec le
portage Unity donc ça c'est c'est
dommage mais c'était pas vraiment le
sujet moi ce que j'aurais aimé qu'il
fasse c'est qu'ils adaptent les serveurs
avec les les les méthodes de
développement un peu modernes et pas
qu'il reste en fait avec un serveur qui
date de l'époque de flash s'ils ont un
client qui est qui est mis à jour voilà
en espérant que ça vous ait plu je vous
dis à plus
5.0 / 5 (0 votes)