Appearance
Making a 3D Game
New in MNodes 1.1.8
The Scene 3D World, Character, Enemy and Item are new in MNodes 1.1.8, with the Follow row of the Scene 3D Camera. Older versions do not have them, so a project that uses them needs 1.1.8 or newer.
MNodes can make a 3D game with no code, the same way it makes a 2D game: you paint the level, choose who is in it and how each one moves, and wire what happens in the game into the rest of your patch. The level is made of blocks, like building with toy bricks: you paint it seen from above, and each click puts one more block on top of a column. Every setting is described in the Scene node reference.
Start in one minute
- Add a Scene 3D World.
- Select it and press Add at the bottom of its body, then A Game. A Scene, a hero, a camera, a light and a sky are added beside it and wired to it.
- Click the Scene and play: the arrow keys (or W A S D) walk, Space jumps. A game controller works too, with no setup: the left stick walks, A jumps, and the right stick turns the camera.
The arrows always go the way the camera looks: Up walks away from the camera, Left to its left. Drag the view in the Scene to turn the camera round the hero.
Now select the World again. Pick a kind in the palette along the top of its body (Grass, Rock, Ramp, Water, Spikes, Coin...) and click a square of the level: one block of that kind goes on top of that column. A right-click takes the top block off. The little 3D view beside the painter shows the level as it will look: drag it to turn it, and the wheel brings it nearer. Every stroke can be undone.
How the pieces fit
The World is the stage, the Characters are the actors, and the Scene is the window you watch through. Everything in the level is wired into the World's Objects, and the World is wired into a Scene.
Character ─┐
Enemy ├─► Scene 3D World ─► Scene
Item │
Camera │
Light, Sky ─┘| Node | What it is | Wire its Object into |
|---|---|---|
| Scene 3D World | The level: its blocks, its physics and what happens in it. | A Scene's Objects |
| Scene 3D Character | Someone in the level: the hero, an enemy, someone to talk to. | The World's Objects |
| Scene 3D Enemy | A Character that starts as an enemy. | The World's Objects |
| Scene 3D Item | Something to pick up: a gem, a key, a heart. | The World's Objects |
| Scene 3D Camera | With Follow on, how the camera follows the hero. | The World's Objects |
The World is a 3D view of its own, so every other Scene 3D node wires into it as into a Scene 3D View: a Light for sunshine and shadows, a Sky, Fog, a Model or a Shape for a tree or a house, a Sound that plays where it stands.
Ideas behind everything
1. Everything counts in blocks. A block is one unit of the world, a metre. A Speed of 5 walks five blocks a second; a Jump Height of 1.6 jumps a block and a half, enough to get onto the next block up.
2. Each click is one block. With Height on Add (at the bottom of the painter), a click puts one block of the kind you picked on top of the column, and a right-click takes the top one off. Set Height to a number from 1 to 8 and a click or a drag paints whole columns that high, quick for a floor or a wall. A column of height 0 is a pit: falling into one is a Hurt, and the hero is back at its last checkpoint. Coin, Goal, Checkpoint and Start go on top of a column without making it higher.
3. Each kind does something. Grass and Rock are ground. A Ramp is walked up, rising the way its arrow points: click Ramp in the palette again to turn it. A Ledge is a thin floor up high, over the ground, that you jump up through from under it. Water is swum in, Ice is slippery, a Spring throws the hero up, and Spikes hurt it and send it back to safe ground. Coins are collected, the Goal says the level is done, and a Checkpoint is where the hero comes back to.
4. Control says who moves a Character. Player: its keys and its game controller. Enemy: it wanders by itself and hurts the hero. NPC: someone to talk to, who says when the hero comes near. Patch: only its inputs move it.
5. The camera follows. With no camera wired in, the World follows the hero from behind. Wire a Scene 3D Camera into the World and set its Follow: Behind (turned with the right stick or by dragging the view) or Above (from above at an angle, never turning: the easiest for young players).
6. The World says what happens; the patch decides what it means. Out of the World come Coin, Goal, Checkpoint and Hurt; out of the hero come Step, Jump, Land, Health and Died. Wire them into a Stepper, a sound, a text on the Scene: a score, lives, music that changes.
Recipes
A score. Wire the World's Coin into a Stepper's Up: each coin adds 1. Wire its Count into a Prepend Text with the Prefix "Coins ", and that into a Scene Text to show it.
Lives and Game Over. The hero's Health (3 as it starts, in its Inspector) goes down each time it is hurt. Wire Health into a Scene Text, and Died into a Stepper's Down, with Min 0, Max 3 and Set 3: three lives. Its Min Hit into the World's Pause stops everything at 0 lives: show "Game Over" then.
A sound for each step. Wire the hero's Step into a drum, and Land into another. Fall says how far it fell, for a bigger thump.
An enemy. Add an Enemy with the World's Add. It wanders by itself, turning at walls, edges, water and spikes. Set Follows in its Inspector to have it go after the hero once it is that close. The hero jumping on top of it stomps it (the World's Stomp); walking into it is a Hurt.
Someone to talk to. Add Someone to Talk To with Add. Its Near says 1 as the hero comes close, and Talk fires when the hero presses Space (or the pad's A) beside it: wire it into a Scene Text with what it says.
Something to pick up. Add an Item with Add, and set its Name (key, heart). Its Picked fires as the hero takes it, and Left says how many are still there: at 0, the way on opens.
The end of the level. Wire the World's Goal into a sound and into Pause, and show "Well done!".
Your own keys. In the hero's Inspector, Controls: set Keys to Your Own and pick the key for each thing it does, and Pad Buttons to Your Own for the controller. Actions adds things of your own to do: "Run = R, Pad RT" sends "Run" out of Action, then Pressed and Released.
The level as text
The level is two texts in the World's Inspector, so you can copy one to keep it or paste one in to try it. Map has a letter for each column: . grass, # rock, / and \ ramps rising to the right and to the left, A and V ramps rising up and down the map, = a ledge, ~ water, I ice, S a spring, ^ spikes, o a coin, G the goal, C a checkpoint and P the start. Heights has a digit for each column, from 0 (nothing) to 9 blocks.
Needs: the World's painter and its little 3D view, and the game in the Scene, seen from behind the hero.
