Jump to content
MakeWebGames

a_bertrand

Members
  • Posts

    3,655
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by a_bertrand

  1. Just scroll to the bottom of the page: http://www.nw-engine.com/ and you shall find it. Yes I need to make that more visible ;)
  2. Great thanks, as you know, I'm available if you need help ;)
  3. Hi, Some of you wonder what kind of 3rd party mods there is already for NWE, well here is what the marketplace have to offer: Curt just released his first free mod: a bank mod: http://www.nw-engine.com/index.php?c=modules Illusions already have 3: http://www.nw-engine.com/index.php?c=modules&author=4 Sporo released a while back a module to get out of jail: http://www.nw-engine.com/index.php?c=modules&m=76 So far so good, more will come for sure, but as you see, I'm not anymore alone ;) BTW Ruler, Dom and a couple other promised me some too ;)
  4. Thanks chicka, I promised at start that NWE would get updates, and I tend to maintain my promises. Also, I don't look much at my concurrent myself, as I know what I want to deliver, and even if my ideas can shock some, I will tend to go forward (unless there is clearly something wrong with them). For NWE things are progressing well, both on the package and what it delivers (which is a huge leap forward compared to 1.0.0) and from the adoption point of view. Even if here we still see a majority of McCode (v2 btw) chat, there is quiet a few mails / pm / chat going un-noticed about NWE. So overall I'm happy.
  5. Ran the code on a Linux Scientific Linux 5.1 (Cent OS 5.1 equivalent): PHP: 5.1.6   ------------------------------------------------------------- Checks the difference between single quote and double quote. 50,000,000 times in loop. ------------------------------------------------------------- Testing single quote... 7.12 sec. Testing double quote... 7.27 sec. Difference: 2.08 % ------------------------------------------------------------- Checks the difference between echo and print. 10,000,000 times in loop. ------------------------------------------------------------- Testing echo function... 7.84 sec. Testing print function... 7.89 sec. Difference: 0.66 % ------------------------------------------------------------- Checks the difference between concatenation and sprintf. 10,000,000 times in loop. ------------------------------------------------------------- Testing concatenation... 18.07 sec. Testing sprintf... 16.6 sec. Difference: 8.12 % ------------------------------------------------------------- Checks the difference between procedural and OO. 1,000 times in loop. ------------------------------------------------------------- Testing procedural... 18.01 sec. Testing OO... 21.23 sec. Difference: 15.13 % ------------------------------------------------------------- Checks the difference between for and foreach. 100,000 times for 1,000 in loop. ------------------------------------------------------------- Testing for... 12.26 sec. Testing foreach... 8.9 sec. Difference: 27.4 % ------------------------------------------------------------- Checks the difference between inline code, and function call. 1,000 times in loop. ------------------------------------------------------------- Testing inline code... 11.62 sec. Testing function call... 18.18 sec. Difference: 36.09 %   Results are basically the same beside we see about 2% of difference between single and double quote... not something which would lead me to change even a single line of my code.
  6. Hard drive can be changed, even by you. Ram can be increased. If it's not a laptop you can easily change the graphic card as well. For the CPU, it all depends what kind of MB you have but I'm pretty sure you can change that as well. So basically just upgrade the pieces and you may as well continue to use your current system.
  7. The HTML Injection checker, token system against XSS / CSFR and the HTTP cache have been now decoupled from the index. In the same move it allows you guys to add per-processes and post-processes. A good thing too is that now the index.php will be common between the dev and the full version. On the same move, I improved the profiler further and now you can click on some of the rows to get yet more details like see which modules are loaded and their timings. If the code editor is present you will be able to jump on them directly too. [ATTACH=CONFIG]558[/ATTACH]
  8. You still didn't answered what kind of usage you have. So we can't really answer you raven.
  9. Well, normally if you have just raw CPU, linux should indeed be better as you could run without any graphics and just use the pure / full CPU. Yet that doesn't live up to the expectations as at the end many things count, like how good a compiler is (intel C compiler vs gcc for example) or MS, and how much a commercial software like Modo is optimized versus a free one like Blender. Also, oddly enough, now that Mac are basically intel based, the same softs (for example Modo) can be tested on both Mac and Windows... and from what I gathered, all seems to work better on PC than on mac. Could be again an issue with the compilers or others. I can't answer.
  10. check back.. I edited my post to show what kind of soft I use...
  11. Well spudinski, the tools I use don't run on Linux, not unless you use visualization or wine (which honestly every time I try it, it fails). Same for the games, the games I play are not ported on Linux... So sure you find stuff on linux, never said it's not the case, simply it doesn't fit MY needs. Or not as desktop / coder. For the server part, I use linux and windows, for different kind of operations. Now I don't really want a flaming war Linux / Windows / Mac OSX, I would just say, it all depends what you do with your OS. It's like for a car, maybe somebody needs a small city car, where somebody else needs a jeep for the desert. So unless you know how you will use the car, you can't say exactly which one is better. Sure the city car consume less fuel, but it will not survive long in a desert I believe. BTW Softs I use: - Modo 601 - ZBursh - E-On Vue - Live 8 - Ableton - Visual Studio / C# - Power Director - Photoshop Sure for some you may find an ok alternative (even open source), for others... nope.
  12. Spudinski: the code is there, try to find how I made a mistake. I have a good explanation for the sprintf and quiet a good one for foreach too, even if those two surprised me as well. BTW I ran the code multiple times to check it. For sprintf, the trick is that it goes directly to the C code function, and therefore there is basically no interpretation, where the concatenation need to interpret every "couple" as orations like that are binary (2 operands) operators. Therefore the concatenation is slower due to more interpretation vs a single C code. That's how I can explain it. For the foreach, I was sure it was slower than the for, yet I found this... disturbing result. How can I explain it? Well, simply because the foreach don't need to do a check and an increment on the interpreter level and all is handled on the lower level. I cannot explain it otherwise. Result found by somebody else: http://www.phpbench.com/ "Read Loop:foreach() vs. for() vs. while(list() = each()) " => foreach is faster. BTW I don't count the time with loops spudinski, I count the time the operation took, and as those things are fast I added a loop around to take time. I hardly see how I could have made it wrong, but if you find bugs or wrong results, please share your findings! Seker: any pure benchmark is not all that useful by itself, and indeed you will very rarely (if ever) do the same kind of operations as the code I gave here. Also I believe my statements are quiet clear: better keep your code readable instead of trying to grab some speed. However I do believe that benchmarks show that some stuff that many (me included) didn't know, like speed differences of the for / foreach and maybe the cost of OO programming (again PREFER READABLE CODE over clumsy one just to be faster).
  13. HD: happy guy where you have a full requirement list before starting. Either your projects are not all that complex, or they are very well known. In my case, it's simply impossible as the requirements comes while the development progress or even after the first release. So the only way to code for us is either Extreme Programming (yes it's a methodology) or RUP. Standard waterfall simply fail for us.
  14. True.... Anyhow if you buy yourself a PC, I hardly see how you manage to get it without OS, unless you build it yourself.... In that case the price of the OS is what... 100$ ?
  15. But forget then games, photoshop, dreamweaver etc...
  16. You don't even say for what you need your computer...
  17. for is useful if you need a variable which is a number inside the loop, like, I want one dot every 10 step or so: for($i=0;$i < 1000;$i+=10) foreach is to go through all elements of an array while having the reference of the current element. So if you don't "browse" an array, foreach is not for you. sprintf is the descendent of the equivalent function in C. You can use sprintf, printf, and fprintf they all work the same way. %d, %f and any % something are place holders which will be filled with the data taken after the first argument. I will not explain all the options here, but you can use %s for a string, %d for an integer, %f for a floating point.
  18. Would have been with another engine (and you know which one) maybe, but not McCodes V2. So I pass. Anyhow good luck.
  19. Some of you guys think there is huge difference between two things inside PHP like single quote or double quote, or print and echo, or whatever else. I tried to make some tests to show exactly how it affect or doesn't affect PHP and you may be surprised by some of the results. You will find first the results and then the full code I used, feel free to download it and test it on your computer (better from the command line instead of the browser). For the lazy one, here is a short answer: - Quote or Double quote nearly no difference (around 0.65%) - Echo or Print nearly no difference (around 0.39%) - String concatenation ("string a"."string b") or sprintf there is a difference (around 12%) sprintf is faster - Speed difference between OO and procedural, there is a difference (around 31%) procedural is faster - For or Foreach, there is a difference (around 46%) foreach is faster - Inline or calling a function, there is a difference (around 29%) inline code is faster My conclusions: - Don't change quotes or double quotes, you will see no difference basically, use them when you need one or the other functionality. - Don't replace your print or echo, you will see no difference, but use only one of the 2, not both... doesn't make sense. - String concatenations... are not really working well. Better use a sprintf. - OO is slower, no matter what you do (tested on PHP 5.3.5), yet you could end up with a cleaner code. So take OO if you want the features / clean separation of it, but don't expect to gain speed, you will actually lose some. - Foreach loops are faster than for, so use them, however it doesn't make sense yet to run across your code to change them all, I doubt you will see any real difference while running your game. - Inline code (avoid function call, and duplicate the code where you need it), is indeed faster, yet of course it make your code less readable. So don't use it, doesn't make any real difference for a web game, and it's better to have a readable code instead of some huge spaghetti code.   ------------------------------------------------------------- Checks the difference between single quote and double quote. 50,000,000 times in loop. ------------------------------------------------------------- Testing single quote... 14.66 sec. Testing double quote... 14.57 sec. Difference: 0.65 % ------------------------------------------------------------- Checks the difference between echo and print. 10,000,000 times in loop. ------------------------------------------------------------- Testing echo function... 14.72 sec. Testing print function... 14.77 sec. Difference: 0.39 % ------------------------------------------------------------- Checks the difference between concatenation and sprintf. 10,000,000 times in loop. ------------------------------------------------------------- Testing concatenation... 10.43 sec. Testing sprintf... 9.13 sec. Difference: 12.46 % ------------------------------------------------------------- Checks the difference between procedural and OO. 1,000 times in loop. ------------------------------------------------------------- Testing procedural... 12.95 sec. Testing OO... 18.8 sec. Difference: 31.11 % ------------------------------------------------------------- Checks the difference between for and foreach. 100,000 times for 1,000 in loop. ------------------------------------------------------------- Testing for... 11.19 sec. Testing foreach... 6.02 sec. Difference: 46.17 % ------------------------------------------------------------- Checks the difference between inline code, and function call. 1,000 times in loop. ------------------------------------------------------------- Testing inline code... 9.03 sec. Testing function call... 12.67 sec. Difference: 28.73 %   <?php // Checks the difference between the different functions / ways to do it in PHP // Checks the difference between single quote and double quote function quote_tests() { $nb=50000000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between single quote and double quote.\n"; echo number_format($nb)." times in loop.\n"; echo "-------------------------------------------------------------\n"; echo "Testing single quote..."; flush(); $start=microtime(true); $t=''; for($i=0;$i < $nb;$i++) { $t.=' a'; } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing double quote..."; flush(); $start=microtime(true); $t=""; for($i=0;$i < $nb;$i++) { $t.=" a"; } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } // Checks the difference between echo and print function output_tests() { $nb=10000000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between echo and print.\n"; echo number_format($nb)." times in loop.\n"; echo "-------------------------------------------------------------\n"; echo "Testing echo function..."; ob_start(); flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { echo "Hi $i\n"; } $end=microtime(true); ob_end_clean(); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing print function..."; ob_start(); flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { print "Hi $i\n"; } $end=microtime(true); ob_end_clean(); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } // Checks the difference between concatenation and sprintf function printf_tests() { $nb=10000000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between concatenation and sprintf.\n"; echo number_format($nb)." times in loop.\n"; echo "-------------------------------------------------------------\n"; echo "Testing concatenation..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t="this string ".$i." plus another ".time()." to max ".$nb; } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing sprintf..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t=sprintf("this string %d plus another %d to max %d ",$i,time(),$nb); } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } define('NbWorldItems',100); function DoInline($step) { $world=array(); srand(7000); // Fill the world with random coordinates (x, y, distance to nearest) for($i=0;$i < NbWorldItems;$i++) $world[]=array(rand(0,NbWorldItems),rand(0,NbWorldItems),0); // Now calculate the distance of each item to the nearest nearbor for($i=0;$i < NbWorldItems;$i++) { $isFirst=true; for($j=0;$j < NbWorldItems;$j++) { if($i == $j) // Skip ourself. continue; // Calculate the distance between the 2 $x=$world[$i][0]-$world[$j][0]; $y=$world[$i][1]-$world[$j][1]; $d=sqrt($x*$x+$y*$y); if($isFirst || $d < $world[$i][2]) $world[$i][2]=$d; $isFirst=false; } } $small=0; for($i=1;$i < NbWorldItems;$i++) { if($world[$small][2] > $world[$i][2]) $small=$i; } return $small; } function CalcDist($a,$b) { $x=$a[0]-$b[0]; $y=$a[1]-$b[1]; return sqrt($x*$x+$y*$y); } function DoProcedural($step) { $world=array(); srand(7000); // Fill the world with random coordinates (x, y, distance to nearest) for($i=0;$i < NbWorldItems;$i++) $world[]=array(rand(0,NbWorldItems),rand(0,NbWorldItems),0); // Now calculate the distance of each item to the nearest nearbor for($i=0;$i < NbWorldItems;$i++) { $isFirst=true; for($j=0;$j < NbWorldItems;$j++) { if($i == $j) // Skip ourself. continue; // Calculate the distance between the 2 $d=CalcDist($world[$i],$world[$j]); if($isFirst || $d < $world[$i][2]) $world[$i][2]=$d; $isFirst=false; } } $small=0; for($i=1;$i < NbWorldItems;$i++) { if($world[$small][2] > $world[$i][2]) $small=$i; } return $small; } class WorldItem { public $x,$y,$d; public function WorldItem() { $this->x=rand(0,NbWorldItems); $this->y=rand(0,NbWorldItems); $this->d=0; } public function Distance($item_b) { $a=$this->x-$item_b->x; $b=$this->y-$item_b->y; return sqrt($a*$a+$b*$b); } public function MinDistance($world) { $isFirst=true; foreach($world as $w) { if($w == $this) continue; $t=$this->Distance($w); if($isFirst || $t < $this->d) $this->d=$t; $isFirst=false; } } } function DoOO() { srand(7000); $world=array(); // Fill the world with random coordinates (x, y, distance to nearest) for($i=0;$i < NbWorldItems;$i++) $world[]=new WorldItem(); // Now calculate the distance of each item to the nearest nearbor for($i=0;$i < NbWorldItems;$i++) $world[$i]->MinDistance($world); $small=0; for($i=1;$i < NbWorldItems;$i++) { if($world[$small]->d > $world[$i]->d) $small=$i; } return $small; } function oo_tests() { $nb=1000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between procedural and OO.\n"; echo number_format($nb)." times in loop.\n"; echo "-------------------------------------------------------------\n"; echo "Testing procedural..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t=DoProcedural($i); } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing OO..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t=DoOO($i); } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } // Checks the difference between for and foreach function loop_tests() { $nb=100000; $nbElements=1000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between for and foreach.\n"; echo number_format($nb)." times for ".number_format($nbElements)." in loop.\n"; echo "-------------------------------------------------------------\n"; $data=array(); srand(10000); for($i=0;$i < $nbElements;$i++) $data[]=rand(0,100); echo "Testing for..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $sum=0; for($j=0;$j < $nbElements;$j++) $sum+=$data[$j]; } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing foreach..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $sum=0; foreach($data as $j) $sum+=$j; } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } // Checks the difference between inline code, and function call. function inline_tests() { $nb=1000; echo "-------------------------------------------------------------\n"; echo "Checks the difference between inline code, and function call.\n"; echo number_format($nb)." times in loop.\n"; echo "-------------------------------------------------------------\n"; echo "Testing inline code..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t=DoInline($i); } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_a=($end-$start); echo "Testing function call..."; flush(); $start=microtime(true); for($i=0;$i < $nb;$i++) { $t=DoProcedural($i); } $end=microtime(true); echo " ".round($end-$start,2)." sec.\n"; $res_b=($end-$start); echo "Difference: ".round(abs($res_a-$res_b)/max($res_a,$res_b)*100,2)." %\n"; } $tests=array("quote_tests","output_tests","printf_tests","oo_tests","loop_tests","inline_tests"); foreach($tests as $t) $t();
  20. Ooops... Bug free, yes ;) And as my grand mother always said: only those which don't do anything do not do mistakes.
  21. So you have no time to type and read back but while coding you plan all from the beginning (which is called waterfall development... and is somewhat the old died methodology) and write in one shoot. Sorry I doubt. First of all, you can plan as much as you want, there will be ALWAYS issues. It could be from you having introduced some stupid typos (yes, specially on PHP as you can't see them till you run your code), could be an issue with some browser / db / data, or could be something you do not know while coding it. As an example, I discovered a nasty bug in one of the soft I develop for my work. Basically it's some kind of specially crafted proxy / router software. Now, as a router it need to listen to one side of the network and replicate more or less the messages to the other side. That's for the background. Now remains to say that the protocol we want to route uses both TCP and UDP messages (and both need to be supported). Using .NET / C#, I coded the different pieces of code and worked more or less as planned (yes we do plan what we code too, but not completely and if you want I will explain you later why) till.... Monday. Why? Because we tested the software against some old code, which crashed and sent only a partial UDP packet... and this somehow killed the UDP listener of C#. Sad, but it wasn't really documented, and if it happens you simply continue to receive exceptions every time you try to listen to the next UDP packet. As UDP is stateless / connection less, you should not have such behavior, however this is how it works on windows. So what do you do? Either you drop a socket and create a new one, or you find the right IO setting and set the socket as UDP_RESETCONN which means it will reset itself every time a wrong UDP packet is received. Long story made short => you can plan as much as you want, but you will always discover things you didn't know, didn't planned, or simply missed / wrongly coded. So don't make me laugh, as a code free software simply do not exists.
  22. Syed: the best option I know for free engines with some content (no particular order): GL Script: http://www.glscript.net/ LotGD: http://sourceforge.net/projects/lotgd/ McCode V1: http://mccodes.com/products.php?id=2 Dragon Knight: http://dragon.se7enet.com/dev.php Davena: http://devana.eu/ Frameworks to build your own engine: ezrpg Commercial: McCode NWE NEaB And many more... I let you do your research and see what you need.
  23. Re-inventing something bad is pointless, yes. Offering bad services is pointless, yes. And having negative / stupid / kiddish attitude to the people is pointless.
  24. I see, even reading is hard: http://makewebgames.io/showthread.php/42025-how-to-add-a-mp3-player-to-your-site?p=278988&viewfull=1#post278988
  25. I told you how to add an mp3... read my post at least... and check the sources of the page I gave you. If you can't even do that... sorry but I doubt I will even continue to answer to your posts.
×
×
  • Create New...