Jump to content

boasfesta

Members
  • Content Count

    34
  • Donations

    $0.00 
  • Joined

  • Last visited

  • Days Won

    3

boasfesta last won the day on November 9 2016

boasfesta had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. boasfesta

    Data Serialization (Storage)

    Objective: Serialize all objects for storage Difficulty: Advanced Hello guys! As you know, Orion+ doesn't have object serialization implemented by default, what makes us to update a number of methods every time we add a new field on any object. Since you get here i suppose you're a advanced programmer and you know what serialization means, but if don't: In practice means you don't need to update Send/Get/Save/Load methods every time you add a new field to your object (Like a Skill level on SkillRec for example), with this system you do those things automatically by manipulating your data in bits. If you want to know more about serialization, read this article on Wikipedia. A new Orion+ user doesn't need to care about serialization, since everything works exactly the same on game. But if you're a expert user i think it would be very useful, so i'll gonna make this tutorial assuming you already know how to code. In case of any problems or questions sent me a PM. Preparing your code for Serialization Before starting this tutorial steps, you must mark all your desired structure types as serializable, you can do this by adding <Serializable()> before the structure declaration, like this: <Serializable()> Friend Structure ResourceSkillsRec Dim SkillLevel As Integer Dim SkillCurExp As Integer Dim SkillNextLvlExp As Integer End Structure Notes: Structures inside other structures also must be marked as serializable. Storage Serialization Let's start with easy part first, in this section we will serialize our objects on Save and Load methods. Notes: Complex and huge Datas like Maps should'nt be serialized, since serialization process allocate too much bytes. All your database must be deleted before serialize your storage methods, or you can convert it on your own. ~Server Side Open ServerDatabase.vb and add this region above End Module #Region "Serialization" Sub LoadObject(ByRef Element As Object, ByVal Filename As String) Dim stream As FileStream Dim formatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter() stream = File.OpenRead(Filename) Element = formatter.Deserialize(stream) stream.Close() End Sub Sub SaveObject(ByVal Element As Object, ByVal Filename As String) Dim stream As FileStream = File.Create(Filename) Dim formatter As New Runtime.Serialization.Formatters.Binary.BinaryFormatter() formatter.Serialize(stream, Element) stream.Close() End Sub #End Region For every Save method you must remove the ByteStream related codes, leaving just the Filename variable. After that, use SaveObject(Object, Filename) method to serialize your object. Here is a little example using Skill: Before method (without serialization) Sub SaveSkill(skillnum As Integer) Dim filename As String filename = Path.Combine(Application.StartupPath, "data", "skills", String.Format("skills{0}.dat", skillnum)) Dim writer As New ByteStream(100) writer.WriteString(Skill(skillnum).Name) writer.WriteByte(Skill(skillnum).Type) writer.WriteInt32(Skill(skillnum).MpCost) writer.WriteInt32(Skill(skillnum).LevelReq) writer.WriteInt32(Skill(skillnum).AccessReq) writer.WriteInt32(Skill(skillnum).ClassReq) writer.WriteInt32(Skill(skillnum).CastTime) writer.WriteInt32(Skill(skillnum).CdTime) writer.WriteInt32(Skill(skillnum).Icon) writer.WriteInt32(Skill(skillnum).Map) writer.WriteInt32(Skill(skillnum).X) writer.WriteInt32(Skill(skillnum).Y) writer.WriteByte(Skill(skillnum).Dir) writer.WriteInt32(Skill(skillnum).Vital) writer.WriteInt32(Skill(skillnum).Duration) writer.WriteInt32(Skill(skillnum).Interval) writer.WriteInt32(Skill(skillnum).Range) writer.WriteBoolean(Skill(skillnum).IsAoE) writer.WriteInt32(Skill(skillnum).AoE) writer.WriteInt32(Skill(skillnum).CastAnim) writer.WriteInt32(Skill(skillnum).SkillAnim) writer.WriteInt32(Skill(skillnum).StunDuration) writer.WriteInt32(Skill(skillnum).IsProjectile) writer.WriteInt32(Skill(skillnum).Projectile) writer.WriteByte(Skill(skillnum).KnockBack) writer.WriteByte(Skill(skillnum).KnockBackTiles) BinaryFile.Save(filename, writer) End Sub After method (using serialization): Sub SaveSkill(skillnum As Integer) Dim filename As String filename = Path.Combine(Application.StartupPath, "data", "skills", String.Format("skills{0}.dat", skillnum)) SaveObject(Skill(skillnum), filename) End Sub Also you must update the Load methods. The process is almost the same, but use LoadObject(Object, filename) instead. Here is another example with Skill again: Before method (without serialization): Sub LoadSkill(SkillNum As Integer) Dim filename As String filename = Path.Combine(Application.StartupPath, "data", "skills", String.Format("skills{0}.dat", SkillNum)) Dim reader As New ByteStream() BinaryFile.Load(filename, reader) Skill(SkillNum).Name = reader.ReadString() Skill(SkillNum).Type = reader.ReadByte() Skill(SkillNum).MpCost = reader.ReadInt32() Skill(SkillNum).LevelReq = reader.ReadInt32() Skill(SkillNum).AccessReq = reader.ReadInt32() Skill(SkillNum).ClassReq = reader.ReadInt32() Skill(SkillNum).CastTime = reader.ReadInt32() Skill(SkillNum).CdTime = reader.ReadInt32() Skill(SkillNum).Icon = reader.ReadInt32() Skill(SkillNum).Map = reader.ReadInt32() Skill(SkillNum).X = reader.ReadInt32() Skill(SkillNum).Y = reader.ReadInt32() Skill(SkillNum).Dir = reader.ReadByte() Skill(SkillNum).Vital = reader.ReadInt32() Skill(SkillNum).Duration = reader.ReadInt32() Skill(SkillNum).Interval = reader.ReadInt32() Skill(SkillNum).Range = reader.ReadInt32() Skill(SkillNum).IsAoE = reader.ReadBoolean() Skill(SkillNum).AoE = reader.ReadInt32() Skill(SkillNum).CastAnim = reader.ReadInt32() Skill(SkillNum).SkillAnim = reader.ReadInt32() Skill(SkillNum).StunDuration = reader.ReadInt32() Skill(SkillNum).IsProjectile = reader.ReadInt32() Skill(SkillNum).Projectile = reader.ReadInt32() Skill(SkillNum).KnockBack = reader.ReadByte() Skill(SkillNum).KnockBackTiles = reader.ReadByte() End Sub After method (with serialization): Sub LoadSkill(SkillNum As Integer) Dim filename As String filename = Path.Combine(Application.StartupPath, "data", "skills", String.Format("skills{0}.dat", SkillNum)) LoadObject(Skill(SkillNum), filename) End Sub With this code replaced on your Load and Save methods, all your objects will be automatically serializeds and you don't need to update them anymore when a new field is added on structure. Notes: Serialization allocate all your fields in bytes, even if they values is zero or null, so your files should get a little bigger. For that reason, huge and complex data should'nt be serialized like i said before, such like maps and map events, also they're dinamically saved and loaded using less memory on actual Orion+ version. Every time you add a new field you must insert it ON THE END of your structure, so you won't need to delete your saved objects again. Changing a array size in your structure (unless it is the last element) forces you to delete all your saved objects or convert it for your new structure. Anyway, this is a new system i implemented on my project and work aswell. Any problems related will be fixed and notified on this tutorial, so stay tuned. Again, any problems you can send me a PM or leave a comment on this post. If you want to continue serializing your objects through network, check out the second part of this tutorial! If i was useful, feel free to donate!
  2. boasfesta

    Server Manager

    How strange, it works perfect for me, ill check it with other devices If any 1 get more messages, notify here please
  3. boasfesta

    Server Manager

    Did you test it with internet access? Its 3G or Wi fi?
  4. boasfesta

    Auto Mapper

    You can just access the Orion source code, not Intersect :/ Anyway check your Resource Frequency on map editor configs, a higher number means less resources. (I think i made it inverted, dont remember) It only make islands actually, for future releases i want to make dungeons and similar things. If you dont want a island you can just block the beachs warps and it works hahaha
  5. boasfesta

    Server Manager

    What version it is? And what message you get?
  6. boasfesta

    Server Manager

    Wow awesome! Soon i'll release the source so you can use it for Intersect if you want! It will be a pleasure to help
  7. boasfesta

    Auto Mapper

    Sorry for the late answer. Did you config the resources used by the Automapper in the editor? Also, did you used the Damian adaptation for Orion or you adapted the code by yourself?
  8. boasfesta

    Server Manager

    Hello developers! Some days ago i wanna try my Java skills, so i made this. For any engine you use, or any gender of game you make, there is always problem when you release a game: Anytime your server can crash, and in the worst situation, you're not at home. You cant leave your players alone, and you cant close the game without seeing that error message for fixing it later. Sure you can use Team Viewer, but in some cases you don't have much internet speed or limit (Cause Team Viewer consume it a lot). So to resolve that, i've made an app for android that can check your server status, and also restart it if doesn't, using low internet costs. Here is the Server Manager! Releases Version 1.0 Download How to use Extract the rar file on your server folder Open the config.ini file Configure the executable name and put your server port Open the Server Manager.bat Enter the Server Manager App folder Send the apk for your android device Install it Configure with your connection information Patch Notes Version 1.0 Check server status button Restart server button Screenshots If you like it, leave a comment with suggestions for future releases! If you love it, Make a donation!
  9. boasfesta

    Dragonball Z: Resurrection Online! [Now Recruiting]

    hahahah Im very greateful for that! I just didnt recognize your nickname, sorry
  10. boasfesta

    Dragonball Z: Resurrection Online! [Now Recruiting]

    @LegendarySaiyanMan There is no problem for you to use my videos for showing your future systems, i just wanted to be noticed before hahahha Anyway, if you could just add and a little credit mark it would be good for both of us, since the topic shows that game is an different one haha. Im here for anything you need
  11. boasfesta

    Automapper System Sourcecode (VB6)

    It would steal my job, and robots can rule the world! Sure Will Smith won't like that.
  12. boasfesta

    Automapper System Sourcecode (VB6)

    Next objective: Autogame System hahaha I think it would be a exciting system to develop, like selecting item graphics and giving rarity to them, so the program make equipments for every class along the levels updating its data to be stronger and selecting its graphic based on rarities, same for npcs...OH NO! MAKE IT STOP I DONT WANT TO DO THAT!
  13. boasfesta

    Automapper System Sourcecode (VB6)

    Sure! I sent you a PM
  14. boasfesta

    Automapper System Sourcecode (VB6)

    Well so there is something different in Orion autotile system, i will install VB.NET on my pc and check it out @jcsnider@Kibbelz if you guys want to add the automapper system to Intersect i can make a conversion to C#, so it won't waste your time working on a done system and you can work in new ones. Will be good to help me study it and will be a honor have my system on a official Intersect release
  15. boasfesta

    Automapper System Sourcecode (VB6)

    Its not ground layer, you're painting the whole tile filling all layers, and not keeping the under layers just adding the above ones as the system does, probably this is happening because you're justing setting the map tile as the tile prefab, and the tile prefab doesnt have nothing on under layers . So the black border on your grass doesnt mean the tile its on ground, they are on mask 1 but there is nothing on ground. So in the addTile method you'll need to find the first tile prefab filling layer (like mask 1 for example) and then start to fill just after this layer (keeping the ground safe) for the not detailed prefabs as water and river, for the detailed prefabs as grass and mountains you have to keep the above layers too, so you just fill the layer that have an tileset and ignore the anothers. This code is on Sub AddTile and explains exactly what to do: For i = 1 To 5 If Tile(Prefab).Layer(i).Tileset <> 0 Or CleanNextTiles Then TileDest.Layer(i) = Tile(Prefab).Layer(i) TileDest.Autotile(i) = Tile(Prefab).Autotile(i) If Not HaveDetails(Prefab) Then CleanNextTiles = True 'For water and rivers End If Next i
×