shadowwulf Posted October 11, 2009 Author Share Posted October 11, 2009 ```Should I make a loop in the main loop something like the following(on the fly probably a lot of syntax errors)[code]for I to max players if getvar(poisoned) > 0 then poisondamage=getvar(I, poisondamage) setplayerhp(I, getplayerhp(I)-poisondamage) If getplayerhp<1then call playerdeath(I) End IF putvar(poisoned - 1) end if[/code]then move onto the next status effect.If i understand this correctly, it would cycle through all status effects for all players.I would probably want this to run once every 10 seconds or something.-OR-Would if be more feasable to run the loop in the client. I would figure this to be more stressful on the system because i would have to send packets back and forth alot.Any ideas?``` Link to comment Share on other sites More sharing options...
varinyc Posted October 12, 2009 Share Posted October 12, 2009 That should be in the client side game loop, and only for one person (the person using that client)since it will be in every client when you pass the game out, every player who play will get checked. ^_^So take that, and forget the For loop and you should be fine. I'm pretty sure at least .__.EDIT: Kimimaru's Idea would work better, two posts below. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 12, 2009 Author Share Posted October 12, 2009 Yeah that was one setup I was playing with.This would also permit me to do multiple similar effects without worrying so much about lag.Like with bleeding status effect…You could have multiple bleeding wounds that have varying degrees.bleed1=10bleedcount1=30bleed2=15bleedcount2=10so for 10 seconds you lose 25hp, then the next 20 seconds you lose 10.Then in the event of adding another bleed, I would replace the weakest bleed.Multiply bleed by bleedcount, then find smallest, replace.hmm maybe thats the best method. client side. Link to comment Share on other sites More sharing options...
Kimimaru Posted October 12, 2009 Share Posted October 12, 2009 I think it actually may be better to do this Server-sided. When the player obtains the status effect, then it will send a packet to the Server, and then everything should be done there. As a result, the INI file will be in the Server folder as opposed to the Client folder. Also, it's more important that the Server gets the player's updated HP values because if you just updated it on the Client, then it's possible to reach 0 HP but not die. The Server also controls the updating of players' HP.I'm just pointing out what I believe will be a better solution. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 13, 2009 Author Share Posted October 13, 2009 hmm.Originally i thought this.I already have a single .ini file inside each account folder.It holds all the modifiers and whatnot for each of that players characters.I could just add all the variable and they would be checked by 1 universal timer.My guess is the game loop is run numersous times a second so i want it to activate like every 30 seconds rather than each game loop.I know how i would want to run the checks but i have no clue how to start the timer type deal yet. Link to comment Share on other sites More sharing options...
Kimimaru Posted October 13, 2009 Share Posted October 13, 2009 Why not just create the INI file when the player obtains the status effect, set a value to a variable, use a timer, remove it when the time's up, then set another value to the same variable. Here's an example:A player steps on a poison tile. The code for the poison tile would be something similar to this:```If Val(GetVar("\Accounts" & GetPlayerName(Index) & "_Status.ini", "Poison", "Poisoned")) <> 1 ThenCall PutVar("\Accounts" & GetPlayerName(Index) & "Status.ini", "Poison", "Poisoned", "1")Call SetTimer("Poisoned", 180000)End If```Of course, you'd have to create the timer Sub yourself, but that's the basic idea. After that, remove the timer, and put this code somewhere:```Call PutVar("\Accounts" & GetPlayerName(Index) & "Status.ini", "Poison", "Poisoned", "0")```I think that would work. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 13, 2009 Author Share Posted October 13, 2009 then what about when they log out?is it going to automatically hold off on the timer or is the timer gonna be eating up resources?Plus that would be lots of timers when i could do one timer that does alot instead. Link to comment Share on other sites More sharing options...
Kimimaru Posted October 13, 2009 Share Posted October 13, 2009 You could always do something like this before the code:```Do While IsPlaying(Index) And Val(GetVar("\Accounts" & GetPlayerName(Index) & "_Status.ini", "Poison", "Poisoned")) <> 1```That would allow the code to execute like normal and then end when the effect wears off or the player logs out.You could try to fit it all into one timer if you'd like, though. You do that by using IF statements like the one on my previous post for each status effect. Link to comment Share on other sites More sharing options...
anasky Posted October 15, 2009 Share Posted October 15, 2009 Hmm, I agree on the fact that when you step on the tile (let's stick to that for now) he sends a packet to the server.The server will update the .ini file, and there already is a loop for the seconds (Look for it by looking for the Night.).That will be the place where your poison will take place (since it only has to do that once every second).```Dim StatusI As LongDim BleedingTime As IntegerDim BleedingDamage As IntegerFor StatusI = 1 To MAX_PLAYERS 'this might not work, just change it to 99 or 500 or something If IsPlaying(StatusI) Then BleedingTime = ReadINI("Status", "BleedingTime", (App.Path & "\Accounts\" & GetPlayerLogin(StatusI) & "\yourfile.ini"), vbNullString) BleedingDamage = ReadINI("Status", "BleedingDamage", (App.Path & "\Accounts\" & GetPlayerLogin(StatusI) & "\yourfile.ini") If BleedingTime > 0 Then Call SetPlayerHP(StatusI, GetPlayerHP(StatusI) - BleedingDamage, vbNullString)) Call WriteINI("Status", "BleedingTime", BleedingTime - 1, (App.Path & "\Accounts\" & GetPlayerLogin(StatusI) & "\yourfile.ini")) End If End IfNext StatusI```What to do:- change yourfile.ini to your actual file- BleedingTime would be in seconds.- BleedingDamage would be the amount of damage substracted each second, not each milisecond.- find the place to paste it.I was going to add it for the login, but actually, i think it works without even troubling about the log-in.UNTESTED. I don't see a reason why it won't work though.Good luck! Link to comment Share on other sites More sharing options...
Kimimaru Posted October 15, 2009 Share Posted October 15, 2009 You forgot to add in **End If** statements, but I think he should know that he needs to put them in. Link to comment Share on other sites More sharing options...
anasky Posted October 16, 2009 Share Posted October 16, 2009 Fixed xD Link to comment Share on other sites More sharing options...
Fred Posted October 16, 2009 Share Posted October 16, 2009 I think also taking dmg from .ini file and after that save it its a bad idea. Server will be much faster you will get it from memory. Link to comment Share on other sites More sharing options...
anasky Posted October 16, 2009 Share Posted October 16, 2009 True, but when server crashes, everything will be healed.Also, setting it in memory will let the PC lagg eventually, as it's RAM will be sucked up. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 16, 2009 Author Share Posted October 16, 2009 yeah when the game takes like 250+ Mb ram already! lolDont forget the client loads all the tilesheets and whatnot into memory. Link to comment Share on other sites More sharing options...
Fred Posted October 16, 2009 Share Posted October 16, 2009 First - we are taking about server memory, not client :)2nd - PC will be not lag. More lag will be from getvar and putvar because hard disk are slower than computer memory.3rd - it will not take much memory because it shoud be only one byte value in player account rec.4 - if server crash then all data will be lost even experience, but this is the system of eclipse saving accounts. IT will be funny when you are loosing example exp, lvl etc, but you have still poison effect on youself. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 16, 2009 Author Share Posted October 16, 2009 …I am using 2.8(vet version)Some of your points are null&void! :)And on memory i was refering to if things were kept on client. I should have clarified. Link to comment Share on other sites More sharing options...
Fred Posted October 16, 2009 Share Posted October 16, 2009 @Shadowwulfâ„¢:> …> I am using 2.8(vet version)Eclipse version have nothing to this.@Shadowwulfâ„¢:> Some of your points are null&void! :)Witch one? Link to comment Share on other sites More sharing options...
anasky Posted October 16, 2009 Share Posted October 16, 2009 @pheXion:> 4 - if server crash then all data will be lost even experience, but this is the system of eclipse saving accounts. IT will be funny when you are loosing example exp, lvl etc, but you have still poison effect on youself.If I get it correct, you say we are back to level 1 when server crashes?@pheXion:> 3rd - it will not take much memory because it shoud be only one byte value in player account rec.It will be two bytes (two ints) each player! What if you got 100 people logged in before the server reboots: 200 bytes. Now, imagine you become as good as PCO was. 100 players on at a time, meaning allot more log in before the server reboots (if it even reboots). Let's go for 1000 for the PCO example: 2000 bytes, this might sound low, but what if you make everything that way? INI files do they time at that moment, but if you make it like this entirely, you can easily run the server for months before memory is filled. Link to comment Share on other sites More sharing options...
Fred Posted October 16, 2009 Share Posted October 16, 2009 > If I get it correct, you say we are back to level 1 when server crashes?Don't be infantile… of course back to last server save...> … 2000 bytes, this might sound low, but what if you make everything that way? INI files do they time at that moment, but if you make it like this entirely, you can easily run the server for months before memory is filled.It is everything in eclipse made in that way! Everything its in memory and after some time its saved to ini files. Look on saving accounts in eclipse. Its the best method. If things will be in that way what you saying server will be incredible slow. Thats why in eclipse saving accounts to inis are in time dalays - beacuse in your way it will be slow as hell.This will be funny if you want to make server full of ini putvar and getvar. I would like to see this and see red light shining from hard drive 24h/7d as it writing and loading data all the time with "incredible speed". Link to comment Share on other sites More sharing options...
anasky Posted October 16, 2009 Share Posted October 16, 2009 I'm not saying it's actually faster, but it will be once the server is running for months.Also, the system isn't made to have a spam of poison-effects, but it is something to place it here and there.I've made all my systems in .ini's (simply because they HAD to be saved, but whatever) and I didn't encounter any lagg.The server was running on a 1gb RAM pc, and was still working fine with 30 people. Link to comment Share on other sites More sharing options...
Fred Posted October 16, 2009 Share Posted October 16, 2009 for 30 people if you have not so much put and getvars it will be microseconds, but if you will be have more players and more loops with writeini then you can have lags.When you are coding you can make it just work (like writeini) or you can make it work and optimize. You choose.IMO this is just wrong coding. Link to comment Share on other sites More sharing options...
shadowwulf Posted October 17, 2009 Author Share Posted October 17, 2009 you seriously expect anyone using eclipse to see 30+ people at a time?If i get that many people joining in ill be looking to recode in something much more stable.Eclipse is a great starter engine but thats what it is. a starter engine.I stick with it because for the cost(free) you get alot and its a great learning experience(the design part not the code part). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now