hlpl 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hlpl/__init__.py +6 -0
- hlpl/character/__init__.py +1 -0
- hlpl/character/e_character.py +31 -0
- hlpl/core/__init__.py +0 -0
- hlpl/core/parser.py +26 -0
- hlpl/core/world.py +23 -0
- hlpl/environment/__init__.py +1 -0
- hlpl/environment/e_city.py +19 -0
- hlpl/robotics/__init__.py +1 -0
- hlpl/robotics/deploy.py +14 -0
- hlpl-0.1.0.dist-info/METADATA +61 -0
- hlpl-0.1.0.dist-info/RECORD +15 -0
- hlpl-0.1.0.dist-info/WHEEL +5 -0
- hlpl-0.1.0.dist-info/licenses/LICENSE +21 -0
- hlpl-0.1.0.dist-info/top_level.txt +1 -0
hlpl/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .e_character import ECharacter
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional, Tuple
|
|
4
|
+
from ..core.parser import HLPLParser, HLPLMind
|
|
5
|
+
@dataclass
|
|
6
|
+
class Appearance:
|
|
7
|
+
source: str; dynamic_angles: bool=True; model_path: Optional[str]=None
|
|
8
|
+
def clone_from_static(self):
|
|
9
|
+
print(f"[HLPL::Appearance] Cloning appearance from {self.source} -> dynamic asset"); self.model_path=f"dynamic://{self.source}"
|
|
10
|
+
@dataclass
|
|
11
|
+
class Mind:
|
|
12
|
+
code: str=""; parsed: Optional[HLPLMind]=None
|
|
13
|
+
def compile(self):
|
|
14
|
+
parser=HLPLParser(); self.parsed=parser.parse(self.code); return self.parsed
|
|
15
|
+
class ECharacter:
|
|
16
|
+
def __init__(self, name: str, appearance_source: str, personality_code: str="", role: str="citizen"):
|
|
17
|
+
self.name=name; self.appearance=Appearance(source=appearance_source); self.mind=Mind(code=personality_code)
|
|
18
|
+
self.role=role; self.position: Tuple[float,float,float]=(0,0,0); self.world=None
|
|
19
|
+
self.appearance.clone_from_static(); self.mind.compile()
|
|
20
|
+
def update(self, dt: float, global_time: float): pass
|
|
21
|
+
def export_zip(self, out_path: str):
|
|
22
|
+
import zipfile, json
|
|
23
|
+
with zipfile.ZipFile(out_path,'w') as z:
|
|
24
|
+
z.writestr("character.json", json.dumps({
|
|
25
|
+
"name":self.name,"role":self.role,"appearance_source":self.appearance.source,
|
|
26
|
+
"traits":self.mind.parsed.traits if self.mind.parsed else {},
|
|
27
|
+
"memories":self.mind.parsed.memories if self.mind.parsed else {},
|
|
28
|
+
"behaviors":self.mind.parsed.behaviors if self.mind.parsed else {}
|
|
29
|
+
}, indent=2))
|
|
30
|
+
z.writestr("mind.hlpl", self.mind.code)
|
|
31
|
+
return out_path
|
hlpl/core/__init__.py
ADDED
|
File without changes
|
hlpl/core/parser.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import re
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from typing import Dict, Any
|
|
5
|
+
@dataclass
|
|
6
|
+
class HLPLMind:
|
|
7
|
+
traits: Dict[str, Any]=field(default_factory=dict)
|
|
8
|
+
memories: Dict[str, Any]=field(default_factory=dict)
|
|
9
|
+
behaviors: Dict[str, Any]=field(default_factory=dict)
|
|
10
|
+
raw_code: str=""
|
|
11
|
+
class HLPLParser:
|
|
12
|
+
TRAIT_RE=re.compile(r"trait\s+(\w+):\s*(.+)")
|
|
13
|
+
MEMORY_RE=re.compile(r"memory\s+(\w+):\s*(.+)")
|
|
14
|
+
BEHAVIOR_RE=re.compile(r"behavior\s+(\w+):\s*(.+)")
|
|
15
|
+
def parse(self, code: str)->HLPLMind:
|
|
16
|
+
mind=HLPLMind(raw_code=code)
|
|
17
|
+
for line in code.splitlines():
|
|
18
|
+
line=line.strip()
|
|
19
|
+
if not line or line.startswith("#"): continue
|
|
20
|
+
m=self.TRAIT_RE.match(line)
|
|
21
|
+
if m: mind.traits[m.group(1)]=m.group(2).strip(); continue
|
|
22
|
+
m=self.MEMORY_RE.match(line)
|
|
23
|
+
if m: mind.memories[m.group(1)]=m.group(2).strip(); continue
|
|
24
|
+
m=self.BEHAVIOR_RE.match(line)
|
|
25
|
+
if m: mind.behaviors[m.group(1)]=m.group(2).strip()
|
|
26
|
+
return mind
|
hlpl/core/world.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
from typing import List
|
|
3
|
+
from ..environment.e_city import ECity
|
|
4
|
+
from ..character.e_character import ECharacter
|
|
5
|
+
class World:
|
|
6
|
+
def __init__(self, environment: ECity, name: str="world"):
|
|
7
|
+
self.name=name; self.environment=environment; self.characters: List[ECharacter]=[]; self.time=0.0
|
|
8
|
+
def spawn(self, character: ECharacter, position=(0,0,0)):
|
|
9
|
+
character.position=position; character.world=self; self.characters.append(character)
|
|
10
|
+
print(f"[HLPL] Spawned {character.name} at {position} in {self.environment.name}"); return character
|
|
11
|
+
def simulate(self, steps=100, dt=0.1):
|
|
12
|
+
print(f"[HLPL] Simulating world '{self.name}' with {len(self.characters)} characters...")
|
|
13
|
+
for _ in range(steps):
|
|
14
|
+
self.time+=dt; self.environment.update(self.time)
|
|
15
|
+
for c in self.characters: c.update(dt, self.time)
|
|
16
|
+
print("[HLPL] Simulation finished.")
|
|
17
|
+
def export_package(self, path: str):
|
|
18
|
+
import zipfile, json; from pathlib import Path
|
|
19
|
+
p=Path(path)
|
|
20
|
+
with zipfile.ZipFile(p,'w') as z:
|
|
21
|
+
meta={"name":self.name,"environment":self.environment.name,"characters":[c.name for c in self.characters],"time":self.time}
|
|
22
|
+
z.writestr("world.json", json.dumps(meta, indent=2))
|
|
23
|
+
print(f"[HLPL] Exported world package to {path}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .e_city import ECity
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import json, zipfile
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Tuple, List, Optional
|
|
5
|
+
@dataclass
|
|
6
|
+
class GeoAnchor:
|
|
7
|
+
lat: float; lon: float; direction_deg: float=0.0
|
|
8
|
+
class ECity:
|
|
9
|
+
def __init__(self, name: str, geo_coords: Tuple[float,float]=(0,0), source_path: Optional[str]=None):
|
|
10
|
+
self.name=name; self.geo_coords=geo_coords; self.source_path=source_path; self.anchors: List[GeoAnchor]=[]; self.is_dynamic=False
|
|
11
|
+
@classmethod
|
|
12
|
+
def from_static_data(cls, source: str, geo_coords: Tuple[float,float], name: str="e-city"):
|
|
13
|
+
print(f"[HLPL::ECity] Ingesting static data from {source} at {geo_coords}")
|
|
14
|
+
city=cls(name=name, geo_coords=geo_coords, source_path=source); city.is_dynamic=True; return city
|
|
15
|
+
def update(self, time: float): pass
|
|
16
|
+
def export_zip(self, out_path: str):
|
|
17
|
+
with zipfile.ZipFile(out_path,'w') as z:
|
|
18
|
+
z.writestr("city.json", json.dumps({"name":self.name,"geo":self.geo_coords}, indent=2))
|
|
19
|
+
return out_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .deploy import RobotDeploy
|
hlpl/robotics/deploy.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from ..character.e_character import ECharacter
|
|
4
|
+
@dataclass
|
|
5
|
+
class RealismProfile:
|
|
6
|
+
skin_sim: bool=False; weight_dynamics: bool=False; micro_expressions: bool=False; level: str="basic"
|
|
7
|
+
class RobotDeploy:
|
|
8
|
+
def __init__(self, character: ECharacter, realism: str="advanced"):
|
|
9
|
+
self.character=character; self.realism=RealismProfile(level=realism)
|
|
10
|
+
if realism=="indistinguishable":
|
|
11
|
+
self.realism.skin_sim=True; self.realism.weight_dynamics=True; self.realism.micro_expressions=True
|
|
12
|
+
def deploy(self, hardware_id: str):
|
|
13
|
+
print(f"[HLPL::Robotics] Deploying {self.character.name} to {hardware_id} with realism={self.realism.level}")
|
|
14
|
+
return {"status":"deployed","hardware":hardware_id,"character":self.character.name}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hlpl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Human Life Programming Language - Build dynamic digital characters and living environments
|
|
5
|
+
Author: HLPL Project
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: hlpl,simulation,e-character,e-city,robotics
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pillow>=9.0
|
|
15
|
+
Requires-Dist: numpy>=1.21
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# HLPL: Human Life Programming Language
|
|
19
|
+
|
|
20
|
+
**HLPL** (Human Life Programming Language) is a specialized programming language developed to build dynamic digital characters and simulate their living environments.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🌍 Environment & Nature Simulation
|
|
25
|
+
Simulating an environment involves digitally constructing cities, villages, and natural elements (such as trees, mountains, clouds, sky, and earth).
|
|
26
|
+
|
|
27
|
+
* **How it works:** HLPL takes static data (like images) from a real-world environment and transforms it into a dynamic, real-time view.
|
|
28
|
+
* **The Result:** The perspective changes seamlessly based on position and time—just as it would in the real world—effectively transforming static captures into interactive **e-cities**.
|
|
29
|
+
|
|
30
|
+
## 👥 Character Simulation
|
|
31
|
+
HLPL allows you to create digital characters—including humans, animals, plants, and even inanimate objects—complete with lifelike interactions and emotional logic. Character creation consists of two main pillars:
|
|
32
|
+
|
|
33
|
+
1. **Appearance Cloning:** HLPL takes static images of a subject and converts them into a dynamic asset that shifts smoothly across all angles, mirroring how a real-world camera perspective changes.
|
|
34
|
+
2. **Mind Cloning:** Developers write HLPL code based on the behavioral patterns, memory, and personality of the real-life subject.
|
|
35
|
+
|
|
36
|
+
Combining appearance and mind into a single codebase results in an **e-character** that can be revived and hosted on the internet.
|
|
37
|
+
|
|
38
|
+
## 🤖 Robotics Integration
|
|
39
|
+
Characters created with HLPL can be deployed into physical robotics, resulting in highly lifelike creatures.
|
|
40
|
+
|
|
41
|
+
* **Complexity Scaling:** The larger and more comprehensive the character code, the more human-like the robot becomes.
|
|
42
|
+
* **The Horizon of Realism:** By writing extensive code that covers a vast range of real-life possibilities, you can create a simulation so precise that an average human cannot distinguish the robot from a real person. This advanced tier involves simulating realistic skin, weight dynamics, and nuanced movement styles, requiring a robust technological foundation.
|
|
43
|
+
|
|
44
|
+
## đź’Ľ Use Cases & Applications
|
|
45
|
+
* **Professional Roles:** HLPL characters can serve as digital teachers, business receptionists, or fill any role requiring guidance and leadership.
|
|
46
|
+
* **Physical Automation:** They can be deployed into hardware to perform physical labor, though this requires significant manufacturing capital.
|
|
47
|
+
* **Scale Flexibility:** HLPL can simulate a single isolated living entity or scale up to model an entire society of distinct characters interacting within a shared environment.
|
|
48
|
+
|
|
49
|
+
## 📦 Data Structure & File Formats
|
|
50
|
+
The project organizes its assets using highly structured compressed packages:
|
|
51
|
+
|
|
52
|
+
| Asset Type | Package Format | Contents |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
| **Character** | `.zip` file | Contains character blueprints, animations, movement paths, localized settings, and behavioral HLPL code. |
|
|
55
|
+
| **City / Village** | `.zip` file | Contains comprehensive environmental imagery (buildings, houses, terrain, mountains) mapped to specific geographical coordinates and viewing directions. |
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## PyPI Install
|
|
59
|
+
```bash
|
|
60
|
+
pip install hlpl
|
|
61
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
hlpl/__init__.py,sha256=6IF8vgA8LkYsoUQl0aek-prwYL-hOUPPM3UODvZY2GE,211
|
|
2
|
+
hlpl/character/__init__.py,sha256=Yu9SlI7q0iZ86rs5QVYebIvFu7rhhudEyn6NgANdu3o,36
|
|
3
|
+
hlpl/character/e_character.py,sha256=1tO1SSliPby5o74s8xNmyuw4KbusLWSbV1X3zyn_YbM,1635
|
|
4
|
+
hlpl/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
hlpl/core/parser.py,sha256=CMcE__Ls5OQpHTGvWKrjcAE0E_BlfNBsaYLlYmGDzac,1033
|
|
6
|
+
hlpl/core/world.py,sha256=gOQty1DiBoJA6kdoCfaeSjuiwkWM1ImFnzfvAmo14ak,1316
|
|
7
|
+
hlpl/environment/__init__.py,sha256=hhK0NoTk0JRjKMYZ4e-KiT5_enb4DyOy1XmPBuM9y4w,26
|
|
8
|
+
hlpl/environment/e_city.py,sha256=ihvnqIj5OajZEnwNjmZKcxRYwe1CoLHEjImXgXOqv2E,992
|
|
9
|
+
hlpl/robotics/__init__.py,sha256=Q4oTSKL_6dyA1eHCUPtZS8NDIwvpR59P61vLCEr8KXY,32
|
|
10
|
+
hlpl/robotics/deploy.py,sha256=e5nFM3Khi5JEkK-MPrNpE71sQVJFVGkaVpajdM2h8Po,790
|
|
11
|
+
hlpl-0.1.0.dist-info/licenses/LICENSE,sha256=-V9Fli9G1-GKvX_QNnEMxJxw-EhnVNBcLGpdNR7cC1g,1088
|
|
12
|
+
hlpl-0.1.0.dist-info/METADATA,sha256=_It5O6J3Fy8tvgnnE0Dti5bY30wH3pg4YS3txQTwAYM,3680
|
|
13
|
+
hlpl-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
14
|
+
hlpl-0.1.0.dist-info/top_level.txt,sha256=LNE0HK7WDg6KbMsfBk4vd0Y2PLN9DmjUpw4FsCANG_8,5
|
|
15
|
+
hlpl-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Human Life Programming Language
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hlpl
|