This does not mean that anything beyond having it compile will be done. I just basically want to have the initial extension building working so that work can be done later. Whenever any component enters “stable” status, it would be easier to commit it to the extension. I think that it may take a little bit of debate as to which component is stable and when. It also depends on how difficult it is to (re)write the component in C++ in the first place.
I would like a direct PHP to C++ library class translation. This means that the library (definitions) and code will basically match the PHP counterpart (except where hashes won’t be efficient). The PHP Extension part will list the classes, the methods and create the C++ library code for PHP and call the methods. So the only thing the PHP Extension code will be is using the C++ library and making it available to the userland.
If this works out well, then it might just be as quick to write the C++ code as it is to write the PHP code (just kidding, but it would be easier). After I have written enough (the skeleton), I plan on committing it to the repository. Granted, I need to have Subversion on my PC for which to commit the ext/qgl to the Quantum Game Library repository. Which is why I’m writing the extension now in the first place, that I can’t access the repository, currently.
See how far I can get before I get paid and get the parts to get my new computer. That will be longer than one week, but it should be okay given that there are some components that could be converted during that period.
PHP to C++
For efficiency purposes, really only the methods and properties will be the same. There should be a few times the code for PHP wouldn’t be translated to C++. However, the results should be the same regardless.
Later Refactoring
The road map was to start this project in March. The reasoning being that a large percentage of the library would be stable and wouldn’t be at risk of refactoring. It is unpreventable that some parts would later be refactored. That shouldn’t stop it from doing so, however the extension shouldn’t be too far behind.
There would have to be extension versions that either match the library version or a list which states which extension version matches what library version. Since there currently isn’t a version, this won’t be a problem until a release. Only then hopefully a better C/C++ developer would join.
How hard can it be? I’m being serious, I don’t want to get into it and realized that I suck. Doesn’t help that I have to relearn most things about C++.
Possibly Related Posts:
- Game Engine Development and Open Source
- Plans for Base CMS
- Bullet: E-Book Library Management and Content Server
- Using ZendFramework 2 beta1 For Directory Project
- Project Plans
Making an extension isn’t all that hard in itself, whats a pain is all the special stuff you have to do to make sure zend knows how to handle memory and stuff, I could throw together an extension in an hour that “works”, its all the extra stuff you need to put in that takes time really ;(
Anyway, Your suggestion directly translating php to C++, Because your php code may change in the future I would suggest a 2 step process.
1. Identify all mathmatical functionality that can be split off into its own C++ function, for example a sq + b sq = c sq and put them in there own functions
2. You then build wrappers around those functions to duplicate your php code, This way you seperate the math portion which will never really change from the “game” portion.
I will try to dig up my a sq + b sq = c extension and email it to you so you have a base skeleton to look at.
That would be nice, since there are such calculations in the Quantum Game Library map component code.
I’m also looking at other extensions to make sure I’m not doing anything wrong and have some guide on what to do besides reading the “Extending and Embedding PHP” book.
It is going to my first time, so I have no idea how long it will take.
I have Building Custom PHP Extensions, found it pretty usefull, but should prob get that one also as its a bit newer
A lot of mapping components in the QGL, thankfully, are largely math based. I would rate it stable very shortly (I should get that copycat ZF core/inc division in place soon) once I’ve used it in an application successfully. The unit tests all run positive at the moment – or did when I last checked. At any rate, we’re well out of the past “planning” rank and into an “RC” stage for those components I think.
I think the focus on maths, and lack of any real complex processing won’t make it too hard (math based programming typically can be broken into small procedural steps – something we’ve handled quite well I think in our refactoring and practice of focusing on small methods – not 200 line monolithic beasts!).
In any case, it’s something new. I’ve never personally written anything above a “Hello World!” php extension and my own C++ skills are rusty but I have that extension book on my reading list for the coming months. As experience, it would be invaluable – being able to write extensions is one of those PHP skills you don’t really think about but which if you consider it can come in handy when coding to a platform you control (versus a shared host where writing PHP extensions is worthless given the limited ability to manage something as basic as configuration let alone compilation).
PHP extension quick and dirty Threw this together just for this
Thanks.
It did answer a few of my questions about configuration, which is what I’m current working on now. The AI part will also include external libraries later. Most of the Quantum name space however will just be a C++ library.
I’m going to work some more on it today to at least get it compiling. It appears everyone I know, knows a lot more about building and writing PHP extensions than myself. That can be a good thing, since I’m going to make mistakes and it would be nice to have people look over it to say, “Hey, that sucks!” or “That is wrong, this is the correct way.”
I’m not going to add what I have currently until it either at least compiles or Friday night. The extension is kind of low priority, but I think that if I don’t at least get it started and working it would be even more difficult later.
I’ve came to that conclusion based on how much time I’ll have left over from school and work and my previous track record for completing “complex” projects. (To give a hint, it isn’t all that good… but I am however proud of my work on that OpenGL (GLUT) Blackjack game I made. A whole month! I did learn a lot from the experience.)
good to see your alive… your not going off the grid like before are you??
you need to get on msn…
I can’t get on MSN because of forgotten password issues. I need to either recover that or keep trying until I get it correct. I am still on ICQ and AIM. I went off the grid for a week because of cable problems.
If you are on sometime, I’ll catch up with you on that. QGL might either be dual license or an more unrestrictive license, so I’m planning on converting some of the more open components of the current games over to that since the benefit would be instant and could be used back.