Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
094502c8
Commit
094502c8
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Fixed world border collision
parent
0d0805bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!38
Resolve "Finalize coordinate system"
Pipeline
#45034
failed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
overcooked_simulator/game_content/layouts/basic.layout
+1
-1
1 addition, 1 deletion
overcooked_simulator/game_content/layouts/basic.layout
overcooked_simulator/overcooked_environment.py
+26
-23
26 additions, 23 deletions
overcooked_simulator/overcooked_environment.py
with
27 additions
and
24 deletions
overcooked_simulator/game_content/layouts/basic.layout
+
1
−
1
View file @
094502c8
...
...
@@ -5,5 +5,5 @@ W__________I
#__A_____A_D
C__________E
C__________G
#__________
#
#__________
_
#P#S+#X##S+#
\ No newline at end of file
This diff is collapsed.
Click to expand it.
overcooked_simulator/overcooked_environment.py
+
26
−
23
View file @
094502c8
...
...
@@ -162,6 +162,9 @@ class Environment:
self
.
free_positions
,
)
=
self
.
parse_layout_file
()
self
.
world_borders_x
=
[
-
0.5
,
self
.
kitchen_width
-
0.5
]
self
.
world_borders_y
=
[
-
0.5
,
self
.
kitchen_height
-
0.5
]
progress_counter_classes
=
list
(
filter
(
lambda
cl
:
hasattr
(
cl
,
"
progress
"
),
...
...
@@ -315,14 +318,10 @@ class Environment:
free_positions
.
append
(
np
.
array
([
current_x
,
current_y
]))
current_x
+=
1
# if current_x > self.kitchen_width:
# self.kitchen_width = current_x
current_y
+=
1
# self.kitchen_width -= 0.5
self
.
kitchen_width
:
float
=
len
(
lines
[
0
])
self
.
kitchen_height
=
len
(
lines
)
self
.
kitchen_width
:
float
=
len
(
lines
[
0
])
+
2
self
.
kitchen_height
=
len
(
lines
)
+
2
self
.
counter_factory
.
post_counter_setup
(
counters
)
return
counters
,
designated_player_positions
,
free_positions
...
...
@@ -565,9 +564,13 @@ class Environment:
Returns: True if the player touches the world bounds, False if not.
"""
collisions_lower
=
any
((
player
.
pos
-
(
player
.
radius
))
<
0
)
collisions_lower
=
any
(
(
player
.
pos
-
(
player
.
radius
))
<
[
self
.
world_borders_x
[
0
],
self
.
world_borders_y
[
0
]]
)
collisions_upper
=
any
(
(
player
.
pos
+
(
player
.
radius
))
>
[
self
.
kitchen_width
,
self
.
kitchen_height
]
(
player
.
pos
+
(
player
.
radius
))
>
[
self
.
world_borders_x
[
1
],
self
.
world_borders_y
[
1
]]
)
return
collisions_lower
or
collisions_upper
...
...
@@ -586,21 +589,21 @@ class Environment:
counter
.
progress
(
passed_time
=
passed_time
,
now
=
self
.
env_time
)
self
.
order_and_score
.
progress
(
passed_time
=
passed_time
,
now
=
self
.
env_time
)
#
def get_state(self):
#
"""Get the current state of the game environment. The state here is accessible by the current python objects.
#
#
Returns: Dict of lists of the current relevant game objects.
#
#
"""
#
return {
#
"players": self.players,
#
"counters": self.counters,
#
"score": self.order_and_score.score,
#
"orders": self.order_and_score.open_orders,
#
"ended": self.game_ended,
#
"env_time": self.env_time,
#
"remaining_time": max(self.env_time_end - self.env_time, timedelta(0)),
#
}
def
get_state
(
self
):
"""
Get the current state of the game environment. The state here is accessible by the current python objects.
Returns: Dict of lists of the current relevant game objects.
"""
return
{
"
players
"
:
self
.
players
,
"
counters
"
:
self
.
counters
,
"
score
"
:
self
.
order_and_score
.
score
,
"
orders
"
:
self
.
order_and_score
.
open_orders
,
"
ended
"
:
self
.
game_ended
,
"
env_time
"
:
self
.
env_time
,
"
remaining_time
"
:
max
(
self
.
env_time_end
-
self
.
env_time
,
timedelta
(
0
)),
}
def
get_json_state
(
self
,
player_id
:
str
=
None
):
state
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment