Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8c0f979
Added initial tile-based world and example (WIP)
rynkruger Apr 7, 2017
97e62a3
Create a termbox that can take in text.
mark-chimes Apr 10, 2017
194e795
Added error checking to move.
rynkruger Apr 11, 2017
5716a45
Big changes to SimText: Starting from scratch. No network, no special…
mark-chimes Apr 17, 2017
160a8d6
Further minor string parsing
mark-chimes Apr 17, 2017
7e84c41
Add very simple test.
mark-chimes Apr 17, 2017
abc8240
Create basic command parsing with first-class functions.
mark-chimes Apr 17, 2017
63483d3
Parse exit command using error handling.
mark-chimes Apr 17, 2017
8356413
Add looking logic.
mark-chimes Apr 17, 2017
635da81
Generate Basic terrain and draw for debugging.
mark-chimes Apr 18, 2017
99c20c7
Add tests to stop Travis complaining. (This needs to be fixed with pr…
mark-chimes Apr 19, 2017
71c59a9
Add missing look events, change terrain to be a little bit more compl…
mark-chimes Apr 19, 2017
f5e308d
Rename simtext to xenoterra
mark-chimes Apr 19, 2017
68dc5e6
Update imports to include xenoterra
mark-chimes Apr 19, 2017
04ab780
Change name from xenoterra to novaterram
mark-chimes Apr 19, 2017
cfdc52c
Add very basic object handling and a single object.
mark-chimes Apr 19, 2017
3b7a6d4
Move tiles and movers into separate 3d slices. Created new struct, Sp…
rynkruger Apr 19, 2017
54b504e
Move terrain and object resolution to world.
mark-chimes Apr 20, 2017
f43d318
Rename to Novus Orbis.
mark-chimes Apr 20, 2017
41a25d0
Use maps for symbol and name conversions for terrain and directions.
mark-chimes Apr 20, 2017
51230ff
Messed up merge
mark-chimes Apr 20, 2017
1e3ad95
Ignore exe files.
mark-chimes Apr 20, 2017
8e9d690
Rename package novusorbis.
mark-chimes Apr 20, 2017
6db9741
Fix build (stupid errors on unused imports grumble grumble)
mark-chimes Apr 20, 2017
9404f65
Resolve directions and display objects and terrain at and possibly be…
mark-chimes Apr 20, 2017
c28dfd1
Get name of first thing at position
mark-chimes Apr 20, 2017
924c6de
Make Space an interface.
rynkruger Apr 23, 2017
f55e202
Merge branch 'tiles' into novusorbis
mark-chimes Apr 23, 2017
b8f6685
Tiles: changing interfaces.
mark-chimes Apr 23, 2017
ab76695
Use some of the tiles stuff a bit.
mark-chimes Apr 23, 2017
031c275
Revert "Use some of the tiles stuff a bit."
mark-chimes Apr 25, 2017
e66eb08
Revert "Tiles: changing interfaces."
mark-chimes Apr 25, 2017
322ce23
Revert "Merge branch 'tiles' into novusorbis"
mark-chimes Apr 25, 2017
45fadfb
Add avatar object for main colonist and move things to own class.
mark-chimes Apr 26, 2017
035bb45
Add interfaces for Thing.
mark-chimes Apr 26, 2017
55c72dc
Add basic movement and improved terrain variety.
mark-chimes Apr 26, 2017
a90489d
Create new logos.
mark-chimes May 1, 2017
b71a985
Add very basic tests for input/output
mark-chimes May 1, 2017
269705f
Add better logo.
mark-chimes May 4, 2017
6a1a212
Separate Concerns.
mark-chimes May 4, 2017
388ba41
Remove lines.
mark-chimes May 5, 2017
d258383
Basefactory.
mark-chimes May 9, 2017
58daff6
Use more embedded types.
mark-chimes May 9, 2017
112adc5
Add exit tests.
mark-chimes May 9, 2017
a2ad70d
Change package positions and create testworld file.
mark-chimes May 11, 2017
a4db82f
Add ice in testworld
mark-chimes May 11, 2017
cc9c640
Reevaluate object specifications.
mark-chimes May 11, 2017
a41d982
Structures are now containers as well as movers.
mark-chimes May 15, 2017
dc0ca71
Refactor of directional (logic not quite correct)
mark-chimes May 15, 2017
437328d
Inventories and things (many bugs - need tests).
mark-chimes May 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
.idea/
*.exe
resources/novusorbis.wav
novusorbis/goals.txt
resources/Novus Orbis.mp3
resources/Novus.aup
resources/Novus.wav
resources/NovusWithMusic.aup
resources/NovusWithMusic.wav
resources/NovusWithMusicShort.aup
resources/NovusWithMusicShort.wav
resources/NovusWithMusicShort_data/e00/d00/e000028f.au
resources/NovusWithMusicShort_data/e00/d00/e0000317.au
resources/NovusWithMusicShort_data/e00/d00/e000059c.au
resources/NovusWithMusicShort_data/e00/d00/e000099e.au
resources/NovusWithMusicShort_data/e00/d00/e0000c35.au
resources/NovusWithMusicShort_data/e00/d00/e0000e75.au
resources/NovusWithMusic_data/e00/d00/e000015b.au
resources/NovusWithMusic_data/e00/d00/e000021e.au
resources/NovusWithMusic_data/e00/d00/e0000291.au
resources/NovusWithMusic_data/e00/d00/e000059c.au
resources/NovusWithMusic_data/e00/d00/e000075a.au
resources/NovusWithMusic_data/e00/d00/e0000b64.au
resources/NovusWithMusic_data/e00/d00/e0000c35.au
resources/NovusWithMusic_data/e00/d00/e0000c50.au
resources/NovusWithMusic_data/e00/d00/e0000d0a.au
resources/NovusWithMusic_data/e00/d00/e0000e0c.au
resources/Novus_data/e00/d00/e0000037.au
resources/Novus_data/e00/d00/e0000753.au
resources/Novus_data/e00/d00/e000075f.au
resources/Novus_data/e00/d00/e0000f31.au
resources/Orbis.wav
14 changes: 14 additions & 0 deletions novusorbis/cmd/startnovus/novusorbis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import (
"github.com/subspace-engine/subspace/novusorbis/ui"
"github.com/subspace-engine/subspace/novusorbis/game"
)

func main() {
inOut := ui.NewInputOutput()
questionAsker := game.QuestionAsker{InputOutput : inOut}
baseFactory := game.BaseFactory{QuestionAsker : questionAsker}
game := game.GameManager{InputOutput : inOut, BaseFactory: baseFactory}
game.Start()
}
63 changes: 63 additions & 0 deletions novusorbis/cmd/testworld/gametest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package main

/**
* This file sets up a small test world, skipping any intro etc.
*/

import (
"github.com/subspace-engine/subspace/novusorbis/ui"
"github.com/subspace-engine/subspace/novusorbis/game"
"github.com/subspace-engine/subspace/novusorbis/world"
)

type testGameManager struct {
*game.GameManager
}

func main() {
inOut := ui.NewInputOutput()
questionAsker := game.QuestionAsker{InputOutput : inOut}
baseFactory := game.BaseFactory{QuestionAsker : questionAsker}
g := game.GameManager{InputOutput : inOut, BaseFactory: baseFactory}
t := testGameManager{&g}
t.initializeTestWorld()
t.InitializeCommandsMap()
t.SetUpDirectionMaps()
t.MainLoop()
}

func (g *testGameManager) initializeTestWorld() {
w := &world.World{}
w.Size = 5
g.World = w
mid := w.Size/2

c := world.Position{mid,mid,mid}
w.Cursor = c

w.GenerateTerrain()

thingStore := &world.MapMoverStore{}
thingStore.Initialize()
w.Things = thingStore

w.Structures = &world.MapMoverStore{}

w.MainColonist = g.CreateDefaultColonist() // TODO
w.MainBase = g.CreateDefaultBase() // TODO

pos := world.Position{mid,mid,mid}
mainAvatar := g.World.MainColonist.Avatar
mainAvatar.SetPosition(pos)
thingStore.AddObjectAt(mainAvatar, pos)

baseAvatar := g.World.MainBase.Avatar
baseAvatar.SetPosition(pos)
thingStore.AddObject(baseAvatar)

icePos, _ := world.NewPosition(mid).RelativePosition(-1,-1,0)
ice := world.NewMover("ice", "i", icePos)
thingStore.AddObject(ice)

return
}
157 changes: 157 additions & 0 deletions novusorbis/game/directional.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package game

import (
"strings"
"errors"
"github.com/subspace-engine/subspace/novusorbis/world"
)

func (g *GameManager) SetUpDirectionMaps() (err error) {
letterToDirection := map[rune]Direction{'h':HERE,'n':NORTH,'e':EAST,'s':SOUTH,
'w':WEST,'u':UP,'d':DOWN,'x':CANCEL,'p':SHOW_POSSIBILITIES}
g.LetterToDirection = letterToDirection

directionToString := map[Direction]string{HERE : "Here", NORTH : "North", EAST : "East",
SOUTH : "South", WEST : "West", UP : "Up", DOWN : "Down"}
g.DirectionToString = directionToString

err = nil
return
}


type Direction int

const (
HERE Direction = iota
NORTH
EAST
SOUTH
WEST
UP
DOWN
SHOW_POSSIBILITIES
CANCEL
RETRY
)


func (g *GameManager) GetDirection(dirString string) (dir Direction) {
dirChar := dirString[0]
dir, isThere := g.LetterToDirection[rune(dirChar)]

if !isThere {
dir = RETRY
}
return
}

func (g *GameManager) ReadDirection(actionString string, args []string) (dir Direction) {
if (len(args) <= 1) {
g.Println("In which direction would you like to " + actionString +
"? ('c' to cancel or 'p' for possible directions)")
dirString, _ := g.Read()
dirString = strings.ToLower(dirString)
if (strings.HasPrefix(dirString, actionString)) {
dirString = strings.TrimSpace(dirString[4:])
}
dir = g.GetDirection(dirString)
if (dir == RETRY) {
return
}
} else {
dirString := args[1]
dir = g.GetDirection(dirString)
if (dir == RETRY) {
return
}
}
return
}

func (g *GameManager) getDirectionalPosition(dir Direction) (pos world.Position, err error) {
switch dir {
case HERE: pos = world.Position{0, 0, 0}
case NORTH: pos = world.Position{0, 1, 0}
case EAST: pos = world.Position{1, 0, 0}
case SOUTH: pos = world.Position{0, -1, 0}
case WEST: pos = world.Position{-1, 0, 0}
case UP: pos = world.Position{0, 0, 1}
case DOWN: pos = world.Position{0, 0, -1}
default: err = errors.New("UnrecognizedDirection")
}
return
}

// TODO direction calculation logic is not correct
func (g *GameManager) StateItemsAtSpecifiedDirection(actionString string,
cancellationString string, args []string) (pos world.Position, err error){
w := g.World
var name1, name2 string
var things []world.Mover
var isClear bool

dir := g.ReadDirection(actionString, args)

if dir == SHOW_POSSIBILITIES {
g.Println("The possible directions are H, N, E, S, W, U, D")
err = errors.New("Showing possibilities")
return
} else if dir == CANCEL {
g.Println("Cancelled " + cancellationString + ".")
err = errors.New("Cancelled")
return
}

pos, err = g.getDirectionalPosition(dir);
if (err != nil) {
g.Println("Unrecognized direction. The possible directions are H, N, E, S, W, U, D,")
// TODO let user try again
return
}

name1, name2, things, isClear, _ = w.GetNamesOfTerrainsAndObjects(pos)

dirName := g.DirectionToString[dir]

var middleString string
var endString string
if (isClear) {
middleString = " above " + name2
}

if (things != nil) && (len(things) > 0) {
endString = " with: "
for i, thing := range things {
endString += thing.Name()
if (i < len(things) - 2) {
endString += ","
} else if (i == len(things) - 2) {
endString += ", and "
}
}
}
g.Println(dirName + " is " + name1 + middleString + endString + ".")
err = nil
return
}

func (g *GameManager) Look(args []string) (err error) {
actionString := "look"
cancellationString := "looking"
g.StateItemsAtSpecifiedDirection(actionString, cancellationString, args)
return
}

func (g *GameManager) Move(args []string) (err error) {
actionString := "look"
cancellationString := "looking"
pos, err := g.StateItemsAtSpecifiedDirection(actionString, cancellationString, args)
if (err != nil) {
err = nil
return
}
g.World.ShiftColonist(pos)
err = nil
return
}
Loading