Aph3x

Members
  • Content count

    736
  • Joined

  • Last visited

Community Reputation

288 Neutral

About Aph3x

  • Rank
    GDNet+
  1. Unity raytracer

    Messing about with Unity, wrote a little raytracer - quite easy as Unity does all the hard work! Have a bash... stick a few spheres, planes, lights in a scene then stick this script on an object:using UnityEngine;using System.Collections;public class Tracer : MonoBehaviour{ public Color AmbientLight; [Range(0.0f, 1.0f)] public float Reflectivity; private Texture2D Texture; private Light[] Lights; void Start() { float ratio = Screen.height / (float)Screen.width; Texture = new Texture2D(256, (int)(ratio*256)); Lights = GameObject.FindObjectsOfType(); } void OnGUI() { GUILayout.BeginArea(new Rect(16, 8, 256, 64)); if (GUILayout.Button("Trace")) { DoTrace(); Texture.Apply(); } GUILayout.EndArea(); GUI.DrawTexture(new Rect(16, 48, Texture.width, Texture.height), Texture); } private void DoTrace() { float dx = 1/(float)(Texture.width); float dy = 1/(float)(Texture.height); Vector3 vec = new Vector3(); for (int y=0 ; y 0) { if (!Physics.Raycast(aPos, dirToLight)) { float dist = Vector3.Distance(aPos, l.transform.position); float v = (dist/l.range)+1; float intensity = l.intensity / (v * v); clr += l.color * NdotL * intensity; } } } return clr; }}
  2. Once is happenstance...

    Well you can give [the dev build] a bash here with a few caveats:   1. The graphics are all placeholders mainly from the speccy chaos, others from all over the interwebs. 2. Bugs! 3. The AI is rudimentary at the moment and has no idea how to use most of its spells, but you can get a reasonable game out of it :)
  3. Once is happenstance...

    Twice is coincidence, so Mr Fleming wrote. I love Chaos. The game that is - that old Speccy turn-based peculiarity. Mr Gollop is one of my programming heroes. His work probably influenced me more than any other to take up programming; games programming in particular. I used to dream up great new ideas that I'd add to Chaos when I became a programmer. One of the first 'proper' programs I wrote allowed you to hack into Chaos and change the names, graphics and attributes of the creatures and spells. 'Death to hackers' indeed ;) Speaking of which, the Rebelstar series wasn't too bad either - that game (along with Laser Squad and XCom after it) sealed my adoration of the TBS genre for good. I remember nearly killing myself racing round my paper round, desperate to get home and play it yet again. So to the point. Whenever I get a new device nowadays, one of the first things I do is try and get Chaos running on it somehow. I've just installed a version on my Android phone in fact. So a few months ago I came to thinking... there's nothing new been added to the game by the 'remakes', why don't I follow my dream of years ago and do a remake myself to take advantage of the new mobile revolution? It surely can't go as badly as my last attempt at a remake can it now? It's been almost 30 years since the original Chaos after all, surely Mr Gollop has moved on... Roflcopters. Somebody above is telling me to stop attempting remakes. I'll just leave this here...
  4. Well well well...

    The official Carrier Command remake is finally released. It took them 6+ years with a smallish team, and the results... well let's see.
  5. Many thanks for sharing all this invaluable info LordYabo!
  6. Unity Learning Where to Start

    Can't beat [url="http://unity3d.com/"]Unity[/url] for learning the basics and getting something up & running quickly (also learning the c# language). I know a few artists who use and love Unity as a bridge to 'proper' programming.
  7. Probably a good idea to look at the bundled exporter scripts to start (i.e. the DirectX one).
  8. OpenAL Sound Playing Issues

    Yeah - how do you load your audio file and set up the buffer? The frequency is set here - do you use alutLoadWAVFile?
  9. Hmm. Thanks for the answers people. Think I have more work to do on my OOP skills, but seems I've been mixing up [i]interfaces [/i]and [i]abstraction layers[/i]. To quote Wikipedia, "[font=sans-serif][size=2]A good abstraction will generalize that which can be made abstract; while allowing specificity where the abstraction breaks down and its successful application requires customization to each unique requirement or problem."[/size][/font] [font=sans-serif][size=2] [/size][/font] [font=sans-serif][size=2]Antheus: if I needed something called '[/size][/font][color=#1C2837][size=2]FactoryAdapterProxySingletonFactoryFactory' I'd [i]know [/i]I was doing something wrong ;)[/size][/color]
  10. Something that still periodically bugs me about programming by interfaces: You have a nicely generalised interface for most of the funtionality, but a concrete implementation may need to consume objects specific to that implementation. You could maybe provide an object factory but it may still require different data in its construction. One solution to remove the dependency would be a 'blobject' that just contains a number of key-value pairs, but this seems rather over-engineered. Also if the interface takes a callback that provides data that's specific to the implementation, the client again has a dependency on the specific type involved. It still seems appropriate to extract out a common interface, so I don't think I'm forcing a square peg into a round hole... Does anyone have more insight into a better design?
  11. Our in-house system had a nice approach that uses a few solutions: - You could cast time-critical rays with a blocking call to receive the result immediately (used sparingly!) - Send raycasts to the physics system to be queued and batched for efficiency. The rays were encapsulated into a class that held the results and a 'IsFinished' method. The game actors sent off the ray for execution usually in their update call, then queried the ray for completion in a 2nd-pass update or consecutive frame. Particles used batched rays too for environment interaction (though at a lower priority so could be deferred or ignored depending on the physics engine load). The batching helped by caching parts of the level geometry once and running many raycasts on it as rays tended to have quite structured spatial groupings (especially the particles).
  12. As a quick aside, you can view the depth texture easily via the fixed pipe by temporarily switching off the texture compare mode, e.g.: [code] glBindTexture(GL_TEXTURE_2D, mTexIdShadowDepthRender); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); // Turn off compare mode to draw. glBegin(GL_TRIANGLE_STRIP); glTexCoord2d(0,1); glVertex2d(x, y); glTexCoord2d(0,0); glVertex2d(x, y+size); glTexCoord2d(1,1); glVertex2d(x+size, y); glTexCoord2d(1,0); glVertex2d(x+size, y+size); glEnd(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); // Reinstate compare mode. [/code]
  13. Earth Fly-by

    Amazing. More so in that I had to look really REALLY hard to see any lod pop too!
  14. Codemasters : Week 1

    Congrats man! Now, about this OpFlashpoint follow up... ;)
  15. Time for a new chapter

    The games industry both rocks and sucks... good luck!