• Cubic : dynamic block-based world engine
    60 replies, posted
For the past few months, I've been working on a library for an upcoming game. I feel that I've now got far enough to start talking about it and showing some progress. [B]What is Cubic?[/B] Cubic is a C++ library, designed to handle simulation of large block-based worlds. If you're wondering what a block-based world might look like, take a look at the fantastic game Minecraft. ([URL]http://www.minecraft.net[/URL]) It's designed to be fast, very easy to use and quite flexible. [B]What's the motivation behind it?[/B] I'm not writing this just for the sake of it. It's being written specifically for the needs of a game (for now, let's just say it's going to be a game for coders, using Lua), but I figured I ought to design it as a seperate library, as I'm sure somebody else will find a use for it too. [B]What does it do?[/B] Here are some of Cubic's features (not all implemented yet!) - can handle large environments efficiently (several cubic kilometers), in theory it [I]could[/I] be extended to pseudo-infinite worlds, but that isn't currently planned - makes extensive use of multicore processors - efficient memory usage, parts of the world which aren't in use are compressed where possible - blocks can sustain damage, potentially breaking into different types when their health is depleted - various lighting models will be provided, of varying speed and visual quality - powder physics (see attached demo) - finite fluid simulation using either a coarse (block-based) or fine (quantity based) solver, depending on density fluids can act as liquids or gasses - extremely fast raycasting - can generate visual, collision and occlusion meshes automatically as the world changes - rendering/physics engine agnostic - mod-friendly : various things can be defined in plain text files as well as in code, block types and materials for example - hopefully cross-platform, though that hasn't yet been verified [B]Can I try it?[/B] It's not ready for use yet, so the library isn't available, but you can try a demo of the powder physics, which uses the Irrlicht engine for rendering. It isn't visually impressive, since its only purpose is interactive debugging/testing. A wireframe version is also provided if you're interested in seeing the underlying mesh. It would be nice if someone brave could try this and confirm it isn't a virus or something. I know I'd be uncomfortable running an executable posted by some guy I'd never seen before... [U]Screenshots from the demo[/U] [IMG]http://img11.hostingpics.net/pics/772173powder1.png[/IMG] [IMG]http://img11.hostingpics.net/pics/716259powder2.png[/IMG] [U] Controls[/U] Mouse + arrow keys control the camera (it tends to lock up if you look too far up or down, be warned) Mouse1 to place a solid block Mouse2 to remove a block Mouse3 to toggle the flow of powders Alt+F4 to exit [U]Download[/U] [URL="http://www.datafilehost.com/download-1df84cbf.html"]Cubic demo 1 - powders (Windows 32-bit, ZIP, 1.3MB)[/URL] Assuming anyone shows any interest, I'll try to keep this post up to date with new features, demos and screenshots. Currently working on : coarse fluid solver. I'm more than open to any comments, questions, suggestions and criticism you may have. [b]Update:[/b] New demo (fine fluid solver) [url=http://www.facepunch.com/threads/1049982-Cubic-dynamic-block-based-world-engine?p=27518824&viewfull=1#post27518824]here[/url]
So its a program that helps you develop a game like Minecraft? or a game that is like Minecraft? looks pretty good so far, good luck. :)
[QUOTE=Rangrgoto1;27458878]So its a program that helps you develop a game like Minecraft? or a game that is like Minecraft? looks pretty good so far, good luck. :)[/QUOTE] It's a C++ library as opposed to an application, but in essence, yes. Although I'm hoping it's not going to be the source of a bunch of half-assed Minecraft ripoffs... The game it's being written for certainly won't be a Minecraft clone, by a long way.
Wow, Great work!
Yes. Just yes.
Look sexy. Is this like a side-minor project, or would you like it to be a full-blown game in the end and charge $ for it?
Oh god that is amazing, it's very fast and interesting, i couldn't help but laugh at how the cubes almost seem alive; path-finding their way to where they need to go.
[QUOTE=Hubsha;27470551]Look sexy. Is this like a side-minor project, or would you like it to be a full-blown game in the end and charge $ for it?[/QUOTE] As stated above, it's a library. It will be used for a full-blown (although most likely free) game though. [QUOTE=Naelstrom;27471269]Oh god that is amazing, it's very fast and interesting, i couldn't help but laugh at how the cubes almost seem alive; path-finding their way to where they need to go.[/QUOTE] Thanks! For some reason the blocks look like they sort of bounce along. I find it kind of cute. FYI, I'm just about to add inverted gravity in my work towards the coarse fluid solver. It should, amongst other things, allow powders that float upwards.
Looks nice overall, may be a project that I don't hate.
Just added inverted gravity. Here's a rather hard to understand screenshot, the colored powder is falling upwards. The two powders sort of negotiate their way around eachother as best they can. [IMG]http://img11.hostingpics.net/pics/757464powder3.png[/IMG] I'm not promising anything for the next demo, but at some point in the near future, I'll try and add enough control to be able to consider the demo as some kind of experimental 3D falling sand game. [I]Would that be worth my time, as in would anyone like an expanded demo/gamelet thingy where you could play with the library's features as they evolve?[/I] But, first things first. My top priority is the coarse fluid solver.
[QUOTE=SatriAli;27472512] [I]Would that be worth my time, as in would anyone like an expanded demo/gamelet thingy where you could play with the library's features as they evolve?[/I][/QUOTE] Nearly every graphical library has some sort of demo application. It would be a great way to show off your library.
[QUOTE=florian;27475315]Nearly every graphical library has some sort of demo application. It would be a great way to show off your library.[/QUOTE] I agree with you entirely, it's more a question of whether people are interested enough for me to give it a high priority or not, cause there's no lack of other things to do.
Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?
[QUOTE={ABK}AbbySciuto;27475661]Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?[/QUOTE] Minecraft is still rendering more than that, but yeah.
[QUOTE={ABK}AbbySciuto;27475661]Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?[/QUOTE] crazy theory but not everyone likes C++.
[QUOTE={ABK}AbbySciuto;27475661]Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?[/QUOTE] Because C++ games can't be run in a browser, because notch knows Java better than C++ or maybe because there's no reason to. Minecraft runs at >100FPS with far more blocks. This is still awesome though! :smile:
[QUOTE={ABK}AbbySciuto;27475661]Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?[/QUOTE] The rendering is horribly unoptimised at the moment actually. Once the irrlicht renderer for Cubic has matured a bit, it should run a lot faster. At the moment I'm just trying to get the internal stuff like powders, mesh creation and fluids to run as fast as I can. The irrlicht code that's there is...well...let's say not quite production quality!
[QUOTE={ABK}AbbySciuto;27475661]Does that say 55 FPS? Why can't Minecraft be written in C++ instead of *shudders* Java?[/QUOTE] Is your computer from 1810 bro?
The coarse fluid solver is shaping up nicely. I just need to figure out how to efficiently restart the solver when a relevant change occurs. (ex: removing a wall that was holding fluid back) [img]http://img10.hostingpics.net/pics/931394fluidcoarse1.png[/img]
Hey, I tried out your little demo and it looks pretty cool. I noticed however, when I go up with my camera, about half the map height, and also look up, lightning totally disappears, leaving me with black boxes: [img]http://i56.tinypic.com/1o0o48.png[/img]
[QUOTE=Shammah;27477955]Hey, I tried out your little demo and it looks pretty cool. I noticed however, when I go up with my camera, about half the map height, and also look up, lightning totally disappears, leaving me with black boxes: [img_thumb]http://i56.tinypic.com/1o0o48.png[/img_thumb][/QUOTE] Thanks, I'd already noticed actually, but I have no idea what's causing it. It's obviously something in the horrible (testing-only) rendering code, so I'm not going to worry about it for now.
Could you post the code you use to set up the projection? I think I know what's wrong.
[QUOTE=Overv;27478204]Could you post the code you use to set up the projection? I think I know what's wrong.[/QUOTE] You do? Well that would be nice... The projection matrix is created by Irrlicht using this call : [code]buildProjectionMatrixPerspectiveFovRH( _fovy, _aspect, _zNear, _zFar );[/code] The FOV, aspect ratio and near/far values a calculated/set exactly the same way as in the default Irrlicht camera. If you need more code I can post the whole camera class. It's somewhat large though.
Oh, I was thinking about an OpenGL thing. Sorry.
[QUOTE=SatriAli;27458994]It's a C++ library as opposed to an application, but in essence, yes. Although I'm hoping it's not going to be the source of a bunch of half-assed Minecraft ripoffs... The game it's being written for certainly won't be a Minecraft clone, by a long way.[/QUOTE] Too bad, anything with cubes is going to make an infiniminer clone.
[QUOTE=Overv;27478448]Oh, I was thinking about an OpenGL thing. Sorry.[/QUOTE] Ah ok, nevermind. My guess is it will stop happening when I get round to writing proper code for the rendering anyway. [QUOTE=supersnail11;27478666]Too bad, anything with cubes is going to make an infiniminer clone.[/QUOTE] I'm going to have to disagree with you on that. The game this is being made for isn't going to be a clone of anything. Block-based terrain in itself isn't enough to make it a clone if the gameplay bears absolutely no resemblance...
[QUOTE=SatriAli;27478692]Ah ok, nevermind. My guess is it will stop happening when I get round to writing proper code for the rendering anyway. I'm going to have to disagree with you on that. The game this is being made for isn't going to be a clone of anything. Block-based terrain in itself isn't enough to make it a clone if the gameplay bears absolutely no resemblance...[/QUOTE] I mean, people are going to make a clone using your engine. [sp]People may mean me[/sp]
[QUOTE=supersnail11;27478823]I mean, people are going to make a clone using your engine. [sp]People may mean me[/sp][/QUOTE] Luckily, this isn't an engine, but a library, and there's a really big difference between those two. And about your cloning problem, I bet there are also a lot of people creative enough to design a strategy or puzzle game which would benefit from this library. Besides, there are already enough minecraft clones already, so it's not like this "endangers" the game or it's genre anyway.
The coarse fluid solver seems to handle large volumes rather well... [IMG]http://img10.hostingpics.net/pics/960051fluidcoarse2.png[/IMG] [QUOTE=Shammah;27479010]Luckily, this isn't an engine, but a library, and there's a really big difference between those two.[/QUOTE] And what exactly is the difference? Seems to me a library which can handle pretty much everything for you...can be called an engine. To me "engine" means the thing that powers something. Cubic handles everything about the block-based environment, so I think by my definition it can be called a block-based world engine. I may be wrong though. @supersnail : I'll be happy to see it used at all I think, so please do!
[QUOTE=SatriAli;27479175]The coarse fluid solver seems to handle large volumes rather well... [img_thumb]http://img10.hostingpics.net/pics/960051fluidcoarse2.png[/img_thumb] And what exactly is the difference? Seems to me a library which can handle pretty much everything for you...can be called an engine. @supersnail : I'll be happy to see it used at all I think, so please do![/QUOTE] An engine would mean an all-inclusive package which contains for example graphics, audio, input and networking. Take the Unreal engine for example, or the Source Engine. Your library on the other hand is only focused on blocks and it's rendering, so you wouldn't exactly call it a game engine. Just take a look at OGRE, which isn't an engine either, but more of a Graphics Library.
Sorry, you need to Log In to post a reply to this thread.