How to Coffee Makers and E bay Perfectly Matched?

Coffee goods and the eBay auction website are well suited to each other, with the technical assistance of eBay you will find thousands upon thousands of items that will help you enjoy the magical…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




3D Classic Games with Flutter

This article is a guide on how to create classic 3d games with native flutter widgets (no game engine)

When you finish reading you’ll be in for a treat! An open-source project containing all 3d apps I made using zflutter including examples from this article.

Let’s get started.

Classic games usually do not require complex shapes, basic geometric shapes are more than enough.

Basic 3d flutter widget shapes
Basic flutter 3d widget shapes

I will provide two examples using already implemented 3d games.

1.1 Chess Game:
Let’s say you are creating a 3d chess game, first of all, you want to start modeling chess pieces.
we will start with the biggest piece “King”

king chess piece modeling with flutter
king chess piece modeling with flutter

That’s it, just break down any shape you want to render to the basic geometric shapes.
and the result is:

3d flutter chessboard
3d flutter chessboard

1.2 Rubik's cube Game:
A Rubik’s cube is much easier to model, just use Boxes distributed in 3d space to form the desired cube.

Rubik’s cube modeling with flutter

Since we aren’t using any game engine, we don’t have the camera concept.
to simplify it, think about it as this; we have a still non-rotatable camera pointing to (x:0, y:0, z:0).
so you are only able to move items in the scene, not the camera itself.
You can control the position and rotation of a 3d widget by wrapping it Zpositioned widget.

Again we are not using any game engine, meaning that we can’t use physics to move objects.
but we can simulate movements using flutter animations by changing position, rotation and scale of a shape which will make it seem as if the shape is moving .

Let’s go back to the Rubik’s cube game, to rotate the faces we have to wrap the desired face with AnimatedBuilder like this:

That’s all the knowledge you need to start building your 3D game using flutter, I focused on the UI part but you are free to structure your game logic the way you want.
All current examples and following ones will be published on this repo

If you decided to start building your 3d flutter app, please read the following restrictions:

you can play online ZChess and ZRubik’s Cube.

Have fun.

Add a comment

Related posts:

Online interaction and its negative side

This week the negative side of online interaction such as misinformation, trolling, hostility, and hate speech. Among these negative aspects of online interaction, misinformation and toxicity are…

Infused Waters To Promote Body Detox

The human body consists of average 57% -75% of water. Water makes a big part of our muscles and is critical for energy production. If we want to ensure always to feel the best we should drink lots of…

El Don de Vicente

The Blind Troubador of Valencia. “El Don de Vicente” is published by Jessica Ruiz in This is Valencia.