Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LogicalDash/LiSE
Browse files Browse the repository at this point in the history
  • Loading branch information
clayote committed Feb 4, 2016
2 parents ff498c5 + 076c076 commit cd3f6ed
Show file tree
Hide file tree
Showing 39 changed files with 592 additions and 338 deletions.
18 changes: 18 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
=== Alpha 6 | 2016-02-01 ===
* Opening a functions editor no longer crashes the app.
* All the function editors are now in tabs of one screen.
* Nicer auto layout of spots.
* Various smaller fixes.


=== Alpha 5 | 2016-01-03 ===
* A whole new approach to interprocess communication resulting in much more acceptable performance within ELiDE.
* LiSE caches the whole world state.
* ELiDE has a new caching scheme as well. This is invisible to the user but rules out some aliasing bugs.
* Fixed some rules not being polled.
* A new example, college.py, and some fixes to kobold.py where it hadn't kept up with API changes.
* The first sprouts of a world generation API, currently undocumented since I myself don't know how to work with it. Observe its methods within the class AbstractCharacter in the LiSE.character module. Chain the methods together and play around with the order to the best effect.
* Lots of refactoring.
* Some new graphics from Marsh Davies for Procjam 2015. And it's easier to include your own now, with an atlas and a change in elide.ini (though undocumented).
* Real version numbers in the Python packages.

=== Alpha 4 | 2015-08-26 ===
* The rules editor is now usable under normal conditions. After you've made Actions and Triggers, check this out by selecting something and pressing the Rules button.
* The big > button will cause time to pass for so long as it is toggled, as it was always meant to.
Expand Down
18 changes: 7 additions & 11 deletions ELiDE.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,22 @@ if [ -e "$LISE_PATH" ] && [ -f "$LISE_PATH/.installed" ]; then
cd "$LISE_PATH";
git pull;
git submodule update;
python3 setup.py install --user --upgrade;
python3 -mpip install --user --upgrade LiSE/ ELiDE/;
python3 -m ELiDE;
else
if [ -e "$LISE_PATH" ]; then
# clean out failed installation
rm -rf "$LISE_PATH";
fi;
if [ -n "`uname -v | grep Ubuntu`" ]; then
# on Ubuntu-derived distros, install from PPA
mkfifo announce;
mkfifo addapt;
echo '
echo "About to install dependencies. This involves setting up two PPAs.";
echo "ppa:thopiekar/pygame";
sudo add-apt-repository -y ppa:thopiekar/pygame;
echo "ppa:kivy-team/kivy-daily";
sudo add-apt-repository -y ppa:kivy-team/kivy-daily;
echo "About to install dependencies."
echo "Updating package lists.";
sudo apt-get -y update;
echo "Installing dependencies.";
sudo apt-get -y install git cython3 python3-dev python3-setuptools python3-kivy;
sudo apt-get -y install git cython3 python3-dev python3-setuptools libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev;
echo "All dependencies installed." >announce;
sleep 1;
exit;' >addapt &
Expand Down Expand Up @@ -73,7 +68,8 @@ exit;' >addapt &
echo "Activating LiSE-virtualenv";
source LiSE-virtualenv/bin/activate;
echo "Installing Cython";
pip3 install cython;
python3 -mensurepip
python3 -mpip install --user cython;
echo "Getting latest Kivy master";
git clone https://github.com/kivy/kivy.git kivy;
WORKINGDIR=$PWD;
Expand All @@ -84,15 +80,15 @@ exit;' >addapt &
echo "libsdl2-ttf";
echo "libsdl2-image";
echo "libsdl2-mixer";
USE_SDL2=1 python3 setup.py install;
USE_SDL2=1 python3 -mpip install --user .;
cd $WORKINGDIR;
fi;

git clone https://github.com/LogicalDash/LiSE.git "$LISE_PATH";
cd "$LISE_PATH";
git submodule init;
git submodule update;
python3 setup.py install --user;
python3 -mpip install --user LiSE/ ELiDE/;

mkdir -p $HOME/.local/share/applications;
echo "[Desktop Entry]
Expand Down
9 changes: 4 additions & 5 deletions ELiDE/ELiDE/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is part of LiSE, a framework for life simulation games.
# Copyright (C) Zachary Spector, [email protected]
"""Object to configure, start, and stop ELiDE."""

import json

from kivy.logger import Logger
Expand Down Expand Up @@ -29,8 +31,6 @@
import ELiDE.charsview
from .util import trigger

"""Object to configure, start, and stop ELiDE."""

resource_add_path(ELiDE.__path__[0] + "/assets")
resource_add_path(ELiDE.__path__[0] + "/assets/rltiles")

Expand Down Expand Up @@ -232,11 +232,10 @@ def tog(*args):
)

self.funcs = ELiDE.funcsed.FuncsEdScreen(
table='trigger',
store=self.engine.trigger,
app=self,
name='funcs',
toggle=toggler('funcs')
)
self.funcs.bind(data=self.rules.rulesview._trigger_update_builders)

self.select_character(
self.engine.character[
Expand Down
2 changes: 1 addition & 1 deletion ELiDE/ELiDE/board/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from kivy.clock import Clock

from ..kivygarden.collider import Collide2DPoly
from ..util import get_thin_rect_vertices, ninety, fortyfive
from ..util import get_thin_rect_vertices, fortyfive


def get_points(ox, oy, ro, dx, dy, rd, taillen):
Expand Down
87 changes: 76 additions & 11 deletions ELiDE/ELiDE/board/board.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file is part of LiSE, a framework for life simulation games.
# Copyright (c) Zachary Spector, [email protected]
"""The big widget that shows the graph of the selected Character."""
from functools import partial
from kivy.properties import (
AliasProperty,
BooleanProperty,
StringProperty,
ReferenceListProperty,
DictProperty,
ObjectProperty,
Expand All @@ -23,10 +23,20 @@


class KvLayoutBack(FloatLayout):
"""What to show behind the graph.
By default, shows a static image.
"""
character = ObjectProperty()


class KvLayoutFront(FloatLayout):
"""What to show in front of the graph.
By default, shows nothing.
"""
pass


Expand Down Expand Up @@ -144,6 +154,11 @@ def make_spot(self, place):
place=place
)
self.spot[place["name"]] = r
if '_x' in place and '_y' in place:
r.pos = (
self.width * place['_x'],
self.height * place['_y']
)
return r

def make_arrow(self, portal):
Expand Down Expand Up @@ -356,11 +371,31 @@ def add_new_spots(self, *args):
)
)
spots_added = []
nodes_patch = {}
for place_name in self.app.character.place:
if place_name not in self.spot:
spot = self.make_spot(self.app.character.place[place_name])
place = self.app.character.place[place_name]
spot = self.make_spot(place)
patch = {}
if '_image_paths' in place:
zeroes = [0] * len(place['_image_paths'])
else:
patch['_image_paths'] = spot.default_image_paths
zeroes = [0]
if '_offxs' not in place:
patch['_offxs'] = zeroes
if '_offys' not in place:
patch['_offys'] = zeroes
if '_stackhs' not in place:
patch['_stackhs'] = zeroes
nodes_patch[place_name] = patch
self.spotlayout.add_widget(spot)
spots_added.append(spot)
self.app.engine.handle(
'update_nodes', (self.app.character.name, nodes_patch)
)
for spot in spots_added:
spot.finalize()
self.new_spots = spots_added

def add_arrow(self, orign, destn, *args):
Expand Down Expand Up @@ -421,9 +456,26 @@ def add_new_pawns(self, *args):
self.app.character.name
)
)
nodes_patch = {}
pawns_added = []
for thing_name in self.app.character.thing:
if thing_name not in self.pawn:
pwn = self.make_pawn(self.app.character.thing[thing_name])
thing = self.app.character.thing[thing_name]
pwn = self.make_pawn(thing)
pawns_added.append(pwn)
patch = {}
if '_image_paths' in thing:
zeroes = [0] * len(thing['_image_paths'])
else:
patch['_image_paths'] = Pawn.default_image_paths
zeroes = [0] * len(Pawn.default_image_paths)
if '_offxs' not in thing:
patch['_offxs'] = zeroes
if '_offys' not in thing:
patch['_offys'] = zeroes
if '_stackhs' not in thing:
patch['_stackhs'] = zeroes
nodes_patch[thing_name] = patch
try:
whereat = self.arrow[
pwn.thing['location']
Expand All @@ -434,6 +486,11 @@ def add_new_pawns(self, *args):
whereat = self.spot[pwn.thing['location']]
whereat.add_widget(pwn)
self.pawn[thing_name] = pwn
self.app.engine.handle(
'update_nodes', (self.app.character.name, nodes_patch)
)
for pwn in pawns_added:
pwn.finalize()

@trigger
def trigger_update(self, *args):
Expand Down Expand Up @@ -464,6 +521,10 @@ def update_from_diff(self, chardiff, *args):
for (place, extant) in chardiff['places'].items():
if extant and place not in self.spot:
self.add_spot(place)
spot = self.spot[place]
if '_x' not in spot.place or '_y' not in spot.place:
self.new_spots.append(spot)
self.spots_unposd.append(spot)
elif not extant and place in self.spot:
self.rm_spot(place)
for (thing, extant) in chardiff['things'].items():
Expand Down Expand Up @@ -523,23 +584,27 @@ def nx_layout(self, *args):
go, and move them there.
"""
for spot in self.new_spots:
if not (spot.name and spot.remote):
Clock.schedule_once(self.nx_layout, 0)
return
spots_only = self.app.character.facade()
for thing in list(spots_only.thing.keys()):
del spots_only.thing[thing]
l = self.grid_layout(spots_only)

def position_spot(spot, x, y, *args):
if not (spot.name and spot.remote):
Clock.schedule_once(partial(position_spot, spot, x, y), 0)
return
spot.remote['_x'] = x
spot.remote['_y'] = y
node_upd = {}

for spot in self.new_spots:
(x, y) = l[spot.name]
node_upd[spot.remote.name] = {'_x': x, '_y': y}
spot.pos = (
int(x * self.width),
int(y * self.height)
)
for spot in self.new_spots:
position_spot(spot, *l[spot.name])
self.app.engine.handle(
'update_nodes', (self.app.character.name, node_upd)
)
self.new_spots = self.spots_unposd = []

def arrows(self):
Expand Down
1 change: 0 additions & 1 deletion ELiDE/ELiDE/board/pawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
NumericProperty,
ReferenceListProperty
)
from kivy.logger import Logger
from .pawnspot import PawnSpot
from ..util import trigger

Expand Down
13 changes: 2 additions & 11 deletions ELiDE/ELiDE/board/pawnspot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
ObjectProperty,
BooleanProperty,
ListProperty,
StringProperty,
NumericProperty,
ReferenceListProperty
)
from kivy.graphics import (
InstructionGroup,
Expand Down Expand Up @@ -49,20 +46,14 @@ def on_remote(self, *args):
self.offxs = self.remote.get('_offxs', zeroes)
self.offys = self.remote.get('_offys', zeroes)
self.stackhs = self.remote.get('_stackhs', zeroes)

def finalize(self):
self.bind(
paths=self._trigger_push_image_paths,
offxs=self._trigger_push_offxs,
offys=self._trigger_push_offys,
stackhs=self._trigger_push_stackhs
)
if '_image_paths' not in self.remote:
self.remote['_image_paths'] = list(self.paths)
if '_offxs' not in self.remote:
self.remote['_offxs'] = zeroes
if '_offys' not in self.remote:
self.remote['_offys'] = zeroes
if '_stackhs' not in self.remote:
self.remote['_stackhs'] = zeroes

def push_image_paths(self, *args):
self.remote['_image_paths'] = list(self.paths)
Expand Down
14 changes: 7 additions & 7 deletions ELiDE/ELiDE/card.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# This file is part of LiSE, a framework for life simulation games.
# Copyright (C) Zachary Spector, [email protected]
"""Widget that looks like a trading card, and a layout within which it
can be dragged and dropped to some particular position within stacks
of other cards.
"""


from kivy.clock import Clock
from kivy.lang import Builder
from kivy.logger import Logger
Expand All @@ -24,13 +31,6 @@
from kivy.uix.widget import Widget


"""Widget that looks like a trading card, and a layout within which it
can be dragged and dropped to some particular position within stacks
of other cards.
"""


dbg = Logger.debug


Expand Down
Loading

0 comments on commit cd3f6ed

Please sign in to comment.