Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / 3 D map editor

Author
Message
Lance
20
Years of Service
User Offline
Joined: 22nd Jul 2003
Location: Third planet from Sun
Posted: 18th Dec 2017 15:48


I am making a basic 3 D 'map editor' and so far it is working . I can read and write to a text file and place the 'blocks' on the map grid . I can add more 'blocks' to the map and text file by loading the file and then adding more 'blocks' and saving . The example below shows how I have been saving the map info (without the comments) . I place a 'block' and then use the 'C' key to enter the new 'block' position and save to the text file at the same time . I am writing to the text file every time I hit the 'C' key . I have been using 'WriteLine' and then 'ReadLine' ..

What I need is a way to delete the last 'block' placed in the text file and it's data ( 5 lines) ..Obviously using Delete removes the 'block' from the map but not from the text file . I can also load and save the map data from 'memblocks' . i need a basic routine to edit the file , from text file or the memblock .
Have I gone in the wrong direction ?

I am learning as I go . I have had AGK2 for about 3 weeks now .

Lance

// Basic example
1 // block number
2 // texture number
3 // X position
-10 // y position
15 // z position
2 // block number **** to remove
4 // texture number **** to remove
6 // x position **** to remove
12 // y position **** to remove
4 // z position **** to remove

Attachments

Login to view attachments
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 18th Dec 2017 22:34
I'm doing my own 3D editor too hehe. It's fun.

Maybe you could store the items in a memblock or an array before saving them, let's say an structure with a status like "Not saved" so you can access easily to each object and push pop any of them on demand.

After that, press S to save.

It's just an example
puzzler2018
User Banned
Posted: 18th Dec 2017 23:09
If any of you had hold of the top professional peices of software (like Autodesk Inventor), it all starts with building models with a

- rectangle (built to a cube)

- circle (built to a cylinder)

and many more

but the framework is already there to be able to create objects thatt inerlink together to build bigger objects

im working on editor to do just that too lol

nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 18th Dec 2017 23:48
I like it! 3D editors everywhere
Lance
20
Years of Service
User Offline
Joined: 22nd Jul 2003
Location: Third planet from Sun
Posted: 26th Dec 2017 17:20
I solved my problem using MemBlocks . Went back to my Atari 800 days (Atari Basic) and using 'RamTop' to store things (and string handling) . Had to do more reading on MemBlocks and how to use them . It was pretty easy after using 'SetMemBlockShort' to remove the last block values and rewrite the map file .. I keep trying to break it but so far it keeps working as written ..

Lance

CODE USED :

CreateMemblockFromFile(2, "raw:C:\AAAATemp\MyFolder\test.txt")
xx= GetMemBlockSize( 2 )
if Change=1 then xx=xx-2

REM 95 blocks are 2230 bytes long +2 bytes for eof marker =2232
for xxa = xx-22 to xx -2 // stay away from EOF marker (2 bytes)

SetMemblockShort( 2, xxa,0 ) // Clears out the last object created
next xxa
CreateFileFromMemblock("raw:C:\AAAATemp\MyFolder\test.txt",2)

B=B-1 // Delete last block from block count

endif
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 27th Dec 2017 22:12
Sounds good!

Login to post a reply

Server time is: 2024-04-20 11:59:02
Your offset time is: 2024-04-20 11:59:02