Hacker News new | past | comments | ask | show | jobs | submit login
Let's Code... an MMO (sea-of-memes.com)
147 points by JeanPierre on Nov 19, 2010 | hide | past | favorite | 40 comments



Shamus Young has been doing a vaguely similar series lately, which you can find at: http://www.shamusyoung.com/twentysidedtale/?cat=66 Note that that page, unlike most blogs, is sorted earliest first, so I'm actually referring to "Project Hex" at the bottom. Though you may find the others interesting too. Interesting to compare and contrast the two fundamentally different approaches, which nevertheless have produced reasonably similar screenshots initially.


I was thinking of (one day) creating a "Let's build a" series in the following order:

1) Students learn about assembly, opcodes, etc. They write programs for an imaginary machine and only run them on paper for now.

2) Students write their own CPU emulator (in C) that can run and test the simple programs from 1.

3) Students write a compiler to a simple HLL which allows them to write more complex programs, and test against the emulator.

4) Students build the processor which was being emulated in HDL, and download it to FPGAs, testing outputs of the programs generated by their compiler against the emulator.

I think most schools already do something like this, but mine missed the compiler part.


Check out The Elements of Computing Systems. It walks you through the construction of a computer starting with just NAND gates. You start by building other logic gates, and then an ALU, CPU, assembler, virtual machine, a compiler for a simple high level language, and finally an operating system. Each chapter gives the necessary background information, and a specification for you to implement.


I actually took almost all the classes necessary to do that. I could even go further, I took classes that would allow me to design the processor on individual transistor level creating a design which could theoretically be built on silicon. But of course the classes were separate so I did not build upon everything.

The problem with that is that encompasses what have become two disciplines -- computer science, and electrical or computer engineering. I took classes encompassing both sides because I liked the classes, but most people are really interested in one or the other.


I've also wanted to develop a series like this, where each course builds directly on the material from previous courses.

My school offers each concept individually, but they're not related.


I would be interested in reading that. :-)


This is a pretty damn cool article, but it's an odd choice of bounding spheres for frustum culling of octree nodes. Yes, it's cheaper in terms of CPU time than using the actual octree nodes (which are either cubes or boxes -- cubes in this case), but it's far less precise, meaning you're going to be 1) checking more nodes, due to recursing further when you have a false positive, and 2) most likely sending more data to the GPU than required, especially considering the density of his world.

Can anyone think up a reason why spherical bounding boxes would be beneficial here?


A sphere-frustum check is a lot cheaper than a box-frustum check. The spherical test only has to check the distance of a single point to the frustum, a box intersection test is much more complex.

There are some false positives, but as with many things in game development 'close enough' usually works pretty well.

If you're really concerned with efficiency you should look into other data structures than an octree. Octrees are a nightmare for cache performance (like most other tree based structures) and cache utilization is usually the bottleneck on modern CPUs.

If you're interested in the subject this book (http://realtimecollisiondetection.net/books/rtcd/) covers everything extremely well.


Yea, I know sphere-frustum checks in and of themselves are cheap, but when you consider the cost of false-positives for octree traversal and the cost of sending unnecessary data to the GPU, it doesn't seem like it makes a lot of sense to me.


Then it sounds like it's time for an experiment.

Take the code he posted with the article, and modify it to use a box-frustum check instead. Don't forget to test the program's performance before you make any modifications so you'll have something to compare to. Even better, keep the code intact and #ifdef'd out so you can toggle between the two.

Then, compare the differences. Check to see how many false positives there are on average, and how much extra data this means gets sent to the GPU. Keep in mind, however, that extra data being sent to the GPU doesn't matter unless the GPU is actually the bottleneck.

My hypothesis is that the way the octree abuses the cache will overshadow the performance gains (if any) you'll make by using something other than spheres for your test. In the end you'll find that if performance in this part of the code is a problem, you'll need to switch data structures.


I'm more curious about this as a general trend. I always see people advising sphere-frustum tests for these situations, but I've never really understood how it works out better than box-frustum. I should really run some tests not just against his code, but to figure out where the tipping point between the two techniques is.


Broadly speaking, simpler is better on modern CPUs and GPUs. Testing an array of spheres against a view frustum is cache friendly, can be sped up considerably using SIMD instructions and is easily parallelizable. Submitting superfluous data to a GPU is not generally impactful; GPUs are clever at not drawing stuff that doesn't actually contribute (with clipping and depth buffer rejection) and extremely fast in their own right.


This is really cool! I can't wait to come back and give it a proper read through. Hurry on weekend :)


I've been looking into game programming in my spare time and I was wondering how to best implement the UI as a hobby project. I know there's Scaleform, http://www.scaleform.com/ , that's used for major games like Starcraft 2 but the price tag is way out of my league. Anyone have any suggestions?


A ton of UIs are built from the ground up. When you compare the logic and math involved to the logic and math used in 3D rendering or even 3D game logic, it's an absolute pushover, though you might feel like it's a huge hassle since in web development you get the UI logic, more or less, for free. You'll notice very quickly in game development that, until very recently and with the exception of graphics / sound libraries, you have to code everything from scratch.

It really depends on the library/engine you are using (if you're using one!) OGRE3D integrates well with several packages, Unity has a builtin GUI system that is stupendously inefficient, and the list goes on...


It's definitely a pain point for games that there isn't much choice around for general-purpose UIs. It's a big factor in why many indie games end up with really shitty, underdeveloped UI.

Fortunately, you don't really need to reinvent Qt or CSS to get the job done. A font system and a few hand-coded controls usually suffice.

I think the bigger problem is in sound synthesis and processing. This arena still remains mostly confined to reverb algorithms, crossfaded tracks, and pre-recorded samples, yet the depth of the subject goes about as far as graphics does. So we're really missing out in terms of applying technology to creativity here.


"Stupendously inefficient" is a bit of a stretch for me in regards to Unity; I think it has a fairly well thought out - if admittedly rudimentary - GUI system (in its second iteration, upon which the editor application interface is also built). "Efficiency" is typically not the foremost concern for the interface in a 3d game, anyway; though in that regard I also don't consider Unity to be a slouch.


I only know of a few, they tend to be other library specific. There is a ui add on for SDL. There is guichan if you are using opengl. CEGUI is the only one that I know of that has wide ranging support and is probably what I would recommend. You might also consider FLTK it is an app gui system not game specific but uses opengl to draw its widgets so it might be workable in a opengl app.


CEGUI is really nice in terms of the flexibility and design, but the API is terrible. BUT, don't let that stop you from using it. Spend a day writing a wrapper around the API to CEGUI or whatever bindings you're using (e.g. the Python bindings) and you'll absolutely love it.


I'd read up on the concepts behind Immediate Mode GUIs; here's a handy tutorial: http://sol.gfxile.net/imgui/

You trade some flexibility and input latency for a simple imperative structure that is easy to implement.


Here's a little more info on the subject. video presentation: http://mollyrocket.com/861 discussion: http://mollyrocket.com/forums/viewtopic.php?t=134



As for an Octree-based implementation, http://sauerbraten.org/ comes to mind. Sauerbraten (aka Cube 2) also has a real time collaborative world editor.


Uh... I'm getting a 404 for this.


me too


The article is called "Let's Code... an MMO" - but it is just a simple Octree tutorial.

I don't mean to be negative, like the guys friends that laughed at the project - but coding an MMO is several orders of magnitude more complex than putting together an Octree renderer.

Best of luck with it, but, so far, nothing to see here.


Writing an octree is definitely part of coding an MMO. It's a piece of software, of which an octree or something similar is a fundamental part, thus it totally fits. If this is too slow-paced or ground-level for your tastes ... avoid game development, it just gets worse; more complicated, more pedantic, more detailed, more time spent not actually creating game logic.

However, I'm also cheesed at the misuse of the term MMO, Minecraft is pretty close but the lack of a centralized game world in any way makes it unlike most MMOs, and by extension doesn't really fit the term. It is merely a persistent multiplayer construction set. N8 (Neverdaunt) or Wurm Online (which notch had formerly worked on), for example, are similar construction-oriented games that definitely fit the MMO moniker because there /is/ a centralized persistent game world. Dealing with the side effects of such a architecture does make things an order of magnitude more complicated.


I disagree where you say 'an octree is definitely part of coding an MMO.'

An Octree is just one technique to reduce the size of the Potentially Visible Set of geometry that is sent to the rendering pipeline. While its a quite a natural fit for a voxel-style world, such as minecraft, there are many techniques to achieve this; an octree just being one.

If the Octree was the core technical challenge and data structure used to create every MMO, then I'd have no issue with the article. But its really not - its a simple technique, graphics 101, used to speed up rendering (or collision detection).

Further, just having an octree is not nearly sufficient for handling MMO scale issues - a lot more needs to go into structuring the world - when those larger challenges are solved, I'd like to read his article on it.


Its clear that its the first part of a series of articles. Are you saying he shouldn't have blogged about it until 6 months down the line when he has all the subsystems in place?


No - I'm just saying that the submission to hackernews shouldn't be called 'Lets code... an MMO', because that makes it sound like its about coding an MMO, when its about coding an Octree.

If I see an article about coding an MMO I expect to read about the complexities of scale and persistence, and supporting a consistent gameworld for a lot of players - these are the main challenges unique to an MMO.


I have to agree. When I read the first paragraph, it seemed promising, but then he just talks about development of the world and nothing more on the aspect of MMO. If he had an outline of what he'll be looking at to code an MMO, then it would have been better.


For some more in-depth game engine development blogging, check out BitSquid[0] - an engine being developed by ex-lead developers of GRIN (Ghost Recon Advanced Warfighter, Bionic Command Rearmed).

[0] http://bitsquid.blogspot.com/


I agree with you, and honestly there are already tons of graphic tutorial sites out there. IMHO, an interesting series about MMOs would deal with the server side, communication protocols, cheat prevention, client management, data storage, etc... Those are the things that take a desktop graphical client and turn it into an MMO.


Honestly i don't believe that he will get to the point of having something playable. I watched too many projects like this fail and some succeed.

Those who succeeded all did NOT focus on their technology when talking about their project and seemed to focus more on getting it to a point where you could actually play something.

Of course you'd think that for a mmo a good technology base is key, but it isn't because if you're honest: Your mmo won't attract a that large crowd in such a speed that you won't have time to merge to something better and spend the money you've earned from your customers of the first hour on improving scalabililty.

Find something fun, get it done and then make it work would be my advice to any aspring independent gamedeveloper.


Where's the maths?


Oh piffle to all you nay-sayers. Look at what he's done! What fun! How great it is to zoom around a world entirely of your own creation! Who cares about the rest? Not me. Sure, I would have just used a 2D structure instead of a 3D one, and maybe experimented with hex maps instead of squares, but this guy now knows more about 3D oct-tree terrain rendering than I do, and anyone who has commented so far, I'll wager.

Creation is never to be sniffed at.


been checking some simple game development solutions in my spare time ... been looking into SlimDX, and then discovered pygame - http://www.pygame.org, works on linux and windows, it's a Python based lib, now i dunno python but it was really easy to start crating nice stuff in no time.


Pygame is a great way to get started quickly. Once you move into the 3d world, though, I seriously recommend pyogre (and its bindings for Bullet and all that). You won't get the knowledge of how to write your own engine, but if you want to do some awesome gamedev with minimal time sunk, you really can't beat pyogre, IMO.


Do you have any thoughts on Panda3D? Like pyogre it's a C++ framework with Pythonic bindings on top.

I think the most fantastic thing about Pygame is the huge library of open games on its website. I wish these 3D framework sites had that.


I have looked at Panda3D, but I haven't built anything with it, so I really can't compare the two very well. That said, Panda3D's goal is to be a game engine, rather than just a graphics engine, as with Ogre. I imagine between that and the poor documentation for pyogre, it may very well be easier to get a game going with Panda3D. But personally, I love ogre and the bindings that pyogre provides to other libraries, e.g. Bullet, make my life damn easy. Also, the documentation issue is an issue, but most things are wrapped so closely to the C++ counterpart that you can just use the Ogre docs and be fine.

I spent a couple days writing wrappers around pyogre to do things like game state management, nice GUI APIs, etc, and after that it was clear sailing. I wish I had more time to work on the game all that stuff was for, really, but such is life.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: