Lars T. Kyllingstad: > http://code.google.com/p/pspemu/
Thank you for the link. I think there is enough evidence that it is possible to use D (V.1) to write some video games. It's one of the very few niches where D has shown some more appreciation. So to blow on this tiny fire, do you know ways to improve the D2 language and D2 Phobos to help game development? ----------------- Some comments on the source code: The author seems to believe that the right way to name D modules is with a starting uppercase, like "Event.d". In the modules I see a large amount of array appends (~=), the author maybe thinks those are efficient operations, as in C++ vectors. To simulate a CPU computed gotos help performance. Interpreters are common, computed gotos are useful to run finite state machines too (and in computational biology I have had to build such machines. I have used computed gotos of GNU-C to speed up code). This again shows that some common basic exceptions are needed in Phobos: http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/Exceptions.d ----------------- With the idea recently discussed this code: http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/core/EmulatorState.d this(Interrupts interrupts, Memory memory, IBattery battery, IDisplay display, Controller controller, Gpu gpu, Cpu cpu) { this.interrupts = interrupts; this.memory = memory; this.battery = battery; this.display = display; this.controller = controller; this.runningState = runningState; this.gpu = gpu; this.cpu = cpu; resetVariables(); } Becomes: this(this.interrupts, this.memory, this.battery, this.display, this.controller, this.gpu, this.cpu) { this.runningState = runningState; resetVariables(); } This is not just shorter, it's more DRY and less bug-prone. ----------------- This page: http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/core/Memory.d Contains code like: class InvalidAddressException : public MemoryException { I think that "public" needs to become a syntax error. ----------------- This is bad code, I didn't even know D supports empty catch: http://pspemu.googlecode.com/svn/trunk/src/pspemu/utils/Expression.d static long parseString(string s, long default_value = 0) { if (s.length > 0) { try { ... } catch { } } return default_value; } ----------------- That asm code for the float[4] vectors are cute, unfortunately they kill inlining with DMD, so they often produce slower code: http://pspemu.googlecode.com/svn/trunk/src/pspemu/utils/MathUtils.d ----------------- This seems at home in Phobos too: http://code.google.com/p/pspemu/source/browse/trunk/src/pspemu/utils/Types.d Bye, bearophile
