Skip to main content

NexusFine

Physics engine for 2D/3D game prototyping with optional AI acceleration.

Installation

pip install NexusFine

Quick Start

from nexusfine import NF

api = "sk-xxxxxx"
x = "x_axis"
y = "y_axis"

NF(api)
NF(x)
NF(y)
NF(x, y)
NF("Game.exe")

Modules

Module Description Provides
NF Bullet physics Bullet(), Steam()
NB Ball physics Ball()
NC Cloud physics Cloud()
NS Configuration config(), apply()

Physics Objects

Bullet

from nexusfine import NF

bullet = NF.Bullet(
    x=0, y=10,
    vx=5, vy=0,
    gravity=300
)
bullet.update(0.016)

Ball

from nexusfine import NB

ball = NB.Ball(
    x=0, y=5,
    radius=10,
    gravity=300,
    bounce=0.8,
    ground_y=600
)
ball.update(0.016, width=800, height=600)

Cloud

from nexusfine import NC

cloud = NC.Cloud(
    x=0, y=5,
    vx=0.5, vy=0.1
)
cloud.update(0.016)

Steam

from nexusfine import NF

steam = NF.Steam(
    x=0, y=0, z=0,
    rise_speed=0.5,
    diffusion=0.3
)
steam.update(0.016)

AI Configuration

Enable AI with DeepSeek

from nexusfine import NB, NS

api = "sk-your-deepseek-key"
NS.apply(NB, mode="A", duration=60)
NB(api)
NB("x")
NB("y")
NB("x", "y")

NB.set_ai("deepseek")

ball = NB.Ball(x=400, y=300, radius=20)
ball.engine = NB
ball.update(0.016, 800, 600)

Enable AI with OpenAI

NB.set_ai("openai", model="gpt-3.5-turbo")

Enable AI with Local Ollama (Free)

NB.set_ai("ollama", model="llama3.2", api_base="http://localhost:11434/api/generate")

Mode Reference

Mode Description AI Status
A AI Enhanced Enabled
B Balanced Enabled
C Local Only Disabled
from nexusfine import NF, NS

NS.apply(NF, mode="C", duration=60)

Parameters Reference

Bullet Parameters

Bullet(x, y, vx, vy, gravity)
Parameter Description Default
x Initial X position 0
y Initial Y position 0
vx Initial X velocity 5
vy Initial Y velocity 0
gravity Gravity (pixels/sec²) 300

Ball Parameters

Ball(x, y, radius, gravity, bounce, ground_y)
Parameter Description Default
x Initial X position 0
y Initial Y position 0
radius Ball radius 10
gravity Gravity (pixels/sec²) 300
bounce Bounce coefficient (0-1) 0.8
ground_y Ground position 600

Ball.update(dt, width, height)

  • dt: Time step
  • width: Screen width (enables wall collision)
  • height: Screen height (enables wall collision)

Cloud Parameters

Cloud(x, y, vx, vy)
Parameter Description Default
x Initial X position 0
y Initial Y position 0
vx X velocity 0.5
vy Y velocity 0.1

Steam Parameters

Steam(x, y, z, rise_speed, diffusion)
Parameter Description Default
x Initial X position 0
y Initial Y position 0
z Initial Z position 0
rise_speed Upward speed 0.5
diffusion Spread amount 0.3

AI Providers

Provider Type Key Format Setup
DeepSeek Cloud sk-xxxxxx Get from platform.deepseek.com
OpenAI Cloud sk-xxxxxx Get from platform.openai.com
Ollama Local Not required Install ollama.ai

Fallback Behavior

When AI is enabled but fails (network error, invalid key, timeout):

  • The engine automatically falls back to local physics
  • Your game continues running without interruption
  • No manual error handling required

Requirements

Python >= 3.6
requests >= 2.25.0

License

MIT

Metadata

Release files for NexusFine 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for NexusFine 1.0.4
File Size Uploaded
nexusfine-1.0.4.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for NexusFine 1.0.4
File Interpreter ABI Platform
nexusfine-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / nexusfine-1.0.4.tar.gz

Download URL nexusfine-1.0.4.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5f983a3f92fc6f0d28995bee65a8736755516333a2f314214ca9c792a1d6aa19
BLAKE2b-256 checksum
How to use checksums
bacb5ba348063b8c97382dbeaea3792b3ceb8596c9ab04a5d698e2e7c4f79755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / nexusfine-1.0.4-py3-none-any.whl

Download URL nexusfine-1.0.4-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f15dcf8fcb0ba00f9f32e45d4c84f53a8c633a2f120729e2b35c1adc0082da1b
BLAKE2b-256 checksum
How to use checksums
c2e393d677c336d69b642f03638432e8dc7ce83b652a9f38ec2f2e2348c3341d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page